[mirrorbrain-commits] [opensuse-svn] r6324 - trunk/tools/download-redirector-v2/scanner

From: Novell Forge SVN <noreply_at_novell.com>
Date: Mon, 2 Feb 2009 16:42:41 -0700 (MST)
Author: poeml
Date: 2009-02-02 16:42:38 -0700 (Mon, 02 Feb 2009)
New Revision: 6324

Modified:
   trunk/tools/download-redirector-v2/scanner/scanner.pl
Log:
scanner: handle configuration for DBD drivers other than mysql


Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl
===================================================================
--- trunk/tools/download-redirector-v2/scanner/scanner.pl	2009-02-02 22:38:28 UTC (rev 6323)
+++ trunk/tools/download-redirector-v2/scanner/scanner.pl	2009-02-02 23:42:38 UTC (rev 6324)
@@ -187,11 +187,24 @@
 $brain_instance = $brain_instances[0] unless $brain_instance;
 $cfg->SectionExists($brain_instance) or die 'no [' . $brain_instance . '] section in config file';
 
-# port is optional
-my $db_port = '3306';
+
+my $db_driver = 'mysql'; # backwards compatible default
+$db_driver = $cfg->val($brain_instance, 'dbdriver') 
+		if $cfg->val($brain_instance, 'dbdriver');
+
+my $db_port = 'not set';
+if($db_driver eq 'Pg') {
+  $db_port = '5432';
+}
+elsif($db_driver eq 'mysql') {
+    $db_port = '3306';
+}
+else { die 'unknown dbddriver "' . $db_driver . '" in config file'; }
+
 $db_port = $cfg->val($brain_instance, 'dbport') 
 		if $cfg->val($brain_instance, 'dbport');
-my $db_cred = { dbi => 'dbi:' .  $cfg->val( $brain_instance, 'dbdriver')
+
+my $db_cred = { dbi => 'dbi:' .  $db_driver
                               . ':dbname=' . $cfg->val( $brain_instance, 'dbname') 
                               . ';host='   . $cfg->val( $brain_instance, 'dbhost')
                               . ';port='   . $db_port,

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on 2009-02-02Z23:43:16

This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:10 GMT