|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-16 00:37 UTC] felipe@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: felipe
[2017-10-24 07:08 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: felipe
+Assigned To:
[2020-10-06 16:11 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2020-10-06 16:11 UTC] cmb@php.net
[2020-10-18 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
Description: ------------ Platform and versions: PHP 5.2.13, built from source unixODBC 2.2.14, built from source ODBC support compiled-in Configure line: ./configure --prefix=/usr --with-libdir=lib64 --with-config-file-path=/etc/apache --sysconfdir=/etc --enable-force-cgi-redirect --with-regex=system --with-freetype-dir=/usr --with-openssl --with-zlib --with-curl --enable-ftp --with-pgsql --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --enable-dbase --enable-soap --with-gettext --enable-mbstring=all --enable-mbregex --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-ming --with-unixODBC=/usr/local/unixODBC Database servers: MySQL 5.0 Issue: Using odbc_columns() or odbc_columnprivileges() returns binary garbage in its fields. My guess, based on previous unixODBC-related bugs in other software (GDAL/OGR), is a integer range issue in unixODBC on 64-bit platforms. In the case of GDAL/OGR the developer noted that unixODCB was returning garbage as the first 4 bytes of a 8-byte integer; his fix was truncating and casting the values. Test script: --------------- <?php $dsn = sprintf("Driver=%s;Server=%s;Port=%d;Database=%s;", 'MySQL', 'db.hostgis.com', '3306', 'gregor'); $odbc = odbc_connect($dsn, 'gregor', 'mosheh', SQL_CUR_USE_ODBC ); if (!$odbc) die("Failed to connect\n"); // fetch all columns for the table "grid" // I know that these are id (integer, auto), title (varchar), latitude (float), and longitude (float) $columninfo = odbc_columns($odbc, '', '', 'grid', '%'); // fetch the column name and type for the columns // Note that there are 4 returns, which corresponds to 4 columns; but nothing is pritned while ($row = odbc_fetch_array($columninfo)) { print_r($row); print "<br/>\n"; } // do it again and print a table of the columns' info, and again see 4 rows // but note how theyre all identical binary garbage odbc_free_result($columninfo); $columninfo = odbc_columns($odbc, '', '', 'grid', '%'); odbc_result_all($columninfo); ?> Expected result: ---------------- It should report information about the 4 columns in the table, as described in odbc_columns() documentation. It should do this in 2 ways: a series of print_r() outputs and a HTML table. Actual result: -------------- For the first part, the series of print_r() statements, the appropriate number of rows (one per column) is printed, but they are all blank. For the second, the HTML table, the appropriate number of rows (one per column) is printed, but all information is binary garbage.