Reputation: 23
data from informix with PDO Informix are always returned as string, only NULL is returned as NULL.
I have tried playing with
$pdo_conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$pdo_conn->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
to no success. Also, when I try
$pdo_conn->getAttribute(PDO::ATTR_STRINGIFY_FETCHES);
I get PHP Fatal error: Uncaught PDOException: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute
I use
$prep = $pdo_conn->prepare($query);
$prep->execute();
$result = $prep->fetchAll(PDO::FETCH_ASSOC);
Anyone out there knows how to get my float as a float with pdo informix?
Thanks, Arie.
Upvotes: 2
Views: 360
Reputation: 2013
The Informix PDO driver returns everything as a PDO_PARAM_STR (except CLOBs which are returned as PDO_PARAM_LOB).
Same as the PDO_ODBC, for every column in the resulset, the driver uses SQL_C_CHAR for the internal SQLBindCol ODBC call.
The value of the ATTR_STRINGIFY_FETCHES attribute makes no difference as the returned data type is already a string. You can check the driver source code (around line 653):
https://github.com/php/pecl-database-pdo_informix/blob/master/informix_statement.c
Upvotes: 2