????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.191.167.79 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/pdo_mysql/tests/ |
Upload File : |
--TEST-- MySQL PDO->exec(), SELECT --SKIPIF-- <?php require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); MySQLPDOTest::skip(); ?> --FILE-- <?php function exec_and_count($offset, &$db, $sql, $exp) { try { $ret = $db->exec($sql); if ($ret !== $exp) { printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n", $offset, $exp, gettype($exp), $ret, gettype($ret), $sql, $db->errorCode(), implode(' ', $db->errorInfo())); return false; } } catch (PDOException $e) { printf("[%03d] '%s' has failed, [%s] %s\n", $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo())); return false; } return true; } require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); /* affected rows related */ try { exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0); exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0); exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1); // question is: will the result set be cleaned up, will it be possible to run more queries on the line? // buffered or unbuffered does not matter! $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); exec_and_count(5, $db, 'SELECT id FROM test', 0); exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1); } catch (PDOException $e) { printf("[001] %s, [%s] %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo())); } print "done!"; ?> --CLEAN-- <?php require dirname(__FILE__) . '/mysql_pdo_test.inc'; $db = MySQLPDOTest::factory(); @$db->exec('DROP TABLE IF EXISTS test'); ?> --EXPECTF-- Warning: PDO::exec(): SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in %s on line %d [006] Expecting '1'/integer got ''/boolean when running 'INSERT INTO test(id, col1) VALUES (2, 'b')', [HY000] HY000 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. done!