Bug #10369: Openlink4/ODBC odbc_field_type returns nothing
| From: | dardison at ardison dot com | Date: | Wed, 18 Apr 2001 00:12:15 +0000 |
| Subject: | Bug #10369: Openlink4/ODBC odbc_field_type returns nothing | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51847@lists.php.net to get a copy of this message | ||
From: dardison@ardison.com
Operating system: Linux 2.2.7
PHP version: 4.0.4pl1
PHP Bug Type: ODBC related
Bug description: Openlink4/ODBC odbc_field_type returns nothing
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
--
Edit Bug report at: http://bugs.php.net/?id=10369&edit=1