Lines Matching refs:db
9 $db = MySQLPDOTest::factory();
10 if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
16 $db = MySQLPDOTest::factory();
18 MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
20 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
23 if (false == $db->beginTransaction())
25 $db->errorCode(), implode(' ', $db->errorInfo()));
27 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
30 if (0 == $db->exec('DELETE FROM test'))
34 $db = null;
35 $db = MySQLPDOTest::factory();
36 $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
39 if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC')))
40 printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
45 if (!$db->beginTransaction())
46 printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
48 if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
49 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
51 if (!$db->commit())
52 printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
54 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
57 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
58 printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
62 if (!$db->beginTransaction())
63 printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
65 $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id']));
67 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
68 printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
73 if (!$db->commit())
74 printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
76 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
77 printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
86 if (!$db->beginTransaction())
87 printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
89 if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
90 …7] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->err…
92 if (!$db->rollback())
93 printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
95 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
98 if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
99 printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
109 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
110 printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
117 if (!$db->beginTransaction())
118 printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
120 if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
121 printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
128 $db->commit();
135 $db->exec('SET @@autocommit = 0');
136 if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
139 if (!$db->beginTransaction())
141 $db->errorCode(), implode(' ', $db->errorInfo()));
144 if (false !== $db->beginTransaction()) {
152 $db = MySQLPDOTest::factory();
153 MySQLPDOTest::createTestTable($db, 'MyISAM');
155 if (false == $db->beginTransaction())
157 $db->errorCode(), implode(' ', $db->errorInfo()));
159 if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
162 if (0 == $db->exec('DELETE FROM test'))
165 if (!$db->commit())
166 printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
168 if (false == $db->beginTransaction())
170 $db->errorCode(), implode(' ', $db->errorInfo()));
172 if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')"))
174 $db->errorCode(), implode(' ', $db->errorInfo()));
177 if (!$db->rollback())
178 printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
180 var_dump($db->errorCode());
182 if (1 != $db->exec('DELETE FROM test'))