From ca334e81adda083a5f2ff1ce4ceaf466bbac636c Mon Sep 17 00:00:00 2001 From: SAF Date: Mon, 27 Jul 2020 02:23:58 +0300 Subject: [PATCH] Make default transaction Read-Commited RecVersion NoWait (more useful parameters than server defaults) --- interbase.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/interbase.c b/interbase.c index 0367a77..3d1e6f5 100644 --- a/interbase.c +++ b/interbase.c @@ -1271,6 +1271,9 @@ PHP_FUNCTION(ibase_trans) int _php_ibase_def_trans(ibase_db_link *ib_link, ibase_trans **trans) /* {{{ */ { + unsigned short tpb_len = 0; + char last_tpb[TPB_MAX_SIZE]; + if (ib_link == NULL) { php_error_docref(NULL, E_WARNING, "Invalid database link"); return FAILURE; @@ -1295,7 +1298,14 @@ int _php_ibase_def_trans(ibase_db_link *ib_link, ibase_trans **trans) /* {{{ */ ib_link->tr_list->trans = tr; } if (tr->handle == 0) { - if (isc_start_transaction(IB_STATUS, &tr->handle, 1, &ib_link->handle, 0, NULL)) { + tpb_len = 0; + last_tpb[tpb_len++] = isc_tpb_version3; + last_tpb[tpb_len++] = isc_tpb_write; + last_tpb[tpb_len++] = isc_tpb_read_committed; + last_tpb[tpb_len++] = isc_tpb_rec_version; + last_tpb[tpb_len++] = isc_tpb_nowait; + + if (isc_start_transaction(IB_STATUS, &tr->handle, 1, &ib_link->handle, tpb_len, last_tpb)) { _php_ibase_error(); return FAILURE; }