Lines Matching refs:db
17 $db = MySQLPDOTest::factory();
18 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
19 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
20 return $db;
23 $db = createDB();
25 $db->query('DROP TABLE IF EXISTS test');
26 $db->query('CREATE TABLE test (first int) ENGINE = InnoDB');
27 $db->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
29 function testNormalQuery(PDO $db, string $name) {
30 $db->exec("SET innodb_lock_wait_timeout = 1");
31 $db->exec("START TRANSACTION");
35 $stmt = $db->query($query);
42 function testPrepareExecute(PDO $db, string $name) {
43 $db->exec("SET innodb_lock_wait_timeout = 1");
44 $db->exec("START TRANSACTION");
47 $stmt = $db->prepare($query);
56 function testUnbuffered(PDO $db, string $name) {
57 $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
58 $db->exec("SET innodb_lock_wait_timeout = 1");
59 $db->exec("START TRANSACTION");
62 $stmt = $db->prepare($query);
73 testNormalQuery($db, 'first connection');
75 unset($db);
79 $db = createDB();
81 testPrepareExecute($db, 'first connection');
83 unset($db);
87 $db = createDB();
89 testUnbuffered($db, 'first connection');
91 unset($db);