From 836e74ebee859f88338c1f13c245de162aa40c47 Mon Sep 17 00:00:00 2001 From: Hartmut Holzgraefe Date: Mon, 10 Jul 2006 14:06:13 +0000 Subject: [PATCH] MFH --- ext/pdo/tests/pdo_033.phpt | 39 +++++++++++++++++++++++++ ext/pdo_mysql/tests/last_insert_id.phpt | 35 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 ext/pdo/tests/pdo_033.phpt create mode 100644 ext/pdo_mysql/tests/last_insert_id.phpt diff --git a/ext/pdo/tests/pdo_033.phpt b/ext/pdo/tests/pdo_033.phpt new file mode 100644 index 0000000000..9739c0e0e3 --- /dev/null +++ b/ext/pdo/tests/pdo_033.phpt @@ -0,0 +1,39 @@ +--TEST-- +PDO Common: PDO::quote() +--SKIPIF-- + +--FILE-- +?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; + +$quoted = $db->quote($unquoted); + +$db->query("CREATE TABLE test (t char(100))"); +$db->query("INSERT INTO test (t) VALUES($quoted)"); + +$stmt = $db->prepare('SELECT * from test'); +$stmt->execute(); + +print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); + + +?> +--EXPECT-- +Array +( + [0] => Array + ( + [t] => !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ + ) + +) diff --git a/ext/pdo_mysql/tests/last_insert_id.phpt b/ext/pdo_mysql/tests/last_insert_id.phpt new file mode 100644 index 0000000000..d20f1a71af --- /dev/null +++ b/ext/pdo_mysql/tests/last_insert_id.phpt @@ -0,0 +1,35 @@ +--TEST-- +PDO MySQL auto_increment / last insert id +--SKIPIF-- + +--FILE-- +query("CREATE TABLE test (id int auto_increment primary key, num int)")); + +print_r($db->query("INSERT INTO test (id, num) VALUES (23, 42)")); + +print_r($db->query("INSERT INTO test (num) VALUES (451)")); + +print_r($db->lastInsertId()); +--EXPECT-- +PDOStatement Object +( + [queryString] => CREATE TABLE test (id int auto_increment primary key, num int) +) +PDOStatement Object +( + [queryString] => INSERT INTO test (id, num) VALUES (23, 42) +) +PDOStatement Object +( + [queryString] => INSERT INTO test (num) VALUES (451) +) +24 \ No newline at end of file -- 2.40.0