Lines Matching refs:PDO
2 MySQL PDO->__construct(), options
20 $db = new PDO($dsn, $user, $pass, array($option => $value));
41 PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT',
42 PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT',
44 /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/
45 PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT',
46 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
48 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY',
49 PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE',
50 PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
52 PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
53 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
57 PDO::ATTR_PERSISTENT => false,
58 PDO::ATTR_AUTOCOMMIT => 1,
60 PDO::ATTR_TIMEOUT => false,
61 PDO::ATTR_EMULATE_PREPARES => 1,
62 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
64 PDO::MYSQL_ATTR_LOCAL_INFILE => false,
66 PDO::MYSQL_ATTR_DIRECT_QUERY => 1,
67 PDO::MYSQL_ATTR_INIT_COMMAND => '',
70 if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type')))
73 if (!is_object($db = new PDO($dsn, $user, $pass, array())))
79 if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
82 $db = new PDO($dsn, $user, $pass);
92 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true));
93 if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT))
96 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false));
97 if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
101 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10))))
104 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX))))
107 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX))))
110 /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */
111 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true));
114 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
116 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
117 printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
118 … and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
120 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false));
123 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
125 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
126 printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
127 …and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
129 // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY
131 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT…
132 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
133 printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n");
134 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
135 printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
137 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIREC…
138 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
139 printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n");
140 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
141 printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
143 …set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
144 …set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
146 set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
147 set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
149 …set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND');
150 set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND');
151 …set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1…
153 set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
154 set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
167 [003a] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() repo…
168 [015] PDO::ATTR_EMULATE_PREPARES should be on
169 [016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on
170 [017] PDO::ATTR_EMULATE_PREPARES should be off
171 [018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off
172 [021] Execting '1'/boolean got ''/boolean' for options 'PDO::MYSQL_ATTR_LOCAL_INFILE'
173 [023] Execting 'SET @a=1'/string got ''/boolean' for options 'PDO::MYSQL_ATTR_INIT_COMMAND'