php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25282 API missing two important parameters
Submitted: 2003-08-27 23:48 UTC Modified: 2003-11-18 10:57 UTC
From: nigel at e-easy dot com dot au Assigned:
Status: Not a bug Package: InterBase related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 - 3 = ?
Subscribe to this entry?

 
 [2003-08-27 23:48 UTC] nigel at e-easy dot com dot au
Description:
------------
PHP's support for Interbase(Firebird) is missing two important 
features for transaction handling - Shared, and Protected. 
These two additions enable performance to surpass Oracle on 
updates under heavy load. 
 
The patch is as follows: 
--- interbase.c.orig    Thu Aug 28 11:39:22 2003 
+++ interbase.c Thu Aug 28 12:22:44 2003 
@@ -563,6 +563,8 @@ 
        
REGISTER_LONG_CONSTANT("IBASE_REC_NO_VERSION", 
PHP_IBASE_REC_NO_VERSION 
, CONST_PERSISTENT); 
        REGISTER_LONG_CONSTANT("IBASE_NOWAIT", 
PHP_IBASE_NOWAIT, CONST_PERSISTE 
NT); 
        REGISTER_LONG_CONSTANT("IBASE_WAIT", 
PHP_IBASE_WAIT, CONST_PERSISTENT); 
+       REGISTER_LONG_CONSTANT("IBASE_SHARED", 
PHP_IBASE_SHARED, CONST_PERSISTE 
NT); 
+       REGISTER_LONG_CONSTANT("IBASE_PROTECTED", 
PHP_IBASE_PROTECTED, CONST_PE 
RSISTENT); 
         
        return SUCCESS; 
 } 
@@ -1574,6 +1576,13 @@ 
                        tpb[tpb_len++] = isc_tpb_nowait; 
                } else { 
                        tpb[tpb_len++] = isc_tpb_wait;  /* default lock 
resolut 
ion */ 
+               } 
+               /* Pre Allocation Modes */ 
+               if (trans_argl & PHP_IBASE_SHARED) { 
+                       tpb[tpb_len++] = isc_tpb_shared; 
+               } 
+               if (trans_argl & PHP_IBASE_PROTECTED) { 
+                       tpb[tpb_len++] = isc_tpb_shared; 
                } 
        } 
  
--- php_interbase.h.orig        Thu Aug 28 11:59:34 2003 
+++ php_interbase.h     Thu Aug 28 12:21:34 2003 
@@ -175,7 +175,9 @@ 
        PHP_IBASE_REC_VERSION           = 64, 
        PHP_IBASE_REC_NO_VERSION        = 128, 
        PHP_IBASE_NOWAIT                                = 256, 
-       PHP_IBASE_WAIT                          = 512 
+       PHP_IBASE_WAIT                          = 512, 
+       PHP_IBASE_SHARED                = 1024, 
+       PHP_IBASE_PROTECTED             = 2048 
 }; 
  
 #ifdef ZTS 
 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-27 23:52 UTC] nigel at e-easy dot com dot au
The patch for interbase.c where we apply the mask for 
PHP_IBASE_PROTECTED should read: 
+                       tpb[tpb_len++] = isc_tpb_protected 
 
and NOT: 
+                       tpb[tpb_len++] = isc_tpb_shared 
 
....sorry...
 [2003-08-28 04:47 UTC] abies@php.net
Passing the table reservation flags in this way will result in absolutely nothing, because they require a table name as an extra argument. You cannot just lock all tables for [shared|protected] [read|write].

As PHP5 will contain support in ibase_trans() for multiple databases, adding tablenames as arguments as well would clutter up the prototype too much.

PHP5 _will_ allow you to execute SET TRANSACTION statements. Then you can pass table reservation flags (with tablenames) anyway you like.

I seriously doubt, though, that unconditionally locking tables instead of only when necessary would actually improve performance. As far as I know, these parameters were introduced to handle lock conflicts.
 [2003-08-28 17:38 UTC] nigel at e-easy dot com dot au
Handling Lock Conflicts is what I'm trying to do.
By stating that I want to reserve a table as shared write, I can then update a single field much faster, as any transaction can write to the table - even if it's been updated inside this transaction space.

...Or so I thought...

On the Firebird list, they're stating that the default mode is Shared Write - not mentioned anywhere in the PHP source.

Ah, another undocumented behaviour.

Thanks for your time!

N.
 [2003-08-28 18:06 UTC] abies@php.net
The constants are useless without a way of specifying a table name. Therefore, this will not be changed. PHP5 will support table reservation by means of SET TRANSACTION statements.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 16:01:30 2024 UTC