php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10369 Openlink4/ODBC odbc_field_type returns nothing
Submitted: 2001-04-17 20:12 UTC Modified: 2001-05-07 15:26 UTC
From: dardison at ardison dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.4pl1 OS: Linux 2.2.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dardison at ardison dot com
New email:
PHP Version: OS:

 

 [2001-04-17 20:12 UTC] dardison at ardison dot com
This script reproduces the problem:

<HTML>
<HEAD>
<TITLE>Test odbc_field_type</TITLE>
</HEAD>
<BODY bgcolor="#000000" text="#CCCCCC" link="#33CCFF" vlink="#996699" alink="#FF
FFFF" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<?php


putenv("LD_LIBRARY_PATH=/usr/local/openlink/odbcsdk/lib");
putenv("LIBPATH=/usr/local/openlink/odbcsdk/lib:$LIBPATH");
putenv("SHLIB_PATH=/usr/local/openlink/odbcsdk/lib:$SHLIB_PATH");
putenv("UDBCINI=/usr/local/openlink/bin/odbc.ini");
putenv("ODBCINSTINI=/usr/local/openlink/bin/odbcinst.ini");
putenv("ODBCINI=/usr/local/openlink/bin/odbc.ini");
$dsn="DSN=Arbant";
$user="dba";
$password="sql";
$sql='Select cod_emp, cod_amb, den from loguec';
if(($conn_id=odbc_connect("$dsn","",""))){
  if(($result=odbc_prepare($conn_id,$sql))){
    @odbc_execute($result);
    if(!empty($result)){
       $cols_count=odbc_num_fields($result);
       $ind=1;
       while($ind<=$cols_count){
         $cols_name[$ind]=odbc_field_name($result,$ind);
         $cols_types[$ind]=odbc_field_type($result,$ind);
         $ind++;
       }
       echo "<H1>Results</H1>";
       echo "<B>The Query is: $sql<B>\n";
       echo '<TABLE  align="center" border="1" bordercolor="green" cellpadding="
2" cellspacing="0">';
       $ind=1;
       echo "<tr><td><b>Names</b></td><td><b>Types</b></td></tr>";
       while($ind<=$cols_count){
         echo "<tr>";
         echo "<td>" . $cols_name[$ind] . "</td>\n";
         echo "<td>" . $cols_types[$ind] . "</td>\n";
         echo "</tr>";
         $ind++;
       }
       odbc_free_result($result);
    }else{
       echo "Cannot execute query";
    }
  }else{
    echo "Cannot prepare query";
  }
}
?>
</BODY></HTML>

I compiled PHP standard, I simply run ./configure with openlink option , run make and make install.
I can retrieve column name information and also data but I can't retrieve the column SQL Type. I asked Openlink and they said that is a PHP issue.

I'm using Openlink Multi-tier Driver for accessing a MS SQL Server 7 Database on a Windows NT box from PHP scripts running on the Apache Web Server on a Linux Box
OpenLink Version 4
PHP Version 4.0.4pl1
Linix SuSE 6.1 Kernel Version 2.2.7
Apache Version 1.3
PHP is running as a Loadable Apache Module

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-04 15:15 UTC] ahill@php.net
Firstly, please use --with-iodbc instead of --with-iodbc.
Also, this is most likely not a PHP issue but a database specific issue, and will only occur in cases where the corresponding database CLI call doesn't work natively.

Please test this with the latest OpenLink drivers and open a support case at http://www.openlinksw.com/support/suppindx.htm if the problem persists.


 [2001-05-07 15:26 UTC] ahill@php.net
Reproduced with the PHP script.
Also reproduced without PHP, using both OpenLink and the Native SQLServer driver.

This is a failure of the database layer to the SQLColAttribute (or SQLColAttributes) call.

SQLColAttributes:
				In:				hstmt = 0x008218D8, icol = 1, fDescType = SQL_COLUMN_TYPE=2, rgbDesc = 0x00154528, cbDescMax = 600, pcbDesc = 0x001552F0, 
										pfDesc = 0x00155E30, Description Type = SQL_C_SLONG=-16
				Return:	SQL_SUCCESS=0
				Out:			*rgbDesc = <unmodified>, *pcbDesc = 4, *pfDesc = 4
				TST1001: Buffer rgbDesc was not updated.

Best regards,
Andrew

 [2004-07-08 17:26 UTC] jfleost at intertek dot fr
Hi

I have the same problem using "odbc_field_type" with PHP 4.3.7,  unixODBC 2.2.7 and freeTDS 0.61

The function "odbc_field_type" give me as type something like : X??p	??h?fL@p	??H?25????J@X?X@?Q@???Q@
No,no, it's not a problem of pagecode on this website !! ;-)

Someone has an idea ?

Jeff
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 10:01:28 2025 UTC