ID: 38178
Updated by: [EMAIL PROTECTED]
Reported By: gerald at copix dot org
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Windows
PHP Version: 5.1.4
Assigned To: wez
Previous Comments:
------------------------------------------------------------------------
[2006-08-21 08:01:25] gerald at copix dot org
@ iliaa > I'm using MySQL driver.
------------------------------------------------------------------------
[2006-08-10 19:59:56] bugs at mytrashmail dot com
Problem verified on SunOS 5.8 using PHP 5.1.2 und MySQL 4.1.5-gamma for
prepared select queries to be executed. Used Driver: MySQL for PDO in
the original version for PHP 5.1.2.
Workaround: Last char in query must be semicolon.
Greetings.
------------------------------------------------------------------------
[2006-08-09 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-08-01 14:07:27] [EMAIL PROTECTED]
What database driver are you using?
------------------------------------------------------------------------
[2006-07-21 16:08:00] gerald at copix dot org
Description:
------------
Using PDO, a simple insert query does not work with "prepare / execute"
but works fine using "exec"
This exact query does work correctly if I remove the text '\r\n' at its
end.
The query is :
'INSERT INTO myTable VALUES (\'xml:lang="fr" lang="fr">\r\n\')'
It may be related to the following bugs :
#36923 & #37646
Reproduce code:
---------------
//FOLLOWING DOES NOT WORK
$stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr"
lang="fr">\r\n\')');
if (! $stmt->execute ()){
print_r ($stmt->errorInfo ());//contains Array ( [0] => HY093 )
}
//FOLLOWING CODE IS OK (using exec)
if (! $pdo->exec ('INSERT INTO myTable VALUES (\'xml:lang="fr"
lang="fr">\r\n\')')){
print_r ($pdo->errorInfo ());
}
//FOLLOWING CODE IS OK (removed \r\n at the end of the query)
$stmt = $pdo->prepare ('INSERT INTO myTable VALUES (\'xml:lang="fr"
lang="fr">\')');
$stmt->execute ();//OK
Expected result:
----------------
PDO should insert the value 'xml:lang="fr" lang="fr">\r\n' in the
myTable table, wish is
CREATE TABLE `myTable` (
`test` VARCHAR( 255 ) NOT NULL
)
Actual result:
--------------
Warning: PDOStatement::execute() [function.PDOStatement-execute]:
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in
C:\Program Files\wamp\www\test_3\www\index.php on line 40
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38178&edit=1