Lines Matching refs:PDO
2 MySQL PDO->__construct(), options
21 $db = new PDO($dsn, $user, $pass, array($option => $value));
22 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
43 PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT',
44 PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT',
46 /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/
47 PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT',
48 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
50 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY',
51 PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE',
52 PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
54 PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
55 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
59 PDO::ATTR_PERSISTENT => false,
60 PDO::ATTR_AUTOCOMMIT => 1,
62 PDO::ATTR_TIMEOUT => false,
63 PDO::ATTR_EMULATE_PREPARES => 1,
64 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
66 PDO::MYSQL_ATTR_LOCAL_INFILE => false,
68 PDO::MYSQL_ATTR_DIRECT_QUERY => 1,
69 PDO::MYSQL_ATTR_INIT_COMMAND => '',
73 if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type')))
78 if (!is_object($db = new PDO($dsn, $user, $pass, array())))
82 if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
85 $db = new PDO($dsn, $user, $pass);
86 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
96 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true));
97 if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT))
100 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false));
101 if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
105 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10))))
108 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX))))
111 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX))))
114 /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */
115 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true));
118 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
120 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
121 printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
122 … and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
124 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false));
127 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
129 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
130 printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
131 …and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
133 // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY
135 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT…
136 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
137 printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n");
138 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
139 printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
141 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIREC…
142 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
143 printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n");
144 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
145 printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
147 …set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
148 …set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
150 … set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
151 … set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
153 …set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND');
154 set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND');
155 …set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1…
157 set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
158 set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
160 if (defined('PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY')) {
161 …set_option_and_check(35, PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY, null, 'PDO::MYSQL_ATTR_LOCAL_INFI…
163 …// set_option_and_check(36, PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY, __DIR__, 'PDO::MYSQL_ATTR_LOCA…
177 [003a] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() repo…
178 [015] PDO::ATTR_EMULATE_PREPARES should be on
179 [016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on
180 [017] PDO::ATTR_EMULATE_PREPARES should be off
181 [018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off
182 [023] Expecting 'SET @a=1'/string got ''/boolean' for options 'PDO::MYSQL_ATTR_INIT_COMMAND'