Lines Matching refs:PDO

2 MySQL PDO->__construct(), options
20 $db = new PDO($dsn, $user, $pass, array($option => $value));
21 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
42 PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT',
43 PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT',
45 /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/
46 PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT',
47 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
49 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY',
50 PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE',
51 PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
53 PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
54 PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
58 PDO::ATTR_PERSISTENT => false,
59 PDO::ATTR_AUTOCOMMIT => 1,
61 PDO::ATTR_TIMEOUT => false,
62 PDO::ATTR_EMULATE_PREPARES => 1,
63 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
65 PDO::MYSQL_ATTR_LOCAL_INFILE => false,
67 PDO::MYSQL_ATTR_DIRECT_QUERY => 1,
68 PDO::MYSQL_ATTR_INIT_COMMAND => '',
72 if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type')))
77 if (!is_object($db = new PDO($dsn, $user, $pass, array())))
81 if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
84 $db = new PDO($dsn, $user, $pass);
85 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
95 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true));
96 if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT))
99 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false));
100 if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
104 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10))))
107 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX))))
110 if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX))))
113 /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */
114 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true));
117 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
119 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
120 printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
121 … and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
123 $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false));
126 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
128 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
129 printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
130 …and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
132 // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY
134 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT…
135 if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
136 printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n");
137 if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
138 printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
140 …$db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIREC…
141 if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
142 printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n");
143 if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
144 printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
146 …set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
147 …set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUER…
149 … set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
150 … set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
152 …set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND');
153 set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND');
154 …set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1…
156 set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
157 set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
171 [003a] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() repo…
172 [015] PDO::ATTR_EMULATE_PREPARES should be on
173 [016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on
174 [017] PDO::ATTR_EMULATE_PREPARES should be off
175 [018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off
176 [023] Expecting 'SET @a=1'/string got ''/boolean' for options 'PDO::MYSQL_ATTR_INIT_COMMAND'