php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38894 VARBINARY column fails
Submitted: 2006-09-20 08:59 UTC Modified: 2020-09-25 12:51 UTC
Votes:5
Avg. Score:3.8 ± 1.6
Reproduced:3 of 4 (75.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: m dot karoly at martondesign dot com Assigned: cmb (profile)
Status: Closed Package: ODBC related
PHP Version: 5.2.5 OS: winxpprof
Private report: No CVE-ID: None
 [2006-09-20 08:59 UTC] m dot karoly at martondesign dot com
Description:
------------
The code i commented well, see below.

Short description:
When i try to make a SELECT, and get the rows, the odbc_fetch_rows, odbc_fetch_array, odbc_result_all returns FALSE.
The connection works, the schema, table, columnnames i can receive in php.

Platforms i tested:
Php 4.4.4 + Velocis (2.1) = Everythings work
Php 5.1.6 + Velocis (2.1) = Not working
Php 4.4.4 + Birdstep (6.0) = Not working
Php 5.1.6 + Birdstep (6.0) = Not working
Php 5.2.x-dev + Birdstep (6.0) = Not working

Reproduce code:
---------------
<?php

$conn = odbc_connect("RDS","username","password", SQL_CUR_USE_ODBC ); // When i connect to the dsn, everything is ok. (returns with a resource id)

$odbc_result = odbc_columns($conn); // When make a query to get the "schema.table name.column name". (returns with a resource id)
while (odbc_fetch_row($result)){ // in this case the odbc_fetch_row is working, but if i pass a odbc_exec return value as a parameter, it won't
   echo"<br>".odbc_result($result,"TABLE_SCHEM").'.'.odbc_result($result,"TABLE_NAME").".".odbc_result($result,"COLUMN_NAME");
}

$odbc_result = odbc_exec($conn, "SELECT * FROM schema.table"); // When i make a query, it seems to be ok too. (returns with a resource id)

odbc_result_all($odbc_result); // but -as i mentioned above - if i fetch the result of an odbc_exec (or odbc_do) query, it returns with FALSE
// doesn't matter what fetch function i call, none of them returns data (odbc_fetch_array, odbc_fetch_row, odbc_result_all...)

?>

Expected result:
----------------
odbc_fetch_array: returns array
odbc_fetch_row: returns string
odbc_result_all: returns html table


Actual result:
--------------
odbc_fetch_array: returns false
odbc_fetch_row: returns false
odbc_result_all: returns false

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-08 07:37 UTC] m dot karoly at martondesign dot com
With PDO extension i can fetch the right data!
odbc functions not working yet.
 [2007-12-11 19:41 UTC] m dot karoly at martondesign dot com
<?php
$conn = new PDO('odbc:RDS', 'user', 'pass');
$qp = $conn->prepare("select de_noteblob from user where rowid = 8598");
$qp->execute();
$results_array = $qp->fetchAll(PDO::FETCH_ASSOC);
var_dump($results_array);
?>

Expected: Lists an array: de_noteblob is a text
de_noteblob = string(24) "Test string, test string"


Actually results: Memory pieces with the exact length.
de_noteblob = string(24) "????yx>><?php sd|rw4r45"
 [2016-06-20 16:29 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-06-20 16:29 UTC] cmb@php.net
Is that still an issue with recent PHP versions? There have been
made quite some improvements to ODBC not too long ago.
 [2016-07-03 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.
 [2017-12-10 11:39 UTC] tyler dot parcher at swe dot org
Experiencing the same issue.  I get all the info about the table selected including number of rows in the result which changes depending on my select as expected.  "Fetch row" and its variants return null.  	Windows NT DESKTOP-JLC2DE1 10.0 build 15063 (Windows 10) AMD64 PHP Version 7.1.11  PDO support enabled 4.1.4.9021
 [2017-12-10 12:32 UTC] cmb@php.net
-Status: No Feedback +Status: Re-Opened -Assigned To: cmb +Assigned To:
 [2020-09-25 12:51 UTC] cmb@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-09-25 12:51 UTC] cmb@php.net
Birdstep support was unmaintained for years, and so is removed as
of PHP 7.3.0.  That would affect Velocis/RDM Server as well,
unless this ships standard conforming ODBC drivers in the
meantime.  As such, I consider this ticket to be obsolete.

Other than that, fetching VARBINARY data works fine for me (tested
with MS SQL Server and its ODBC driver), except for bug #80147
which has already been fixed (fix will ship with PHP 7.3.24 and
7.4.12).

@tyler dot parcher at swe dot org: if you are still experiencing
issues with fetching VARBINARY data with any of the actively
supported PHP versions[1], please open a new bug ticket, and
provide detailed information which could allow us to reproduce the
problem.

[1] <https://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 17:01:30 2024 UTC