@@ -761,51 +761,44 @@ static bool php_firebird_begin_transaction(pdo_dbh_t *dbh, bool is_auto_commit_t
761
761
pdo_firebird_db_handle * H = (pdo_firebird_db_handle * )dbh -> driver_data ;
762
762
763
763
/* isc_xxx are all 1 byte. */
764
- char tpb [5 ] = { isc_tpb_version3 }, * ptpb = tpb + 1 ;
764
+ char tpb [4 ] = { isc_tpb_version3 };
765
+
766
+ /* access mode. writable or readonly */
767
+ tpb [1 ] = H -> is_writable_txn ? isc_tpb_write : isc_tpb_read ;
765
768
766
769
if (is_auto_commit_txn ) {
767
770
/*
768
- * In autocommit mode, we need to always read the latest information, that is,
769
- * expect phantom reads, so we set read committed.
771
+ * In autocommit mode, we need to always read the latest information, so we set `read committed`.
770
772
*/
771
- * ptpb ++ = isc_tpb_read_committed ;
772
- * ptpb ++ = isc_tpb_rec_version ;
773
+ tpb [2 ] = isc_tpb_read_committed ;
774
+ /* Not wait to commit indeterminate data. This option required only with `read committed`.*/
775
+ tpb [3 ] = isc_tpb_rec_version ;
773
776
} else {
774
777
switch (H -> txn_isolation_level ) {
775
778
/*
776
- * firebird's read committed has the option to wait until other transactions
779
+ * firebird's ` read committed` has the option to wait until other transactions
777
780
* commit or rollback if there is indeterminate data.
778
781
* Introducing too many configuration values at once can cause confusion, so
779
782
* we don't support in PDO that feature yet.
780
- *
781
- * Also, there is information that depending on the settings, it is possible to
782
- * reproduce behavior like read uncommited, but at least with the current firebird
783
- * API, this is not possible.
784
783
*/
785
784
case PDO_FB_READ_COMMITTED :
786
- * ptpb ++ = isc_tpb_read_committed ;
787
- * ptpb ++ = isc_tpb_rec_version ;
785
+ tpb [2 ] = isc_tpb_read_committed ;
786
+ /* Not wait to commit indeterminate data. This option required only with `read committed`.*/
787
+ tpb [3 ] = isc_tpb_rec_version ;
788
788
break ;
789
789
790
790
case PDO_FB_SERIALIZABLE :
791
- * ptpb ++ = isc_tpb_consistency ;
791
+ tpb [ 2 ] = isc_tpb_consistency ;
792
792
break ;
793
793
794
794
case PDO_FB_REPEATABLE_READ :
795
795
default :
796
- * ptpb ++ = isc_tpb_concurrency ;
796
+ tpb [ 2 ] = isc_tpb_concurrency ;
797
797
break ;
798
798
}
799
799
}
800
800
801
-
802
- if (H -> is_writable_txn ) {
803
- * ptpb ++ = isc_tpb_write ;
804
- } else {
805
- * ptpb ++ = isc_tpb_read ;
806
- }
807
-
808
- if (isc_start_transaction (H -> isc_status , & H -> tr , 1 , & H -> db , (unsigned short )(ptpb - tpb ), tpb )) {
801
+ if (isc_start_transaction (H -> isc_status , & H -> tr , 1 , & H -> db , strlen (tpb ), tpb )) {
809
802
php_firebird_error (dbh );
810
803
return false;
811
804
}
0 commit comments