diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt')
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt new file mode 100644 index 0000000..89e6f38 --- /dev/null +++ b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt @@ -0,0 +1,48 @@ +--TEST-- +PDO::MYSQL_ATTR_INIT_COMMAND +--SKIPIF-- +<?php +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc'); +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); +MySQLPDOTest::skip(); +$db = MySQLPDOTest::factory(); +?> +--INI-- +error_reporting=E_ALL +--FILE-- +<?php + require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); + + $dsn = MySQLPDOTest::getDSN(); + $user = PDO_MYSQL_TEST_USER; + $pass = PDO_MYSQL_TEST_PASS; + + $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX))); + $db = new PDO($dsn, $user, $pass); + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + + $create = sprintf('CREATE TABLE %s(id INT)', $table); + var_dump($create); + $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => $create)); + + $info = $db->errorInfo(); + var_dump($info[0]); + + $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table)); + $stmt = $db->query(sprintf('SELECT id FROM %s', $table)); + var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); + + $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table)); + print "done!"; +?> +--EXPECTF-- +%unicode|string%(58) "CREATE TABLE test_%s(id INT)" +%unicode|string%(5) "00000" +array(1) { + [0]=> + array(1) { + [%u|b%"id"]=> + %unicode|string%(1) "1" + } +} +done! |