|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-04-10 05:32 UTC] edv at leha dot at
Description: ------------ We use ZendCore 2.0.0 with bundled apache2 pdo 1.0.3 (installed from PECL) pdo_informix 1.1.0 (installed from PECL) IBM Informix CSDK Version 2.90 UC1 on RHEL_FC4 32bit DBDATE is exported to Environment with the Apache Startup-Script (/usr/local/Zend/apache2/bin/envvars). Bug 1: ------ setting and exporting the environment var DBDATE="DMY4." in /usr/local/Zend/apache2/bin/envvars only works for insert,update statements - but not for selecting. It also works on Select with a character conversion date::char(10). Within selects the Date-Values are generally shown as YYYY-MM-DD. Bug 2: ------ Direct update/insert using exec with Date-Format as supplied by previous select doesn't work. Supplying the DMY4. format is working. Prepared update/insert using prepare/execute with Date-Format as supplied by previous works - but supplying the DMY4. format is not working. See example below.. Reproduce code: --------------- <? $pObj=new PDO("informix:host=devdb.leha.at;service=1525;database=stores_demo;server=devdb_net;"); echo "<pre>Environment (DBDATE):".getenv('DBDATE')."<br/><hr/>"; $pStmt=$pObj->prepare("select SHIP_DATE::char(10) as SHIP_DATE_As_Char,* from orders where customer_num=?"); $pStmt->execute(array(104)); $aAll=$pStmt->fetch(PDO::FETCH_ASSOC); print_r($aAll); /* # Test for same result with direct query $pStmt=$pObj->query("select * from orders where customer_num=104"); $aAll=$pStmt->fetch(PDO::FETCH_ASSOC); print_r($aAll); */ $cDate="18.12.2006"; $nRows=$pObj->exec("update orders set SHIP_DATE='$cDate' where ORDER_NUM=1001"); printf ("<hr/>Executing direct statement 1 with %s (Rows: %0d)<br/>",$cDate,$nRows); print_r($pObj->errorInfo()); $cDate="2006-12-19"; $nRows=$pObj->exec("update orders set SHIP_DATE='$cDate' where ORDER_NUM=1001"); printf ("<hr/>Executing direct statement 2 with %s (Rows: %0d)<br/>",$cDate,$nRows); print_r($pObj->errorInfo()); $pStmt2=$pObj->prepare("update orders set SHIP_DATE=? where ORDER_NUM=?"); $cDate="20.12.2006"; printf ("<hr/>Executing prepared statement 3 with %s<br/>",$cDate); if (! $pStmt2->execute(array($cDate,1001))) { print_r($pStmt2->errorInfo()); echo "Error-Code:".$pStmt2->errorCode."<br/>"; } $cDate="2006-12-21"; printf ("<hr/>Executing prepared statement 4 with %s<br/>",$cDate); $pStmt2->execute(array($cDate,1001)); if (! $pStmt2->execute(array($cDate,1001))) { print_r($pStmt2->errorInfo()); echo "Error-Code:".$pStmt2->errorCode."<br/>"; } $pStmt = null; $pObj = null; ?> Actual result: -------------- Environment (DBDATE):DMY4. Array ( [SHIP_DATE_AS_CHAR] => 21.12.2006 [ORDER_NUM] => 1001 [ORDER_DATE] => 1998-05-20 [CUSTOMER_NUM] => 104 [SHIP_INSTRUCT] => express [BACKLOG] => n [PO_NUM] => B77836 [SHIP_DATE] => 2006-12-21 [SHIP_WEIGHT] => 20.40 [SHIP_CHARGE] => 10.00 [PAID_DATE] => 1998-07-22 ) Executing direct statement 1 with 18.12.2006 (Rows: 1) Array ( [0] => 00000 [1] => 0 [2] => ((null)[0] at (null):0) ) Executing direct statement 2 with 2006-12-19 (Rows: 0) Array ( [0] => HY000 [1] => -1204 [2] => [Informix][Informix ODBC Driver][Informix]Invalid year in date (SQLExecDirect[-1204] at /usr/local/Zend/Core/share/PDO_INFORMIX-1.1.0/informix_driver.c:308) ) Executing prepared statement 3 with 20.12.2006 Array ( [0] => [1] => 0 [2] => (SQLExecute[0] at /usr/local/Zend/Core/share/PDO_INFORMIX-1.1.0/informix_statement.c:720) ) Error-Code: Executing prepared statement 4 with 2006-12-21 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 14:00:01 2025 UTC |
Expected Result (changes with preceeding *): -------------- Environment (DBDATE):DMY4. Array ( [SHIP_DATE_AS_CHAR] => 21.12.2006 [ORDER_NUM] => 1001 * [ORDER_DATE] => 20.05.1998 [CUSTOMER_NUM] => 104 [SHIP_INSTRUCT] => express [BACKLOG] => n [PO_NUM] => B77836 * [SHIP_DATE] => 21.12.2006 [SHIP_WEIGHT] => 20.40 [SHIP_CHARGE] => 10.00 * [PAID_DATE] => 22.07.1998 ) Executing direct statement 1 with 18.12.2006 (Rows: 1) Array ( [0] => 00000 [1] => 0 [2] => ((null)[0] at (null):0) ) Executing direct statement 2 with 2006-12-19 (Rows: 0) * Direct Statement 2 should not give an error Array ( [0] => 00000 [1] => 0 [2] => ((null)[0] at (null):0) ) Executing prepared statement 3 with 20.12.2006 * Prepared Statement 3 should not give an error Executing prepared statement 4 with 2006-12-21