From: Peter Rabbitson Date: Fri, 27 Feb 2009 01:24:37 +0000 (+0000) Subject: Fix some should_quote_data_type problems X-Git-Tag: v0.08100~71 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=00c937a24ecd01b75997dd3e0211f2377fcd84ff;p=dbsrgits%2FDBIx-Class.git Fix some should_quote_data_type problems --- diff --git a/Changes b/Changes index 61f5831..02c6051 100644 --- a/Changes +++ b/Changes @@ -16,6 +16,8 @@ Revision history for DBIx::Class to make it more matpath-friendly - deploy_statements called ddl_filename with the $version and $dir arguments in the wrong order. (groditi) + - columns/+columns attributes now support { as => select } hahsrefs + 0.08099_06 2009-01-23 07:30:00 (UTC) - Allow a scalarref to be supplied to the 'from' resultset attribute diff --git a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm index 51ef7d5..9f81caf 100644 --- a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm @@ -64,6 +64,19 @@ sub _prep_for_execute { return ($new_sql); } +=head2 should_quote_data_type + +This method is called by L for every column in +order to determine if its value should be quoted or not. The sole +argument is the current column data type, and the return value is +interpreted as: true - do quote, false - do not quote. You should +override this in you Storage::DBI:: subclass, if your +RDBMS does not like quotes around certain datatypes (e.g. Sybase +and integer columns). The default method always returns true (do +quote). + +=cut + sub should_quote_data_type { 1 } =head1 AUTHORS diff --git a/lib/DBIx/Class/Storage/DBI/Sybase.pm b/lib/DBIx/Class/Storage/DBI/Sybase.pm index f18de95..cb7408b 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase.pm @@ -5,7 +5,7 @@ use warnings; use base qw/DBIx::Class::Storage::DBI::NoBindVars/; -my %noquote = map ($_ => 1), qw(int integer); +my %noquote = map { $_ => 1 } qw(int integer); sub should_quote_data_type { my $self = shift; diff --git a/t/03podcoverage.t b/t/03podcoverage.t index 18c5292..175542b 100644 --- a/t/03podcoverage.t +++ b/t/03podcoverage.t @@ -44,6 +44,11 @@ my $exceptions = { qw(setup_connection_class) ] }, + 'DBIx::Class::Storage::DBI::Sybase' => { + ignore => [ + qw/should_quote_data_type/, + ] + }, 'DBIx::Class::CDBICompat::AccessorMapping' => { skip => 1 }, 'DBIx::Class::CDBICompat::AbstractSearch' => { ignore => [qw(search_where)]