Patch php5-bug63105.patch for InterBase related Bug #63105
Patch version 2013-09-25 04:47 UTC
Return to Bug #63105 |
Download this patch
Patch Revisions:
Developer: slavb18@gmail.com
diff -ur ext/pdo.orig/pdo_dbh.c ext/pdo/pdo_dbh.c
--- ext/pdo.orig/pdo_dbh.c 2013-09-24 20:31:51.000000000 +0400
+++ ext/pdo/pdo_dbh.c 2013-09-24 22:26:51.000000000 +0400
@@ -1472,6 +1472,7 @@
REGISTER_PDO_CLASS_CONST_LONG("ATTR_MAX_COLUMN_LEN",(long)PDO_ATTR_MAX_COLUMN_LEN);
REGISTER_PDO_CLASS_CONST_LONG("ATTR_EMULATE_PREPARES",(long)PDO_ATTR_EMULATE_PREPARES);
REGISTER_PDO_CLASS_CONST_LONG("ATTR_DEFAULT_FETCH_MODE",(long)PDO_ATTR_DEFAULT_FETCH_MODE);
+ REGISTER_PDO_CLASS_CONST_LONG("ATTR_READONLY",(long)PDO_ATTR_READONLY);
REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_SILENT", (long)PDO_ERRMODE_SILENT);
REGISTER_PDO_CLASS_CONST_LONG("ERRMODE_WARNING", (long)PDO_ERRMODE_WARNING);
diff -ur ext/pdo.orig/php_pdo_driver.h ext/pdo/php_pdo_driver.h
--- ext/pdo.orig/php_pdo_driver.h 2013-09-24 20:31:51.000000000 +0400
+++ ext/pdo/php_pdo_driver.h 2013-09-24 22:22:33.000000000 +0400
@@ -138,6 +138,7 @@
PDO_ATTR_MAX_COLUMN_LEN, /* make database calculate maximum length of data found in a column */
PDO_ATTR_DEFAULT_FETCH_MODE, /* Set the default fetch mode */
PDO_ATTR_EMULATE_PREPARES, /* use query emulation rather than native */
+ PDO_ATTR_READONLY, /* read-only mode as a hint to the driver to enable database optimizations */
/* this defines the start of the range for driver specific options.
* Drivers should define their own attribute constants beginning with this
diff -ur ext/pdo_firebird.orig/firebird_driver.c ext/pdo_firebird/firebird_driver.c
--- ext/pdo_firebird.orig/firebird_driver.c 2013-09-21 09:09:11.000000000 +0400
+++ ext/pdo_firebird/firebird_driver.c 2013-09-24 23:12:39.000000000 +0400
@@ -318,6 +318,39 @@
{
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
char tpb[8] = { isc_tpb_version3 }, *ptpb = tpb+1;
+ /* access mode */
+ *ptpb++ = H->readonly?isc_tpb_read:isc_tpb_write;
+
+ /* isolation level */
+ switch(H->isolation_level){
+ case PDO_FB_TRANS_COMMITTED:
+ *ptpb++ = isc_tpb_read_committed;
+ *ptpb++ = isc_tpb_rec_version;
+ break;
+ case PDO_FB_TRANS_COMMITTED_NO_REC_VERSION:
+ *ptpb++ = isc_tpb_read_committed;
+ *ptpb++ = isc_tpb_no_rec_version;
+ break;
+ case PDO_FB_TRANS_CONCURRENCY:
+ *ptpb++ = isc_tpb_concurrency;
+ break;
+ case PDO_FB_TRANS_CONSISTENCY:
+ *ptpb++ = isc_tpb_consistency;
+ break;
+ }
+ /* lock resolution */
+ if (H->lock_timeout==0) {
+ *ptpb++ = isc_tpb_nowait;
+ }else{
+ *ptpb++ = isc_tpb_wait;
+ if(H->lock_timeout>0){
+ *ptpb++ = isc_tpb_lock_timeout;
+ *ptpb++ = sizeof(short);
+ *(short*)ptpb = H->lock_timeout;
+ ptpb += sizeof(short);
+ }
+ }
+
#if abies_0
if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) {
if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) {
@@ -528,6 +561,17 @@
}
spprintf(&H->timestamp_format, 0, "%s", Z_STRVAL_P(val));
return 1;
+ case PDO_ATTR_READONLY:
+ convert_to_boolean(val);
+ H->readonly=Z_BVAL_P(val);
+ return 1;
+ case PDO_ATTR_TIMEOUT:
+ H->lock_timeout=Z_LVAL_P(val);
+ return 1;
+ case PDO_FB_TRANS_ISOLATION_LEVEL:
+ H->isolation_level=Z_LVAL_P(val);
+ return 1;
+
}
return 0;
}
@@ -598,6 +642,15 @@
case PDO_ATTR_FETCH_TABLE_NAMES:
ZVAL_BOOL(val, H->fetch_table_names);
return 1;
+ case PDO_ATTR_READONLY:
+ ZVAL_BOOL(val,H->readonly);
+ return 1;
+ case PDO_ATTR_TIMEOUT:
+ ZVAL_LONG(val,H->lock_timeout);
+ return 1;
+ case PDO_FB_TRANS_ISOLATION_LEVEL:
+ ZVAL_LONG(val,H->isolation_level);
+ return 1;
}
return 0;
}
diff -ur ext/pdo_firebird.orig/pdo_firebird.c ext/pdo_firebird/pdo_firebird.c
--- ext/pdo_firebird.orig/pdo_firebird.c 2013-09-21 09:09:11.000000000 +0400
+++ ext/pdo_firebird/pdo_firebird.c 2013-09-24 22:48:01.000000000 +0400
@@ -73,6 +73,11 @@
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (long) PDO_FB_ATTR_DATE_FORMAT);
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (long) PDO_FB_ATTR_TIME_FORMAT);
REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (long) PDO_FB_ATTR_TIMESTAMP_FORMAT);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_TRANS_ISOLATION_LEVEL", (long) PDO_FB_TRANS_ISOLATION_LEVEL);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_TRANS_COMMITTED", (long) PDO_FB_TRANS_COMMITTED);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_TRANS_COMMITTED_NO_REC_VERSION", (long) PDO_FB_TRANS_COMMITTED_NO_REC_VERSION);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_TRANS_CONSISTENCY", (long) PDO_FB_TRANS_CONSISTENCY);
+ REGISTER_PDO_CLASS_CONST_LONG("FB_TRANS_CONCURRENCY", (long) PDO_FB_TRANS_CONCURRENCY);
php_pdo_register_driver(&pdo_firebird_driver);
diff -ur ext/pdo_firebird.orig/php_pdo_firebird_int.h ext/pdo_firebird/php_pdo_firebird_int.h
--- ext/pdo_firebird.orig/php_pdo_firebird_int.h 2013-09-21 09:09:11.000000000 +0400
+++ ext/pdo_firebird/php_pdo_firebird_int.h 2013-09-24 23:25:59.000000000 +0400
@@ -81,11 +81,17 @@
char *date_format;
char *time_format;
char *timestamp_format;
-
+ /* lock timeout, seconds (0: no_wait, -1: unlimited) */
+ short lock_timeout;
/* prepend table names on column names in fetch */
unsigned fetch_table_names:1;
+ /* readonly transaction */
+ unsigned readonly:1;
+ /* transaction isolation level, see PDO_FB_TRANS_XXX constants */
+ unsigned isolation_level:2;
+
- unsigned _reserved:31;
+ unsigned _reserved:12;
} pdo_firebird_db_handle;
@@ -136,6 +142,12 @@
PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
PDO_FB_ATTR_TIME_FORMAT,
PDO_FB_ATTR_TIMESTAMP_FORMAT,
+ /* transaction isolation level */
+ PDO_FB_TRANS_ISOLATION_LEVEL,
+ PDO_FB_TRANS_COMMITTED = 0,
+ PDO_FB_TRANS_COMMITTED_NO_REC_VERSION = 1,
+ PDO_FB_TRANS_CONCURRENCY = 2,
+ PDO_FB_TRANS_CONSISTENCY = 3,
};
#endif /* PHP_PDO_FIREBIRD_INT_H */
|