@@ -17,14 +17,14 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
17
17
18
18
MySQLPDOTest::createTestTable ($ db , MySQLPDOTest::detect_transactional_mysql_engine ($ db ));
19
19
20
- if (1 !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
20
+ if (true !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
21
21
printf ("[001] Autocommit should be on by default \n" );
22
22
23
23
if (false == $ db ->beginTransaction ())
24
24
printf ("[002] Cannot start a transaction, [%s] [%s] \n" ,
25
25
$ db ->errorCode (), implode (' ' , $ db ->errorInfo ()));
26
26
27
- if (1 !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
27
+ if (true !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
28
28
printf ("[003] Autocommit should be on by default, beginTransaction() shall not impact it \n" );
29
29
30
30
if (0 == $ db ->exec ('DELETE FROM test ' ))
@@ -51,7 +51,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
51
51
if (!$ db ->commit ())
52
52
printf ("[008] [%s] %s \n" , $ db ->errorCode (), implode (' ' , $ db ->errorInfo ()));
53
53
54
- if (1 !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
54
+ if (true !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
55
55
printf ("[009] Autocommit should be on after commit() \n" );
56
56
57
57
if (!($ stmt = $ db ->query (sprintf ('SELECT id, label FROM test WHERE id = %d ' , $ row ['id ' ]))))
@@ -92,7 +92,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
92
92
if (!$ db ->rollback ())
93
93
printf ("[018] [%s] %s \n" , $ db ->errorCode (), implode (' ' , $ db ->errorInfo ()));
94
94
95
- if (1 !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
95
+ if (true !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
96
96
printf ("[019] Autocommit should be on after rollback \n" );
97
97
98
98
if (!($ stmt = $ db ->query (sprintf ('SELECT id, label FROM test WHERE id = %d ' , $ row ['id ' ]))))
@@ -133,7 +133,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
133
133
134
134
// Turn off autocommit using a server variable
135
135
$ db ->exec ('SET @@autocommit = 0 ' );
136
- if (1 === $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
136
+ if (true === $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
137
137
printf ("[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions? \n" );
138
138
139
139
if (!$ db ->beginTransaction ())
@@ -156,7 +156,7 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
156
156
printf ("[031] Cannot start a transaction, [%s] [%s] \n" ,
157
157
$ db ->errorCode (), implode (' ' , $ db ->errorInfo ()));
158
158
159
- if (1 !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
159
+ if (true !== $ db ->getAttribute (PDO ::ATTR_AUTOCOMMIT ))
160
160
printf ("[032] Autocommit should be on my default, beginTransaction() should not change that \n" );
161
161
162
162
if (0 == $ db ->exec ('DELETE FROM test ' ))
0 commit comments