X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FPg.pm;h=a8fd85bc27d4e606b07553f108efe3eb5b08c59c;hb=12a184d0a0c1868708e43aaabefe08f9e7ac9ec4;hp=ded6d0698034f4b8e940a7e4739b0c681656d04b;hpb=74919a00766bc8f9bd9f6170d1977e186ce676d5;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index ded6d06..a8fd85b 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -157,11 +157,40 @@ EOS return $seq_expr; } +sub _dbh_execute_for_fetch { + #my ($self, $source, $sth, $tuple_status, @extra) = @_; + + # This is used for bulk insert, so make sure we use a server-side + # prepared statement from the start, unless it's disabled + local $_[2]->{pg_switch_prepared} = 1 if + modver_gt_or_eq( 'DBD::Pg', '3.0.0' ) + and + $_[2]->FETCH('pg_switch_prepared') > 0 + ; + + shift->next::method(@_); +} sub sqlt_type { return 'PostgreSQL'; } +# Pg is not able to MAX(boolean_column), sigh... +# +# Generally it would make more sense to have this in the SQLMaker hierarchy, +# so that eventually { -max => ... } DTRT, but plans going forward are +# murky at best +# --ribasushi +# +sub _minmax_operator_for_datatype { + #my ($self, $datatype, $want_max) = @_; + + return ($_[2] ? 'BOOL_OR' : 'BOOL_AND') + if ($_[1] || '') =~ /\Abool(?:ean)?\z/i; + + shift->next::method(@_); +} + sub bind_attribute_by_data_type { my ($self,$data_type) = @_; @@ -181,6 +210,8 @@ sub bind_attribute_by_data_type { ); } elsif ( + require DBIx::Class::Optional::Dependencies + and my $missing = DBIx::Class::Optional::Dependencies->req_missing_for([qw( rdbms_pg binary_data )]) ) { # FIXME - perhaps this needs to be an exception too...?