[vhffs-dev] [2120] now using the versatile data source string instead of separate fields for host , port, and database of the postgresql server

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2120
Author:   gradator
Date:     2012-03-04 23:30:06 +0100 (Sun, 04 Mar 2012)
Log Message:
-----------
now using the versatile data source string instead of separate fields for host, port, and database of the postgresql server

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs.pm
    trunk/vhffs-backend/conf/vhffs.conf.dist.in

Modified: trunk/vhffs-api/src/Vhffs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs.pm	2012-03-04 18:13:51 UTC (rev 2119)
+++ trunk/vhffs-api/src/Vhffs.pm	2012-03-04 22:30:06 UTC (rev 2120)
@@ -139,7 +139,7 @@
 		my $port = ( $config->{'db_port'} or '5432' );
 		my $host = ( $config->{'db_host'} or 'localhost' );
 
-		my $dbh = DBI->connect('DBI:Pg:dbname='.$config->{'db_name'}.';host='.$host.';port='.$port, $config->{'db_username'}, $config->{'db_password'}, {pg_enable_utf8 => 1} );
+		my $dbh = DBI->connect('DBI:Pg:'.$config->{'db_datasource'}, $config->{'db_username'}, $config->{'db_password'}, {pg_enable_utf8 => 1} );
 		return undef unless defined $dbh;
 		$dbh->do( 'SET CLIENT_ENCODING TO \'UTF8\'' );
 		$self->{'db'} = $dbh;

Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in	2012-03-04 18:13:51 UTC (rev 2119)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in	2012-03-04 22:30:06 UTC (rev 2120)
@@ -145,20 +145,14 @@
 	# Driver to use, however only PostgresSQL is supported at the moment
 	driver		=	pg
 
-	# Database to use
-	db_name		=	vhffs
+	# Database to use (DBI data source name)
+	db_datasource	=	database=vhffs;host=localhost;port=5432
 
 	# Username used to access the database server
 	db_username	=	vhffs
 
 	# Password
 	db_password	=	vhffs
-
-	# DataBase Server
-	db_host		=	localhost
-
-	# Database port
-	db_port		=	5432
 </database>
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/