[Dbix-class] Oracle Column Quoting

Jose Fonseca zefonseca at gmail.com
Wed Feb 13 20:25:01 GMT 2008


Steve, I don't know what Gmail did to my reply, everything above "Show
quoted text" was deleted. Sorry about that.

Original reply was:

Steve, SQL::Abstract does quote columns and tables for you. It's just that
quote_char is empty by default. To change it from DBIx::Class you probably
need to have a look at this section from
http://search.cpan.org/~ash/DBIx-Class-0.08008/lib/DBIx/Class/Storage/DBI.p=
m#txn_do
quote_char

Specifies what characters to use to quote table and column names. If you use
this you will want to specify
name_sep<http://search.cpan.org/perldoc?name_sep>as well.

quote_char expects either a single character, in which case is it is placed
on either side of the table/column, or an arrayref of length 2 in which case
the table/column name is placed between the elements.

For example under MySQL you'd use quote_char =3D> '`', and user SQL Server
you'd use quote_char =3D> [qw/[ ]/].
Hope that helps!
Cheers, Ze



On Feb 13, 2008 5:58 PM, Steve Kirkup <skirkup at jupiterimages.com> wrote:

> Howdy,
>
>
>  I have a rather unique problem and I am unsure of how to fix this.  I
> am connecting to Oracle, one of the tables I HAVE to work with is using
> a keyword as the column name (I didn't do it!).
>
>  The way to get select statements to work is by single-quoting the
> column call.  Example:
>
> SELECT
>  'me.level'
> FROM
>  test me;
>
> The problem is that DBIx::Class does not do the single quoting by
> default and the single-quoting behavior, I don't believe, does not work
> for all databases.
>
> Does anyone have suggestions about how this problem could be addressed?
>
> Steve Kirkup
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080213/5b4=
fe9f0/attachment.htm


More information about the DBIx-Class mailing list