[Dbix-class] Escaping placeholders
Tim Bunce
Tim.Bunce at pobox.com
Sun Dec 21 13:23:09 GMT 2014
On Sat, Dec 20, 2014 at 02:23:43PM -0800, Jonathan Leffler wrote:
>
> INSERT INTO SomeTable(DateTimeCol)
> VALUES(DATETIME[1](2014-12-31 23\:59\:59) YEAR TO SECOND);
>
> I really won't want people have to futz with their legitimate Informix SQL in order to pass it through
> DBD::Informix.
>
> Whatever is provided, whether by DBI or DBD::Informix, must accept the code without the
> backslashes in front of the colons. It is simply not acceptable to have to modify valid SQL to get it
> past the gatekeeper code.
Understood. I wouldn't expect DBD::Informix to enable this by default.
We were only discussing a hypothetical situation where DBD::Informix
could optionally enable use of colon placeholders, if desired.
> At the moment, the unescaped code works fine. It will continue to work fine. As long as DBI does not
> break the currently working code, I will survive â" like I have for the last decade and more. Just
> make sure that whatever you do does not break working valid Informix SQL code.
I have absolutely no intention of breaking anything :)
It'll be up to the individual driver authors to add support for escaping
placeholders, if they want to.
(The DBI has a built-in preparse function that's intended for parsing
placeholders but few, if any, drivers use it. I know DBD::Informix doesn't.)
Tim.
> On Sat, Dec 20, 2014 at 2:17 PM, Tim Bunce <[2]Tim.Bunce at pobox.com> wrote:
>
> On Sat, Dec 20, 2014 at 01:14:29PM -0800, Jonathan Leffler wrote:
> > Many, many years ago, DBD::Informix had to give up on the DBI-provided parsing for placeholders
> because
> > there were too many contexts in which it was wrong for Informix. It may have improved since
> then, but:
> >
> > INSERT INTO SomeTable(DateTimeCol)
> > VALUES(DATETIME(2014-12-31 23:59:59) YEAR TO SECOND);
>
> > I think I raised this as an issue back in the 1996-1998 timeframe (I said 'many years ago' and
> meant
> > it). I'd have to dig through my release notes to be more precise. Informix only supports
> natively the
> > `?` placeholders. It doesn't yet have the complexities introduced by the PostgreSQL operators.
> >
> > I don't know whether this can be handled at all. It may be that DBD::Informix has to stay out in
> > isolation but it would be nice if it wasn't necessary.
>
> The `?` placeholders are 'standard' (for some definition) so DBD::Informix
> isn't really 'in isolation'. There are quite a few drivers that only
> support `?` placeholders.
>
> In theory, if this proposal goes ahead, and is applied to `:` placeholders
> as seems likely, then you'd be able to write the above as:
> INSERT INTO SomeTable(DateTimeCol)
> VALUES(DATETIME[3](2014-12-31 23\:59\:59) YEAR TO SECOND);
>
> Tim.
>
> --
> Jonathan Leffler <[4]jonathan.leffler at gmail.com> #include <disclaimer.h>
> Guardian of DBD::Informix - v2013.0521 - [5]http://dbi.perl.org
> "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."
>
> References
>
> Visible links
> 1. file:///tmp/tel:%282014-12-31%2023
> 2. mailto:Tim.Bunce at pobox.com
> 3. file:///tmp/tel:%282014-12-31%2023
> 4. mailto:jonathan.leffler at gmail.com
> 5. http://dbi.perl.org/
More information about the DBIx-Class
mailing list