Lines Matching refs:db
9 $db = MySQLPDOTest::factory();
10 if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
16 $db = MySQLPDOTest::factory();
17 MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
19 $db->beginTransaction();
21 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
24 $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
26 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
30 $db->rollBack();
32 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
36 $db->beginTransaction();
37 $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
38 $db->query('DROP TABLE IF EXISTS test2');
39 $db->query('CREATE TABLE test2(id INT)');
42 $db->rollBack();
51 $db->query('DROP TABLE IF EXISTS test2');
52 $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM');
53 $db->beginTransaction();
54 $db->query('INSERT INTO test2(id) VALUES (1)');
55 $db->rollBack();
56 $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC);
60 $db->query('DROP TABLE IF EXISTS test2');
62 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
63 $db->beginTransaction();
64 $db->query('DELETE FROM test');
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 test');
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 test');
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 test');
83 $db->commit();
84 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
91 $db = MySQLPDOTest::factory();
92 $db->exec('DROP TABLE IF EXISTS test');
93 $db->exec('DROP TABLE IF EXISTS test2');