[Bast-commits] r7559 - in
DBIx-Class/0.08/branches/pg_unqualified_schema:
lib/DBIx/Class/Storage/DBI t
rbuels at dev.catalyst.perl.org
rbuels at dev.catalyst.perl.org
Fri Sep 4 17:42:53 GMT 2009
Author: rbuels
Date: 2009-09-04 17:42:52 +0000 (Fri, 04 Sep 2009)
New Revision: 7559
Modified:
DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm
DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t
Log:
moved search_path querying function from Pg storage driver into tests
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-09-04 17:27:50 UTC (rev 7558)
+++ DBIx-Class/0.08/branches/pg_unqualified_schema/lib/DBIx/Class/Storage/DBI/Pg.pm 2009-09-04 17:42:52 UTC (rev 7559)
@@ -39,24 +39,6 @@
}
-# get the postgres search path, and cache it
-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, $col) = @_;
Modified: DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t
===================================================================
--- DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t 2009-09-04 17:27:50 UTC (rev 7558)
+++ DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t 2009-09-04 17:42:52 UTC (rev 7559)
@@ -476,7 +476,7 @@
my $schema = shift;
#save the search path and reset it at the end
- my $search_path_save = $schema->storage->dbh_do('_get_pg_search_path');
+ my $search_path_save = eapk_get_search_path($schema);
eapk_drop_all($schema);
@@ -546,7 +546,7 @@
? $eapk_schemas[$schema_num]
: '';
- my $schema_name_actual = $schema_name || $s->storage->dbh_do('_get_pg_search_path')->[0];
+ my $schema_name_actual = $schema_name || eapk_get_search_path($s)->[0];
$s->source('ExtAPK')->name($schema_name ? $schema_name.'.apk' : 'apk');
#< clear sequence name cache
@@ -576,7 +576,7 @@
# class
sub eapk_seq_diag {
my $s = shift;
- my $schema = shift || $s->storage->dbh_do('_get_pg_search_path')->[0];
+ my $schema = shift || eapk_get_search_path($s)->[0];
diag "$schema.apk sequences: ",
join(', ',
@@ -585,6 +585,25 @@
);
}
+# get the postgres search path as an arrayref
+sub eapk_get_search_path {
+ my ( $s ) = @_;
+ # cache the search path as ['schema','schema',...] in the storage
+ # obj
+
+ return $s->storage->dbh_do(sub {
+ my (undef, $dbh) = @_;
+ my @search_path;
+ my ($sp_string) = $dbh->selectrow_array('SHOW search_path');
+ while ( $sp_string =~ s/("[^"]+"|[^,]+),?// ) {
+ unless( defined $1 and length $1 ) {
+ die "search path sanity check failed: '$1'";
+ }
+ push @search_path, $1;
+ }
+ \@search_path
+ });
+}
sub eapk_set_search_path {
my ($s, at sp) = @_;
my $sp = join ',', at sp;
More information about the Bast-commits
mailing list