Lines Matching refs:db
8 $db = MySQLPDOTest::factory();
13 $db = MySQLPDOTest::factory();
16 if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
20 $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
25 if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
28 $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
33 if (!$db->query('SET autocommit = 1'))
34 printf("[005] Cannot turn on server autocommit mode, %s\n", var_export($db->errorInfo(), true));
36 if (0 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
40 if (!$db->query('SET autocommit = 0'))
41 printf("[007] Cannot turn off server autocommit mode, %s\n", var_export($db->errorInfo(), true));
43 if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1))
46 $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
50 if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
53 if (MySQLPDOTest::detect_transactional_mysql_engine($db)) {
56 MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
57 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
60 $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
62 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
67 $db->query('ROLLBACK');
68 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
72 if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
75 $db->query('DELETE FROM test WHERE id = 100');
76 $db->query('ROLLBACK');
77 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
81 $db->query('DELETE FROM test WHERE id = 100');
82 $db->query('COMMIT');
84 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);