#50151 [Opn]: ODBC UPDATE query fails when using certain dates
ID: 50151 User updated by: chris at grcmc dot org Reported By: chris at grcmc dot org Status: Open Bug Type: ODBC related Operating System: Windows XP SP3 PHP Version: 5.3.0 New Comment: I forgot to mention, the "black date" range is from 8/22/2010 to 1/30/2011. Any date outside this range works, any date within the range fails. Previous Comments: [2009-11-11 15:53:59] chris at grcmc dot org Description: When performing an UPDATE statement using odbc_exec, connected to an Access 97 MDB database, queries fail when using a date between 8/22/2010 and 1/30/2011. Access database is confirmed to NOT have any filters or restrictions placed on the field in question, and the same SQL statement properly executes when entered directly into Access query builder. When this error occurs, it causes all subsequent UPDATE statements to fail, even if they do not contain one of the "black dates". SELECT statements placed before and after a failed query continue to function properly. Using Apache 2.2.11 (Win32). Original code used the MDB via a network path, but I have isolated the related code and tested with a local MDB with the same results. Config line --- cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" Reproduce code: --- $cn = odbc_connect('Driver={Microsoft Access Driver (*.mdb)}; DBQ=Access97Database.mdb','',''); // query will work, returns 1/1/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // statement will work odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/21/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will work, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // statement will fail with error odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/22/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will succed, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // same as first update statement, but will fail with same error as previous odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/21/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will work, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); Expected result: Expected behavior is successful execution of the query. As is demonstrated in the reproduction code, nothing changes between a query that will work and a query that will fail save the date. Actual result: -- The actual result is as described in bug report, and the error received is as follows: --- Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Cannot open database '|'. It may not be a database that your application recognizes, or the file may be corrupt., SQL state S1000 in SQLExecDirect in C:\wamp\www\automation\odbc_bug.php on line 16 --- Line 16 is the UPDATE statement containing 8/22/2010. -- Edit this bug report at http://bugs.php.net/?id=50151&edit=1
#50151 [NEW]: ODBC UPDATE query fails when using certain dates
From: chris at grcmc dot org Operating system: Windows XP SP3 PHP version: 5.3.0 PHP Bug Type: ODBC related Bug description: ODBC UPDATE query fails when using certain dates Description: When performing an UPDATE statement using odbc_exec, connected to an Access 97 MDB database, queries fail when using a date between 8/22/2010 and 1/30/2011. Access database is confirmed to NOT have any filters or restrictions placed on the field in question, and the same SQL statement properly executes when entered directly into Access query builder. When this error occurs, it causes all subsequent UPDATE statements to fail, even if they do not contain one of the "black dates". SELECT statements placed before and after a failed query continue to function properly. Using Apache 2.2.11 (Win32). Original code used the MDB via a network path, but I have isolated the related code and tested with a local MDB with the same results. Config line --- cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" Reproduce code: --- $cn = odbc_connect('Driver={Microsoft Access Driver (*.mdb)}; DBQ=Access97Database.mdb','',''); // query will work, returns 1/1/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // statement will work odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/21/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will work, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // statement will fail with error odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/22/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will succed, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); // same as first update statement, but will fail with same error as previous odbc_exec($cn, "UPDATE tblPerson SET ExpireDate = #8/21/2010# WHERE ID = 12431"); print odbc_errormsg(); // query will work, returns 8/21/2010 $query_obj = odbc_exec($cn, "SELECT ExpireDate FROM tblPerson WHERE ID = 12431"); print_r(odbc_fetch_array($query_obj)); Expected result: Expected behavior is successful execution of the query. As is demonstrated in the reproduction code, nothing changes between a query that will work and a query that will fail save the date. Actual result: -- The actual result is as described in bug report, and the error received is as follows: --- Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Cannot open database '|'. It may not be a database that your application recognizes, or the file may be corrupt., SQL state S1000 in SQLExecDirect in C:\wamp\www\automation\odbc_bug.php on line 16 --- Line 16 is the UPDATE statement containing 8/22/2010. -- Edit bug report at http://bugs.php.net/?id=50151&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50151&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50151&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50151&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50151&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50151&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50151&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50151&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50151&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50151&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50151&r=support Expected behavior: http://bugs.php.net/fix.php?id=50151&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50151&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50151&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50151&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50151&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50151&r=dst IIS Stabil