Re: oracle question

From: Date: Mon, 03 Jan 2005 19:14:13 +0000
Subject: Re: oracle question
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35319@lists.php.net to get a copy of this message
Hello, on 01/03/2005 02:04 PM Lukas Smith said the following:
I was just wondering if maybe some oracle expert can shed some light on
Try Thies.
this. I am trying to use native prepared support as much as possible in the oracle driver and I have encountered an issue with the way MDB2 is currently handling dates for oracle. Essentially all date values are wrapped in a TO_DATE() call. This has been directly taken from Metabase. I also set the following at connect: ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS' Now oracle doesnt like me using a function call for bound parameters. I may be able to get around this by sticking the actual value into the TO_DATE() call, but this gets messy as I would then have to replace the actual placeholder even if its already an oracle style ":foobar" placeholder. So the question is do I even need the TO_DATE() call if I see the NLS_DATE_FORMAT?
The TO_DATE is necessary so Oracle understands the expression as a date an not something else like a VARCHAR. Setting the NLS_DATE_FORMAT is need to make Oracle treat dates in that format by default.
The other issue I am currently running into is that it seems I probably have to parse all prepared queries and split them up anyways in order to get LOB support working, since there I need to replace the placeholders with EMPTY_BLOB()/EMPTY_CLOB().
I never used bound parameters with Oracle but I suspect that you need to pass the right arguments to oci_bind_by_name() so the data type that is exchanged always fits in the buffer and is treated a DATE, and not something else. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html

« previous php.pear.dev (#35319) next »