Lines Matching refs:db
11 function exec_and_count($offset, &$db, $sql, $exp = NULL) {
15 $ret = $db->exec($sql);
19 $db->errorCode(), implode(' ', $db->errorInfo()));
25 $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
33 $db = MySQLPDOTest::factory();
34 MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
39 exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
40 …exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGI…
41 exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
42 exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2);
43 exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1);
44 …exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3"…
45 exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0);
46 …exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6"…
47 exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2);
48 exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1);
49 exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4);
50 exec_and_count(13, $db, 'DROP TABLE test', 0);
51 exec_and_count(14, $db, 'SET @myvar = 1', 0);
53 exec_and_count(15, $db, 'THIS IS NOT VALID SQL, I HOPE', false);
54 printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
56 …exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENG…
57 exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
60 exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL);
65 $db->errorCode(), implode(' ', $db->errorInfo()));
70 if (MySQLPDOTest::getServerVersion($db) > 50000) {
74 exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0);
75 …exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INT…
78 exec_and_count(20, $db, 'CALL p(@version)', 0);
79 $stmt = $db->query('SELECT @version AS p_version');
88 $stmt = $db->query('SELECT VERSION() AS _version');
100 exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0);
107 $db->errorCode(), implode(' ', $db->errorInfo()));
113 exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0);
114 …exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINI…
117 $stmt = $db->query('SELECT f(VERSION()) AS f_version');
125 $stmt = $db->query('SELECT VERSION() AS _version');
137 exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0);
144 $db->errorCode(), implode(' ', $db->errorInfo()));
151 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
154 …$tmp = @$db->exec(sprintf('DROP TABLE IF EXISTS test; CREATE TABLE test(id INT) ENGINE=%s', PDO_MY…
159 $db->errorCode(), var_export($db->errorInfo(), true));
162 $tmp = @$db->exec('INSERT INTO test(id) VALUES (1); INSERT INTO test(id) VALUES (2)');
169 $db->errorCode(), implode(' ', $db->errorInfo()));
171 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
178 $db = MySQLPDOTest::factory();
179 @$db->exec('DROP TABLE IF EXISTS test');