diff options
Diffstat (limited to 'ext/interbase/tests/005.phpt')
-rw-r--r-- | ext/interbase/tests/005.phpt | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt index 8523443078..b460adceaf 100644 --- a/ext/interbase/tests/005.phpt +++ b/ext/interbase/tests/005.phpt @@ -6,7 +6,7 @@ InterBase: transactions <?php require("interbase.inc"); - + ibase_connect($test_base); @ibase_query("create table test5 (i integer)"); @@ -15,7 +15,7 @@ InterBase: transactions echo "default transaction:\n"; - + /* Difference between default and other transactions: default committed when you call ibase_close(). @@ -30,14 +30,14 @@ ibase_blob_create(), ibase_blob_import() first time. /* simple default transaction test without ibase_trans() */ - + ibase_connect($test_base); echo "empty table\n"; /* out_table call ibase_query() and ibase_query() start default transaction */ - out_table("test5"); + out_table("test5"); /* in default transaction context */ ibase_query("insert into test5 (i) values (1)"); @@ -49,13 +49,13 @@ simple default transaction test without ibase_trans() echo "after rollback table empty again\n"; out_table("test5"); /* started new default transaction */ - + ibase_query("insert into test5 (i) values (2)"); ibase_close(); /* commit here! */ - + ibase_connect($test_base); - + echo "one row\n"; out_table("test5"); ibase_close(); @@ -66,14 +66,14 @@ First open transaction on link will be default. $tr_def_l1 may be omitted. All queryes without link and trans parameters run in this context */ - + $link_def = ibase_connect($test_base); - + $tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */ - + /* all default */ $res = ibase_query("select * from test5"); - + echo "one row\n"; out_result($res,"test5"); @@ -81,15 +81,15 @@ parameters run in this context /* specify transaction context... */ $res = ibase_query($tr_def_l1, "select * from test5"); - + echo "one row... again.\n"; out_result($res,"test5"); ibase_free_result($res); - + /* specify default transaction on link */ $res = ibase_query($link_def, "select * from test5"); - + echo "one row.\n"; out_result($res,"test5"); @@ -98,14 +98,14 @@ parameters run in this context ibase_rollback($link_def); /* just for example */ ibase_close(); - + /* three transaction on default link */ ibase_connect($test_base); - + $res = ibase_query("select * from test5"); - + echo "one row\n"; out_result($res,"test5"); @@ -113,38 +113,38 @@ three transaction on default link $tr_1 = ibase_query("SET TRANSACTION"); $tr_2 = ibase_query("SET TRANSACTION READ ONLY"); - $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT); - $tr_4 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_NO_VERSION+IBASE_NOWAIT); - + $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_VERSION+IBASE_WAIT); + $tr_4 = ibase_trans(IBASE_READ+IBASE_COMMITTED+IBASE_REC_NO_VERSION+IBASE_NOWAIT); + /* insert in first transaction context... */ /* as default */ ibase_query("insert into test5 (i) values (3)"); /* specify context */ ibase_query($tr_1, "insert into test5 (i) values (4)"); - + $res = ibase_query("select * from test5"); - + echo "two rows\n"; out_result($res,"test5"); ibase_free_result($res); - + $res = ibase_query($tr_1, "select * from test5"); - + echo "two rows again\n"; out_result($res,"test5"); ibase_free_result($res); - + ibase_commit(); ibase_commit($tr_1); $tr_1 = ibase_trans(); ibase_query($tr_1, "insert into test5 (i) values (5)"); - + /* tr_2 is IBASE_READ + IBASE_CONCURRENCY + IBASE_WAIT */ $res = ibase_query($tr_2, "select * from test5"); - + echo "one row in second transaction\n"; out_result($res,"test5"); @@ -152,7 +152,7 @@ three transaction on default link /* tr_3 is IBASE_COMMITTED + IBASE_REC_VERSION + IBASE_WAIT */ $res = ibase_query($tr_3, "select * from test5"); - + echo "three rows in third transaction\n"; out_result($res,"test5"); @@ -160,12 +160,12 @@ three transaction on default link /* tr_4 IBASE_COMMITTED + IBASE_REC_NO_VERSION + IBASE_NOWAIT */ $res = ibase_query($tr_4, "select * from test5"); - + echo "three rows in fourth transaction with deadlock\n"; out_result_trap_error($res,"test5"); - ibase_free_result($res); - + ibase_free_result($res); + ibase_rollback($tr_1); ibase_close(); /* @@ -173,35 +173,35 @@ transactions on second link */ $link_1 = ibase_pconnect($test_base); $link_2 = ibase_pconnect($test_base); - + $tr_1 = ibase_trans(IBASE_DEFAULT, $link_2); /* this default transaction also */ $tr_2 = ibase_trans(IBASE_COMMITTED, $link_2); - + $res = ibase_query($tr_1, "select * from test5"); - + echo "three rows\n"; out_result($res,"test5"); ibase_free_result($res); ibase_query($tr_1, "insert into test5 (i) values (5)"); - + $res = ibase_query($tr_1, "select * from test5"); - + echo "four rows\n"; out_result($res,"test5"); ibase_free_result($res); - + ibase_commit($tr_1); - + $res = ibase_query($tr_2, "select * from test5"); - + echo "four rows again\n"; out_result($res,"test5"); ibase_free_result($res); - + ibase_close($link_1); ibase_close($link_2); |