Lines Matching refs:db
13 $db = MySQLPDOTest::factory();
17 … MySQLPDOTest::createTestTable($table, $db, MySQLPDOTest::detect_transactional_mysql_engine($db));
19 if (true !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
22 if (false == $db->beginTransaction())
24 $db->errorCode(), implode(' ', $db->errorInfo()));
26 if (true !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
29 if (0 == $db->exec("DELETE FROM {$table}"))
33 $db = null;
34 $db = MySQLPDOTest::factory();
35 $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
38 if (!($stmt = $db->query("SELECT id, label FROM {$table} ORDER BY id ASC")))
39 printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
44 if (!$db->beginTransaction())
45 printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
47 if (1 !== $db->exec(sprintf('DELETE FROM %s WHERE id = %d', $table, $row['id'])))
48 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
50 if (!$db->commit())
51 printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
53 if (true !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
56 … if (!($stmt = $db->query(sprintf('SELECT id, label FROM %s WHERE id = %d', $table, $row['id']))))
57 printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
61 if (!$db->beginTransaction())
62 printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
64 $db->exec(sprintf("INSERT INTO %s (id, label) VALUES (%d, 'z')", $table, $row['id']));
66 … if (!($stmt = $db->query(sprintf('SELECT id, label FROM %s WHERE id = %d', $table, $row['id']))))
67 printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
72 if (!$db->commit())
73 printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
75 … if (!($stmt = $db->query(sprintf('SELECT id, label FROM %s WHERE id = %d', $table, $row['id']))))
76 printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
85 if (!$db->beginTransaction())
86 printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
88 if (1 !== $db->exec(sprintf('DELETE FROM %s WHERE id = %d', $table, $row['id'])))
89 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
91 if (!$db->rollback())
92 printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
94 if (true !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
97 … if (!($stmt = $db->query(sprintf('SELECT id, label FROM %s WHERE id = %d', $table, $row['id']))))
98 printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
108 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
109 printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
116 if (!$db->beginTransaction())
117 printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
119 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
120 printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
127 $db->commit();
134 $db->exec('SET @@autocommit = 0');
135 if (true === $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
138 if (!$db->beginTransaction())
140 $db->errorCode(), implode(' ', $db->errorInfo()));
143 if (false !== $db->beginTransaction()) {
151 $db = MySQLPDOTest::factory();
152 MySQLPDOTest::createTestTable($table, $db, 'MyISAM');
154 if (false == $db->beginTransaction())
156 $db->errorCode(), implode(' ', $db->errorInfo()));
158 if (true !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
161 if (0 == $db->exec("DELETE FROM {$table}"))
164 if (!$db->commit())
165 printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
167 if (false == $db->beginTransaction())
169 $db->errorCode(), implode(' ', $db->errorInfo()));
171 if (0 == $db->exec("INSERT INTO {$table} (id, label) VALUES (1, 'a')"))
173 $db->errorCode(), implode(' ', $db->errorInfo()));
176 if (!$db->rollback())
177 printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
179 var_dump($db->errorCode());
181 if (1 != $db->exec("DELETE FROM {$table}"))
189 $db = MySQLPDOTest::factory();
190 $db->query('DROP TABLE IF EXISTS pdo_mysql_begintransaction');