Lines Matching refs:db
13 $db = MySQLPDOTest::factory();
18 … MySQLPDOTest::createTestTable($table, $db, MySQLPDOTest::detect_transactional_mysql_engine($db));
20 $db->beginTransaction();
22 $row = $db->query("SELECT COUNT(*) AS _num FROM {$table}")->fetch(PDO::FETCH_ASSOC);
25 $db->query("INSERT INTO {$table}(id, label) VALUES (100, 'z')");
27 $row = $db->query("SELECT COUNT(*) AS _num FROM {$table}")->fetch(PDO::FETCH_ASSOC);
31 $db->rollBack();
33 $row = $db->query("SELECT COUNT(*) AS _num FROM {$table}")->fetch(PDO::FETCH_ASSOC);
37 $db->beginTransaction();
38 $db->query("INSERT INTO {$table}(id, label) VALUES (100, 'z')");
39 $db->query("CREATE TABLE {$table2}(id INT)");
42 $db->rollBack();
51 $db->query("DROP TABLE IF EXISTS {$table2}");
52 $db->query("CREATE TABLE {$table2}(id INT) ENGINE=MyISAM");
53 $db->beginTransaction();
54 $db->query("INSERT INTO {$table2}(id) VALUES (1)");
55 $db->rollBack();
56 $row = $db->query("SELECT COUNT(*) AS _num FROM {$table2}")->fetch(PDO::FETCH_ASSOC);
60 $db->query("DROP TABLE IF EXISTS {$table2}");
62 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
63 $db->beginTransaction();
64 $db->query("DELETE FROM {$table}");
65 $db->rollBack();
66 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
68 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
69 $db->beginTransaction();
70 $db->query("DELETE FROM {$table}");
71 $db->rollBack();
72 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
74 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
75 $db->beginTransaction();
76 $db->query("DELETE FROM {$table}");
77 $db->commit();
78 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
80 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
81 $db->beginTransaction();
82 $db->query("DELETE FROM {$table}");
83 $db->commit();
84 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
91 $db = MySQLPDOTest::factory();
92 $db->exec('DROP TABLE IF EXISTS pdo_mysql_rollback');
93 $db->exec('DROP TABLE IF EXISTS pdo_mysql_rollback_2');