Kbase P107293: SQLExecDirect ODBC error using odbc_fetch_object PHP function
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
FACT(s) (Environment):
RedHat Linux 8.0
Progress 9.1x
MERANT 4.10 32-BIT Progress SQL-92
SYMPTOM(s):
PHP connecting to a Progress Database via MERANT ODBC Driver
Attempting to execute odbc_fetch_object PHP function after refreshing the PHP page
The MERANT 4.10 ODBC driver generates error# 158
[unixODBC][DataDirect][ODBC 20101 driver]158, SQL state 9 in SQLExecDirect
Database is up and running in client/server mode (-S)
PHP program works fine using previous PHP versions
CHANGE:
Migrated to PHP 4.2.2
CAUSE:
PHP 4.2.2 does not implement odbc_fetch_object and driver connection object can not understand the request
FIX:
Create an odbc_fetch_object function as follow (example):
if (!function_exists(odbc_fetch_object)){
function odbc_fetch_object($res)
{
$rs = array();
$rs_obj = false;
if( odbc_fetch_into($res, &$rs) )
{
foreach( $rs as $key=>$value )
{
$fkey = odbc_field_name($res, $key+1);
$rs_obj->$fkey = trim($value);
}
}
return $rs_obj;
}
}