Lines Matching refs:db
9 $db = MySQLPDOTest::factory();
14 $db = MySQLPDOTest::factory();
17 if ('0' !== ($tmp = $db->lastInsertId()))
21 if ('0' !== ($tmp = $db->lastInsertId('sequence_name')))
25 $db->exec('DROP TABLE IF EXISTS test');
26 if ('0' !== ($tmp = $db->lastInsertId()))
29 … $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
30 if ('0' !== ($tmp = $db->lastInsertId()))
33 $stmt = $db->query('SELECT id FROM test LIMIT 1');
34 if ('0' !== ($tmp = $db->lastInsertId()))
38 $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
39 if ('0' !== ($tmp = $db->lastInsertId()))
42 $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY');
43 if ('0' !== ($tmp = $db->lastInsertId()))
47 @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
48 if ('0' !== ($tmp = $db->lastInsertId()))
51 $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')");
52 if ('101' !== ($tmp = $db->lastInsertId()))
55 $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE');
57 $db->exec("REPLACE INTO test(col1) VALUES ('b')");
58 $next_id = (int)$db->lastInsertId();
63 $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
71 $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')");
72 $next_id = (int)$db->lastInsertId();
77 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
80 $db->exec('LOCK TABLE test WRITE');
83 if (MySQLPDOTest::getServerVersion($db) >= 50000) {
84 $stmt = $db->query('SELECT @@auto_increment_increment AS inc');
91 $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
95 $db->exec("INSERT INTO test(col1) VALUES ('z')");
96 $next_id = (int)$db->lastInsertId();
102 … printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
104 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
105 @$db->exec('UNLOCK TABLE test');
109 $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));