By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,745 Members | 1,889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,745 IT Pros & Developers. It's quick & easy.

Oracle OCI8 returns everything as string

P: n/a
I've been evaluating the possibility of modifying an existing web app
with Oracle backend to use the OCI8 functions rather than ODBC. I was
attracted by some specific functionalities (specifying the DB charset on
connect, LOB handling...) and I also wanted to test whether there was
any performance improvement.

I've soon noticed that the OCI API returns numeric values as
locale-formatted strings; e.g., 3.14 becomes "3,14". According to docs
it's intentional.

My app depends on receiving decimal numbers as PHP floats because it has
to do maths with them and even when writing to page they need to be
properly formatted (I want "1.234,57", not "1234,567"). It seems that I
need to build my own abstraction layer and:

1. On every session, change the decimal separator to dot.
2. On every query, find out which fields are numeric.
3. On every row, cast numeric values to float.

This approach seems worse that using good old ODBC. My question is: Is
it possible to override this OCI "feature" and just get numbers as numbers?
-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor al baño María:
Sep 12 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.