Lines Matching refs:db
15 $db = MySQLPDOTest::factory();
16 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
18 return $db;
21 $db = createDB();
23 $db->query('DROP TABLE IF EXISTS test');
24 $db->query('CREATE TABLE test (first int) ENGINE = InnoDB');
25 $db->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
27 function testNormalQuery(PDO $db, string $name) {
28 $db->exec("SET innodb_lock_wait_timeout = 1");
29 $db->exec("START TRANSACTION");
33 $stmt = $db->query($query);
40 function testPrepareExecute(PDO $db, string $name) {
41 $db->exec("SET innodb_lock_wait_timeout = 1");
42 $db->exec("START TRANSACTION");
45 $stmt = $db->prepare($query);
54 function testUnbuffered(PDO $db, string $name) {
55 $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
56 $db->exec("SET innodb_lock_wait_timeout = 1");
57 $db->exec("START TRANSACTION");
60 $stmt = $db->prepare($query);
71 testNormalQuery($db, 'first connection');
73 unset($db);
77 $db = createDB();
79 testPrepareExecute($db, 'first connection');
81 unset($db);
85 $db = createDB();
87 testUnbuffered($db, 'first connection');
89 unset($db);