From: Rob Kinyon Date: Wed, 19 Aug 2009 19:44:48 +0000 (+0000) Subject: Applied doc patch by spb X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0bc1c11e2f3e1f67fb5ed3c9f8b69912d26bc863;p=dbsrgits%2FDBIx-Class-Historic.git Applied doc patch by spb --- diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 51a8a33..94805c2 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -1522,13 +1522,13 @@ customers as above. If the database contains column names with spaces and/or reserved words, they need to be quoted in the SQL queries. This is done using: - __PACKAGE__->storage->sql_maker->quote_char([ qw/[ ]/] ); - __PACKAGE__->storage->sql_maker->name_sep('.'); + $schema->storage->sql_maker->quote_char([ qw/[ ]/] ); + $schema->storage->sql_maker->name_sep('.'); The first sets the quote characters. Either a pair of matching brackets, or a C<"> or C<'>: - __PACKAGE__->storage->sql_maker->quote_char('"'); + $schema->storage->sql_maker->quote_char('"'); Check the documentation of your database for the correct quote characters to use. C needs to be set to allow the SQL @@ -1547,6 +1547,17 @@ L: } ) +In some cases, quoting will be required for all users of a schema. To enforce +this, you can also overload the C method for your schema class: + + sub connect { + my $self = shift; + my $rv = $self->next::method( @_ ); + $rv->storage->sql_maker->quote_char([ qw/[ ]/ ]); + $rv->storage->sql_maker->name_sep('.'); + return $rv; + } + =head2 Setting limit dialect for SQL::Abstract::Limit In some cases, SQL::Abstract::Limit cannot determine the dialect of