|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-04-21 04:10 UTC] wez@php.net
[2006-04-21 14:17 UTC] gerwin84 at gmail dot com
[2006-04-30 01:27 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
Description: ------------ Using the latest PHP windows package (PHP 5.1.3-dev from 19 feb.) PDO throws an PDOException with message 'SQLSTATE[]: <<Unknown error>>: 0' when executing an SQL statement (UPDATE or DELETE) where the WHERE restriction matches zero records in an MSAccess database. The following ext. are loaded in php.ini: extension=php_pdo.dll extension=php_pdo_odbc.dll Using php-cgi.exe and IIS Reproduce code: --------------- /* Table 'test' description: field 'user' text(50) | field 'role' text(50) */ $situation = 1; //value can be 1 or 2 $DBPath = "d:\\webroot\\database\\pdobug.mdb"; $MSAccessDB = new PDO("odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=".$DBPath.";"); $MSAccessDB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $SQL1 = "INSERT INTO test VALUES( 'testuser','testrole');"; $SQL2 = "UPDATE test SET role='administrator' WHERE user='testuser' AND role='testrole';"; $SQL3 = "DELETE FROM test WHERE user='testuser';"; $MSAccessDB->exec($SQL1); switch($situation){ case 1: $MSAccessDB->exec($SQL2); //ok $MSAccessDB->exec($SQL2); //error break; case 2: $MSAccessDB->exec($SQL3); //ok $MSAccessDB->exec($SQL3); //error break; } Expected result: ---------------- a blank page as output and changes to the database log: - Always first a new row added. - In situation 1: the new row changed. - In situation 2: the new row deleted. Actual result: -------------- This is the error in in situation 1: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[]: <<Unknown error>>: 0 (SQLExecDirect[0] at ext\pdo_odbc\odbc_driver.c:230)' in D:\webroot\www\test\pdobug.php:20 Stack trace: #0 D:\webroot\www\test\pdobug.php(20): PDO->exec('UPDATE test SET...') #1 {main} thrown in D:\webroot\www\test\pdobug.php on line 20 The error in situation 2 is exacly the same, except line numbers etc. of course.