Tim Bunce wrote:
> 
> FYI, here's what I'm playing with at the moment:
> 
>     sub quote_identifier {
>         my $dbh = shift;
>         my @id  = grep { defined } @_;  # ignore null elements (ie catalog, schema)
>         s/"/""/g    foreach @id;        # escape embedded quotes
>         $_=qq{"$_"} foreach @id;        # quote the element
>         return join '.', @id;           # ... and join the dots
>     }
> 
> Any drivers that need different behaviour will need to define their
> own method to override this default.

Makes sense.  DBD coders should be *encouraged* to override this method if the
undelying DBMS is capable of changes to the quoting behaviour.  This would
include DBD::ODBC, DBD::ADO, DBD::Sybase, DBD::ASAny to name a few that I know
this applies to.  

As an example, if quoted identifiers is turned off as a database option then
then the DBD's overriding method should realise this and return a non-quoted
identifier.

And any method that returns an identifier should pass it through
$dbh->quote_identifier as matter of course.  Currently I think this only
applied to $dbh->tables, but I forsee the list growing with the inclusion of
AnyDBD interface, new metadata methods and SQL rewriting stuff.

Happy New Year

--
  Simon Oliver

Reply via email to