Re: Re: oracle question
| From: | Justin Patrin | Date: | Mon, 03 Jan 2005 19:38:52 +0000 |
| Subject: | Re: Re: oracle question | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35320@lists.php.net to get a copy of this message | ||
On Mon, 03 Jan 2005 17:14:13 -0200, Manuel Lemos <mlemos@acm.org> wrote:
> 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.
Not if the NLS_DATE_FORMAT is set correctly. A string in that format
should be read just fine as a date.
>
> 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.
>
--
Justin Patrin