[phplib] [PHP-DB] Odd ODBC datatype behavior -- integers returned with wrong precision/scale From: Pascal Jolin (pjolin <email protected>)
Date: 12/01/00

I have PHP 4.0.3pl1 installed on Apache and compiled
with --with-esoob (Easysoft ODBC-ODBC Bridge).

The ESOOB library installed is version 1.0.0.23.

The server component of the ODBC-ODBC Bridge is
installed on a Windows 2000 Advanced Server running
MS SQL 2000 Entreprise.

Given the following table:

table Users {
    idUser int identity(1,1) NOT NULL,
    (various other fields)
    }

Tle following query (ran thru the db_odbc part of phplib):
$Login->query("SELECT * FROM Users WHERE idUser = 1");
$Login->next_record();
$idU = $Login->f("idUser");
echo "idUser: $idU <br>";

will echo:

idUser: 1.00

Where does the ".00" comes from?
It causes endless problems in the rest of my application of course,
mostly from subsequent queries that won't accept a numeric(x,2)
as a valid argument.

Any clue on how to make ODBC return the proper datatype?

Of course I could cast $idU = (int)$Login->f("idUser") but it seems
wrong to have to cast every field coming out of the database in
case the ODBC query returns a wrong datatype!

Pascal Jolin

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>