Lines Matching refs:db
8 $db = MySQLPDOTest::factory();
13 $db = MySQLPDOTest::factory();
16 if ('0' !== ($tmp = $db->lastInsertId()))
20 if ('0' !== ($tmp = $db->lastInsertId('sequence_name')))
24 $db->exec('DROP TABLE IF EXISTS test');
25 if ('0' !== ($tmp = $db->lastInsertId()))
28 … $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
29 if ('0' !== ($tmp = $db->lastInsertId()))
32 $stmt = $db->query('SELECT id FROM test LIMIT 1');
33 if ('0' !== ($tmp = $db->lastInsertId()))
37 $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
38 if ('0' !== ($tmp = $db->lastInsertId()))
41 $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY');
42 if ('0' !== ($tmp = $db->lastInsertId()))
46 @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
47 if ('0' !== ($tmp = $db->lastInsertId()))
50 $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')");
51 if ('101' !== ($tmp = $db->lastInsertId()))
54 $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE');
56 $db->exec("REPLACE INTO test(col1) VALUES ('b')");
57 $next_id = (int)$db->lastInsertId();
62 $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
70 $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')");
71 $next_id = (int)$db->lastInsertId();
76 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
79 $db->exec('LOCK TABLE test WRITE');
82 if (MySQLPDOTest::getServerVersion($db) >= 50000) {
83 $stmt = $db->query('SELECT @@auto_increment_increment AS inc');
90 $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
94 $db->exec("INSERT INTO test(col1) VALUES ('z')");
95 $next_id = (int)$db->lastInsertId();
101 … printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
103 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
104 @$db->exec('UNLOCK TABLE test');
108 $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));