PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #4813

MS access error using timestamp in SQL-where clause

Details

Submitted2005-07-13 07:02 UTC
Fromgomar dot bijl at bu400 dot nl
Assigneddanielc
StatusClosed
PackageDB
PHP Version5.0.4
OSWin 2000
Roadmaps(Not assigned)

Comments

[2005-07-13 07:02 UTC] gomar dot bijl at bu400 dot nl

Description:
------------
using MS Access as DBMS. Connecting by pear-odbc.
For MS Access the SQL where clause need the sign # for timestamps. e.g. the SQL:"Update MNU_USER Set US_ACT = '1995-05-31 00:00:00' WHERE US_ACT <= #2000-01-01 00:00:00# ".

But when I persent the array of parameters to query ($DB->query( $SqlStmnt, $p_arrParams), pear makes a realquery with single quotes around the timestamp parameter. so the realquery is like: "Update MNU_USER Set US_ACT = '1995-05-31 00:00:00' WHERE US_ACT <= '#2000-01-01 00:00:00#' ".
This is the cause of the problem.
(notice that the Update set clause does not need a "#". Something odd of micro soft)

Reproduce code:
---------------
I think the solution is to change quoteSmart
The problem is in common.php
function &execute()
=> function executeEmulateQuery()
=> function quoteSmart($in)
Function quoteSmart should detect that the parameter $in starts and end with a # and should not quote the parameter.