Odd ODBC datatype behavior -- integers returned with wrong precision/scale

From: Date: Fri, 01 Dec 2000 14:58:21 +0000
Subject: Odd ODBC datatype behavior -- integers returned with wrong precision/scale
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4932@lists.php.net to get a copy of this message
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

« previous php.db (#4932) next »