php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58082 Prepare error on sql with DATETIME construct
Submitted: 2008-03-05 09:29 UTC Modified: 2009-03-03 04:10 UTC
From: eromero at sitrack dot com Assigned:
Status: Closed Package: PDO_INFORMIX (PECL)
PHP Version: 5.2.1 OS: LINUX
Private report: No CVE-ID: None
 [2008-03-05 09:29 UTC] eromero at sitrack dot com
Description:
------------
I get an error when trying to execute an SQL with an DATETIME constructor:

select DATETIME (00:00) HOUR TO MINUTE from test

This equal SQL works perfectly on SQL EDITOR (informix).


Reproduce code:
---------------
<?php
try
{
print "connecting \n";
$db = new PDO($PDOTEST_DSN, $PDO_USER, $PDO_PASSWD);

}
catch (PDOException $e)
{
echo 'Error message: ' . $e->getMessage();
exit;
}
$db->exec("create table test (fechaid serial not null,fecha datetime year to second,text CHAR(50),primary key (fechaid))");
$db->exec("
insert into test VALUES (0,'2008-03-05 00:00:00','text one');
insert into test VALUES (0,'2008-03-05 00:00:10','text two');
insert into test VALUES (0,'2008-03-05 00:05:02','text three');");
$db->query("select DATETIME (00:00) HOUR TO MINUTE from test");
var_dump($db->errorinfo());
?>


Expected result:
----------------
connecting
array(3) {
  [0]=>
  string(5) "00000"
  [1]=>
  int(0)
  [2]=>
  string(24) " ((null)[0] at (null):0)"
}


Actual result:
--------------
connecting
array(3) {
  [0]=>
  string(5) "42000"
  [1]=>
  int(-201)
  [2]=>
  string(158) "[Informix][Informix ODBC Driver][Informix]A syntax error has occurred. (SQLPrepare[4294967095] at /tmp/pear/download/PDO_INFORMIX-1.1.0/informix_driver.c:131)"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-03 04:10 UTC] abhargav at in dot ibm dot com
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pecl.php.net/get/PDO_INFORMIX

Defect is fixed in 1.2.6 version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 08:01:27 2024 UTC