mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
f4a5db3e08
Co-authored-by: George Peter Banyard <girgias@php.net> Co-authored-by: Jorg Adam Sowa <jorg.sowa@gmail.com>
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
--TEST--
|
|
PDO Common: PDO::quote()
|
|
--EXTENSIONS--
|
|
pdo
|
|
--SKIPIF--
|
|
<?php
|
|
$dir = getenv('REDIR_TEST_DIR');
|
|
if (false == $dir) die('skip no driver');
|
|
if (!strncasecmp(getenv('PDOTEST_DSN'), 'odbc', strlen('odbc'))) die('skip odbc driver doesn\'t have escape API, use prepared statements');
|
|
require_once $dir . 'pdo_test.inc';
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
|
|
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
|
$db = PDOTest::factory();
|
|
|
|
$unquoted = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
|
|
|
|
$quoted = $db->quote($unquoted);
|
|
|
|
$len = strlen($unquoted);
|
|
|
|
$db->query("CREATE TABLE test033 (t char($len))");
|
|
$db->query("INSERT INTO test033 (t) VALUES($quoted)");
|
|
|
|
$stmt = $db->prepare('SELECT * from test033');
|
|
$stmt->execute();
|
|
|
|
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
|
|
?>
|
|
--CLEAN--
|
|
<?php
|
|
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
|
$db = PDOTest::factory();
|
|
PDOTest::dropTableIfExists($db, "test033");
|
|
?>
|
|
--EXPECT--
|
|
Array
|
|
(
|
|
[0] => Array
|
|
(
|
|
[t] => !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
|
)
|
|
|
|
)
|