Re: DB/DB_oci8 question
| From: | Manuel Lemos | Date: | Sat, 01 Dec 2001 21:31:00 +0000 |
| Subject: | Re: DB/DB_oci8 question | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-568@lists.php.net to get a copy of this message | ||
Hello,
"Stig S. Bakken" wrote:
> > I'm using the PEAR-DB-Class (DB_oci8-backend)
> > to connect (now wonder - an Oracle 8i DB).
> > It works quite fine, but now I have one little prob...
> > all the values I get from the DB_Result->fetchRow(DB_FETCHMODE_ASSOC)
> > are strings! Is that an error in my code or is it a general problem?
> > I just want my integers and floats/doubles back ;-(
> >
> > Anyone?
>
> All the data returned by PHP's database functions are (AFAIK) returning
> strings. This is mainly because PHP's integer type is more limited than
> for example Oracle's numeric types.
>
> Fixing this raises a fundamental problem: PHP needs to have type
> information from your database. This can be done in several ways, but
> they all have their little or big gotchas, so we've chosen not to do it.
>
> So for now you have to tell your app what types you expect, and cast
> where necessary.
Yes, that is the way Metabase does it by having different function call
for fetching the same result column. The developer needs to hint
Metabase to do the correct data type conversion by calling the
corresponding function. This is why there are so many
MetabaseFetchResult* functions, one for each base data type that is
supported. This design was inspired on Java JDBC, as it also aims to
provide database application true portabilibility.
Regards,
Manuel Lemos