--TEST-- PDO::MYSQL_ATTR_MULTI_STATEMENTS --SKIPIF-- --INI-- error_reporting=E_ALL --FILE-- exec(sprintf('DROP TABLE IF EXISTS %s', $table)); $create = sprintf('CREATE TABLE %s(id INT)', $table); $db->exec($create); $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table)); $stmt->closeCursor(); $info = $db->errorInfo(); var_dump($info[0]); $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); // A single query with a trailing delimiter. $stmt = $db->query('SELECT 1 AS value;'); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); // New connection, does not allow multiple statements. $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false)); $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table)); var_dump($stmt); $info = $db->errorInfo(); var_dump($info[0]); $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); // A single query with a trailing delimiter. $stmt = $db->query('SELECT 1 AS value;'); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); print "done!"; ?> --EXPECT-- string(5) "00000" array(2) { [0]=> array(1) { ["id"]=> string(1) "1" } [1]=> array(1) { ["id"]=> string(1) "2" } } array(1) { [0]=> array(1) { ["value"]=> string(1) "1" } } bool(false) string(5) "42000" array(2) { [0]=> array(1) { ["id"]=> string(1) "1" } [1]=> array(1) { ["id"]=> string(1) "2" } } array(1) { [0]=> array(1) { ["value"]=> string(1) "1" } } done!