Lines Matching refs:db

13 …function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternat…
15 $db->exec('DROP TABLE IF EXISTS test');
17 @$db->exec($sql);
18 if ($db->errorCode() != 0) {
23 $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
30 $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
31 $stmt = $db->query('SELECT id, label FROM test');
70 $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
71 $stmt = $db->query('SELECT id, label FROM test');
86 $db = MySQLPDOTest::factory();
87 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
88 $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
89 $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
92 test_type($db, 20, 'BIT(8)', 1);
96 test_type($db, 30, 'TINYINT', -127, ($is_mysqlnd) ? -127: '-127');
97 test_type($db, 40, 'TINYINT UNSIGNED', 255, ($is_mysqlnd) ? 255 : '255');
98 test_type($db, 50, 'BOOLEAN', 1, ($is_mysqlnd) ? 1 : '1');
100 test_type($db, 60, 'SMALLINT', -32768, ($is_mysqlnd) ? -32768 : '-32768');
101 test_type($db, 70, 'SMALLINT UNSIGNED', 65535, ($is_mysqlnd) ? 65535 : '65535');
103 test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608');
104 test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215');
106 test_type($db, 100, 'INT', -2147483648,
110 …test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 :…
113 test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1');
115 test_type($db, 130, 'BIGINT', '-9223372036854775808', NULL, '/^\-9[\.]*22/');
116 test_type($db, 140, 'BIGINT UNSIGNED', '18446744073709551615', NULL, '/^1[\.]*844/');
118 test_type($db, 150, 'REAL', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
119 test_type($db, 160, 'REAL UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
121 test_type($db, 170, 'DOUBLE', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
122 test_type($db, 180, 'DOUBLE UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
124 test_type($db, 210, 'FLOAT', -1.01, NULL, '/^\-1.0\d+/');
125 test_type($db, 220, 'FLOAT UNSIGNED', 1.01, NULL, '/^1.0\d+/');
127 test_type($db, 250, 'DECIMAL', -1.01, '-1');
128 test_type($db, 260, 'DECIMAL UNSIGNED', 1.01, '1');
131 test_type($db, 290, 'NUMERIC', -1.01, '-1');
132 test_type($db, 300, 'NUMERIC UNSIGNED', 1.01, '1');
134 test_type($db, 330, 'DATE', '2008-04-23');
135 test_type($db, 340, 'TIME', '14:37:00');
136 test_type($db, 350, 'TIMESTAMP', '2008-05-06 21:09:00');
137 test_type($db, 360, 'DATETIME', '2008-03-23 14:38:00');
138 test_type($db, 370, 'YEAR', 2008, ($is_mysqlnd) ? 2008 : '2008');
140 test_type($db, 380, 'CHAR(1)', 'a');
141 test_type($db, 390, 'CHAR(10)', '0123456789');
142 test_type($db, 400, 'CHAR(255)', str_repeat('z', 255));
143 test_type($db, 410, 'VARCHAR(1)', 'a');
144 test_type($db, 420, 'VARCHAR(10)', '0123456789');
145 test_type($db, 430, 'VARCHAR(255)', str_repeat('z', 255));
147 test_type($db, 440, 'BINARY(1)', str_repeat('a', 1));
148 test_type($db, 450, 'BINARY(255)', str_repeat('b', 255));
149 test_type($db, 460, 'VARBINARY(1)', str_repeat('a', 1));
150 test_type($db, 470, 'VARBINARY(255)', str_repeat('b', 255));
152 test_type($db, 480, 'TINYBLOB', str_repeat('b', 255));
153 test_type($db, 490, 'BLOB', str_repeat('b', 256));
154 test_type($db, 500, 'MEDIUMBLOB', str_repeat('b', 256));
155 test_type($db, 510, 'LONGBLOB', str_repeat('b', 256));
157 test_type($db, 520, 'TINYTEXT', str_repeat('b', 255));
158 test_type($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255));
160 test_type($db, 560, 'TEXT', str_repeat('b', 256));
161 test_type($db, 570, 'TEXT BINARY', str_repeat('b', 256));
163 test_type($db, 580, 'MEDIUMTEXT', str_repeat('b', 256));
164 test_type($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256));
166 test_type($db, 600, 'LONGTEXT', str_repeat('b', 256));
167 test_type($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256));
169 test_type($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no');
170 test_type($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no');
172 test_type($db, 640, 'DECIMAL(3,2)', -1.01, '-1.01');
180 $db = MySQLPDOTest::factory();
181 $db->exec('DROP TABLE IF EXISTS test');