Lines Matching refs:db
8 $db = MySQLPDOTest::factory();
9 if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
15 $db = MySQLPDOTest::factory();
16 MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
18 $db->beginTransaction();
20 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
23 $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
25 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
29 $db->rollBack();
31 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
35 $db->beginTransaction();
36 $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
37 $db->query('DROP TABLE IF EXISTS test2');
38 $db->query('CREATE TABLE test2(id INT)');
40 $db->rollBack();
41 $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
47 $db->query('DROP TABLE IF EXISTS test2');
48 $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM');
49 $db->beginTransaction();
50 $db->query('INSERT INTO test2(id) VALUES (1)');
51 $db->rollBack();
52 $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC);
56 $db->query('DROP TABLE IF EXISTS test2');
58 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
59 $db->beginTransaction();
60 $db->query('DELETE FROM test');
61 $db->rollBack();
62 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
64 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
65 $db->beginTransaction();
66 $db->query('DELETE FROM test');
67 $db->rollBack();
68 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
70 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
71 $db->beginTransaction();
72 $db->query('DELETE FROM test');
73 $db->commit();
74 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
76 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
77 $db->beginTransaction();
78 $db->query('DELETE FROM test');
79 $db->commit();
80 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
87 $db = MySQLPDOTest::factory();
88 $db->exec('DROP TABLE IF EXISTS test');
89 $db->exec('DROP TABLE IF EXISTS test2');