[Bast-commits] r7292 -
DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI
rbuels at dev.catalyst.perl.org
rbuels at dev.catalyst.perl.org
Mon Aug 10 18:45:52 GMT 2009
Author: rbuels
Date: 2009-08-10 18:45:50 +0000 (Mon, 10 Aug 2009)
New Revision: 7292
Modified:
DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm
Log:
added caching of pg search path in Pg storage object
Modified: DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-08-10 13:53:55 UTC (rev 7291)
+++ DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-08-10 18:45:50 UTC (rev 7292)
@@ -33,6 +33,23 @@
$self->dbh_do('_dbh_last_insert_id', $seq);
}
+sub _get_pg_search_path {
+ my ($self,$dbh) = @_;
+ # cache the search path as ['schema','schema',...] in the storage
+ # obj
+ $self->{_pg_search_path} ||= do {
+ my @search_path;
+ my ($sp_string) = $dbh->selectrow_array('SHOW search_path');
+ while( $sp_string =~ s/("[^"]+"|[^,]+),?// ) {
+ unless( defined $1 and length $1 ) {
+ $self->throw_exception("search path sanity check failed: '$1'")
+ }
+ push @search_path, $1;
+ }
+ \@search_path
+ };
+}
+
sub _dbh_get_autoinc_seq {
my ($self, $dbh, $schema, $table, @pri) = @_;
@@ -42,13 +59,7 @@
if( defined $schema and length $schema ) {
@search_path = ( $schema );
} else {
- my ($search_path) = $dbh->selectrow_array('SHOW search_path');
- while( $search_path =~ s/("[^"]+"|[^,]+),?// ) {
- unless( defined $1 and length $1 ) {
- $self->throw_exception("search path sanity check failed: '$1'")
- }
- push @search_path, $1;
- }
+ @search_path = @{ $self->_get_pg_search_path($dbh) };
}
foreach my $search_schema (@search_path) {
More information about the Bast-commits
mailing list