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)');
41 $db->rollBack();
50 $db->query('DROP TABLE IF EXISTS test2');
51 $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM');
52 $db->beginTransaction();
53 $db->query('INSERT INTO test2(id) VALUES (1)');
54 $db->rollBack();
55 $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC);
59 $db->query('DROP TABLE IF EXISTS test2');
61 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
62 $db->beginTransaction();
63 $db->query('DELETE FROM test');
64 $db->rollBack();
65 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
67 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
68 $db->beginTransaction();
69 $db->query('DELETE FROM test');
70 $db->rollBack();
71 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
73 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
74 $db->beginTransaction();
75 $db->query('DELETE FROM test');
76 $db->commit();
77 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
79 $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
80 $db->beginTransaction();
81 $db->query('DELETE FROM test');
82 $db->commit();
83 var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
90 $db = MySQLPDOTest::factory();
91 $db->exec('DROP TABLE IF EXISTS test');
92 $db->exec('DROP TABLE IF EXISTS test2');