On Wed, Jan 09, 2002 at 09:57:27AM +0000, Simon Oliver wrote:
> Jonathan Leffler wrote:
> > 
> > Hmmmm, basically, I see what's going on.  Informix only supports
> > delimited identifiers if the environment variable DELIMIDENT is set when
> > the connection is initiated, which will make this very difficult to
> > handle.  In the absence of DELIMIDENT, Informix allows both single
> > quotes and double quotes to identify strings (an issue predating the SQL
> > standards on the subject).  So, although the method outlined by Tim is
> > correct, it won't work usefully unless DELIMIDENT is set, and DELIMIDENT
> > needs to be set prior to making the connection so it can't be handled
> > when the quote_identifier method is called.  So, it would be useful if
> > there was a connection time attribute that could be set indicating that
> > delimited identifiers will be used -- if that's available, DBD::Informix
> > can set DELIMIDENT before creating the connection and then all will be
> > fine.  Without that, Informix won't be able to do much -- you'll simply
> > get (at best) syntax errors and (at worst) misunderstood SQL.
>
> This was my original intention (look back through the archives and you'll see
> a big discussion with Tim on that subject).  Tim is not in favour of adding
> new attributes to the DBI class.  Instead, I suppose the Informix DBD will
> need to determine the value of DELIMIDENT (in the case of Informix) during
> connection and set an internal (to the DBD) attribute that the
> quote_identifier method can query.
> 
> Ideally there should be a method in the DBI spec to facilitate turning quoted
> identifiers on and off, or setting the delimitor(s), say
> "identifier_delimitor" for the sake of argument.  This method would be in the
> DBD.  Executing the method without any parameters would return the current
> value(s) (I make it plural because some DBMS's permit balanced delimitors like
> []).
> 
> Whether the DBD determines/sets this value on a per connection basis, when the
> identifier_delimitor method is called or each time quoted_identifiers is
> called would be up to the implementor of the DBD.

I'm not keen. I just don't see a need. The driver should know (or
be able to work out for itself) if it should be quoting identifiers
on any given connection. No application visible API is needed.

(A middle-road approach might be to have an option to quote_identifier
that says only quote the identifier if it needs it. If a database
don't support quoting identifiers then either quoting or not-quoting
an identifier that needs it will generate an error anyway.)

Tim.

Reply via email to