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 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
21 if (false == $db->beginTransaction())
23 $db->errorCode(), implode(' ', $db->errorInfo()));
25 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
28 if (0 == $db->exec('DELETE FROM test'))
32 $db = null;
33 $db = MySQLPDOTest::factory();
36 if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC')))
37 printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
42 if (!$db->beginTransaction())
43 printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
45 if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
46 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
48 if (!$db->commit())
49 printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
51 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
54 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
55 printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
59 if (!$db->beginTransaction())
60 printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
62 $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id']));
64 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
65 printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
70 if (!$db->commit())
71 printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
73 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
74 printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
83 if (!$db->beginTransaction())
84 printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
86 if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
87 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
89 if (!$db->rollback())
90 printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
92 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
95 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
96 printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
106 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
107 printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
114 if (!$db->beginTransaction())
115 printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
117 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
118 printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
125 $db->commit();
132 $db->exec('SET @@autocommit = 0');
133 if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
136 if (!$db->beginTransaction())
138 $db->errorCode(), implode(' ', $db->errorInfo()));
141 if (false !== $db->beginTransaction()) {
149 $db = MySQLPDOTest::factory();
150 MySQLPDOTest::createTestTable($db, 'MyISAM');
152 if (false == $db->beginTransaction())
154 $db->errorCode(), implode(' ', $db->errorInfo()));
156 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
159 if (0 == $db->exec('DELETE FROM test'))
162 if (!$db->commit())
163 printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
165 if (false == $db->beginTransaction())
167 $db->errorCode(), implode(' ', $db->errorInfo()));
169 if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')"))
171 $db->errorCode(), implode(' ', $db->errorInfo()));
174 if (!$db->rollback())
175 printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
177 var_dump($db->errorCode());
179 if (1 != $db->exec('DELETE FROM test'))