ID: 35607
User updated by: wseibert at hxcorp dot com
Reported By: wseibert at hxcorp dot com
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Windows 2k
PHP Version: 5CVS-2005-12-08 (snap)
Assigned To: wez
New Comment:
I think i found some more info out.
It seems to have a problem with the aliases of the tables.
This will work:
UPDATE tbl1 SET id=10 WHERE 1=1
This will crash:
UPDATE tbl1 SET tbl1.id=10 WHERE 1=1
Both are valid SQL statements...
I'm not sure if this is caused in one of the ext in PHP (PDO_odbc?) or
where it's crashing from...
Can we get some error catching in PHP5 for this?
Previous Comments:
------------------------------------------------------------------------
[2005-12-09 08:06:45] YOY at YOY dot YOY
I made some tests with this table
Table name: tbl1
Cloumns: id INTEGER
this code work ok:
-----------------------
try {
$sql='UPDATE tbl1 SET tbl1.id=10'
$results = $dbh->query($sql);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
This code will crash the server: (WHERE 1=1)
-----------------------------------
try {
$sql='UPDATE tbl1 SET tbl1.id=10 WHERE 1=1'
$results = $dbh->query($sql);
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
----------------------------
I try some bad SQL syntax ("Us543PDATE tbl1 SET tbl1.id=10"), same
result server crash.
this statment :
UPDATE tbl1 SET tbl1.id=5 WHERE tbl1.id=10
after some test surprisly this statment work, but again after some more
test again this stament produce crash.
hope this information be helpful.
------------------------------------------------------------------------
[2005-12-09 05:24:37] [EMAIL PROTECTED]
Can you provide a CREATE TABLE statement or a small copy of your actual
.mdb file, so that I can test against the same schema you're using?
------------------------------------------------------------------------
[2005-12-08 21:34:46] [EMAIL PROTECTED]
Assigned to the maintainer.
------------------------------------------------------------------------
[2005-12-08 21:12:16] wseibert at hxcorp dot com
Sorry, I know this is going to be difficult to duplicate as I'm
connecting to a Access DB on my local machine via ODBC. If you have a
Access DB on your system, you just need to set it up in your ODBC
Manager and point to that DSN in the script. Once that is done, try
doing a Update SQL command via PDO::query, Then try it via PDO::exec.
If it works (correctly), it should return the number of rows affected.
It crashes for me on the query, and does nothing on the exec.
------------------------------------------------------------------------
[2005-12-08 21:07:57] wseibert at hxcorp dot com
<?php
try
{
$dbh = new PDO('odbc:DSN=TEST;driver=Driver do Microsoft Access
(*.mdb)','','');
$results = $dbh->query('UPDATE xd17 SET xd17.CCDate = 20051207,
xd17.CCTime = 1200, xd17.ModifiedDS = 200512071200 WHERE xd17.XTyp17 =
157 AND xd17.X15A = 51921 AND xd157.X105B = 3300');
} catch (PDOException $e) {
print "Error!: ".$e->getMessage()."<br/>";
die();
}
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35607
--
Edit this bug report at http://bugs.php.net/?id=35607&edit=1