CVS User Account cvsuser
Wed Dec 13 14:18:50 PST 2006
Log Message:
-----------
Add to slonik_build_env.pl a -schema option to by default pull tables from
other than the "public" schema - per Cedric Villemain

Tags:
----
REL_1_2_STABLE

Modified Files:
--------------
    slony1-engine/tools/altperl:
        slonik_build_env.pl (r1.1 -> r1.1.4.1)

-------------- next part --------------
Index: slonik_build_env.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slonik_build_env.pl,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -Ltools/altperl/slonik_build_env.pl -Ltools/altperl/slonik_build_env.pl -u -w -r1.1 -r1.1.4.1
--- tools/altperl/slonik_build_env.pl
+++ tools/altperl/slonik_build_env.pl
@@ -19,13 +19,17 @@
 my $dataBasePassword;
 my $dataBasePort;
 my @nodes;
-my $usage = "$0 -node host:database:user[:password:port] [-node ...]
-First node is assumed to be the master.\n";
+my $schema = 'public';
+my $usage = "$0 -node host:database:user[:password:port] [-node ...] [-schema myschema]
+First node is assumed to be the master.
+Default schema is \"public\"\n";
 
 &usage if(!GetOptions('node=s@'=>\@nodes));
 
 die "At least one node is required" if ( scalar(@nodes) < 1 );
 
+
+
 my $nodeNumber = 1;
 my $parentString;
 foreach my $node (@nodes)
@@ -53,14 +57,14 @@
 my $dbh = DBI->connect($connectString,$dataBaseUser,$dataBasePassword,
 		       {RaiseError => 0, PrintError => 0, AutoCommit => 1});
 die "connect: $DBI::errstr" if ( !defined($dbh) || $DBI::err );
-# Read in all the user 'normal' tables in public.
+# Read in all the user 'normal' tables in $schema (public by default).
 my $tableQuery = $dbh->prepare("
 SELECT pg_namespace.nspname || '.' || pg_class.relname,pg_class.relkind,pg_class.relhaspkey 
 FROM pg_namespace,pg_class
 WHERE pg_class.reltype > 0
 AND pg_class.relnamespace = pg_catalog.pg_namespace.oid
 AND (pg_class.relkind = 'r' OR pg_class.relkind = 'S')
-AND pg_namespace.nspname = 'public' AND pg_namespace.oid = pg_class.relnamespace");
+AND pg_namespace.nspname = '$schema' AND pg_namespace.oid = pg_class.relnamespace");
 
 die "prepare(tableQuery): $DBI::errstr" if ( !defined($tableQuery) || $DBI::err );
 die "execute(tableQuery): $DBI::errstr" if ( !$tableQuery->execute() );



More information about the Slony1-commit mailing list