php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50151 ODBC UPDATE query fails when using certain dates
Submitted: 2009-11-11 15:53 UTC Modified: 2020-09-27 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: chris at grcmc dot org Assigned: cmb (profile)
Status: No Feedback Package: ODBC related
PHP Version: 5.3.0 OS: Windows XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 25 = ?
Subscribe to this entry?

 
 [2009-11-11 15:53 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-11 15:56 UTC] chris at grcmc dot org
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.
 [2020-09-17 14:01 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-09-17 14:01 UTC] cmb@php.net
I cannot reproduce this with a current PHP 7.4 and the Microsoft
Access Driver (*.mdb, *accdb) version 14.00.7010.1000.  Does this
still fail for you with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2020-09-27 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC