[freeside-commits] freeside/FS/FS UID.pm,1.46,1.47
Ivan,,,
ivan at wavetail.420.am
Wed Jun 3 12:52:12 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26637
Modified Files:
UID.pm
Log Message:
add a hack to set default schema, cf. http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration:PostgreSQL_Schema
Index: UID.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/UID.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- UID.pm 4 Mar 2009 01:47:55 -0000 1.46
+++ UID.pm 3 Jun 2009 19:52:10 -0000 1.47
@@ -2,9 +2,9 @@
use strict;
use vars qw(
- @ISA @EXPORT_OK $DEBUG $me $cgi $dbh $freeside_uid $user
- $conf_dir $cache_dir $secrets $datasrc $db_user $db_pass %callback @callback
- $driver_name $AutoCommit $callback_hack $use_confcompat
+ @ISA @EXPORT_OK $DEBUG $me $cgi $freeside_uid $user $conf_dir $cache_dir
+ $secrets $datasrc $db_user $db_pass $schema $dbh $driver_name
+ $AutoCommit %callback @callback $callback_hack $use_confcompat
);
use subs qw(
getsecrets cgisetotaker
@@ -150,12 +150,24 @@
}
sub myconnect {
- DBI->connect( getsecrets(@_), { 'AutoCommit' => 0,
- 'ChopBlanks' => 1,
- 'ShowErrorStatement' => 1,
- }
- )
+ my $handle = DBI->connect( getsecrets(@_), { 'AutoCommit' => 0,
+ 'ChopBlanks' => 1,
+ 'ShowErrorStatement' => 1,
+ }
+ )
or die "DBI->connect error: $DBI::errstr\n";
+
+ if ( $schema ) {
+ use DBIx::DBSchema::_util qw(_load_driver ); #quelle hack
+ my $driver = _load_driver($handle);
+ if ( $driver =~ /^Pg/ ) {
+ no warnings 'redefine';
+ eval "sub DBIx::DBSchema::DBD::${driver}::default_db_schema {'$schema'}";
+ die $@ if $@;
+ }
+ }
+
+ $handle;
}
=item install_callback
@@ -325,10 +337,11 @@
$secrets = 'secrets';
}
- ($datasrc, $db_user, $db_pass) =
+ ($datasrc, $db_user, $db_pass, $schema) =
map { /^(.*)$/; $1 } readline(new IO::File "$conf_dir/$secrets")
or die "Can't get secrets: $conf_dir/$secrets: $!\n";
undef $driver_name;
+
($datasrc, $db_user, $db_pass);
}
More information about the freeside-commits
mailing list