php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76531 Can't get dateTime field with Sybase 16 ODBC driver
Submitted: 2018-06-26 08:57 UTC Modified: 2021-08-05 09:40 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: t dot raab at sanitas dot at Assigned: cmb (profile)
Status: No Feedback Package: ODBC related
PHP Version: 7.2.7 OS: Windows 7
Private report: No CVE-ID: None
 [2018-06-26 08:57 UTC] t dot raab at sanitas dot at
Description:
------------
Dear All,

as Sybase support was dropped in PHP version 7, we are migrating our legacy application to connect to a SYBASE ASE database via ODBC. Our application is finally working quite well with ASE 15.5.

The problem is that sooner or later the database will be updated to Sybase ASE 16 and we found that retrieving any dateTime field with the newer Sybase 16 ODBC driver returns an empty string. 

We also found that connecting via pdo_odbc retrieves the dateTime fields correctly, so we believe the error lies in PHP's odbc module. Unfortunately switching to PDO is not an option, as it is not possible to retrieve the field data type via PDO.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-05 09:43 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-05 09:43 UTC] cmb@php.net
If this is still an issue with any of the actively supported PHP
versions[1], please update the PHP version info, provide a minimal
reproduce script and an ODBC trace of running that script.

[1] <https://www.php.net/supported-versions.php>
 [2020-10-18 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.
 [2021-08-05 06:01 UTC] max at e-i dot com dot ru
Hi, we are experiencing exactly the same problem on PHP 7.4 / RHEL.

$result = odbc_exec($conn, "select dateTimeField from aTable");
print_r(odbc_fetch_array($result));

always gets empty dateTimeField value. Everything's OK with PDO though, so we would agree on that's a PHP odbc module issue.
 [2021-08-05 09:40 UTC] cmb@php.net
Sorry, this is not actionable, unless you

| provide a minimal reproduce script and an ODBC trace of running
| that script.
 [2021-08-07 08:43 UTC] max at e-i dot com dot ru
OK, I think we got it, and looks like it is NOT a PHP's odbc module issue as we believed first too - sorry about that.

I'll leave what we found here in case someone else struggles with this issue. So, the difference between PHP's PDO and odbc_ functions subset is in their DEFAULT CURSOR settings. It's PDO::CURSOR_FWDONLY for PDO and SQL_CURSOR_STATIC for odbc_ ones. Set it to SQL_CURSOR_FORWARD_ONLY for odbc_ and you'll get exactly the same behavior as you have with PDO defaults: dateTimes are OK, but unable to scroll through the result in any direction, only way forward. The choice is yours now..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 00:01:29 2024 UTC