[Maypole] little patch for working with Postgres and Autocommit => 1

JOUANNE Mickael m.jouanne@apr-job.com
Wed, 2 Jun 2004 19:23:43 +0200


--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

Hello.

Today i begin to test Maypole. It's a very good working module.

But after trying Beer, i discover that some DBI options i usually give
to connect don't pass in Model::CDBI.

I explain :

BeerDB->setup("dbi:Pg:dbname=beer;host=localhost;", "user", "passord", 
	{ AutoCommit => 1, RaiseError => 1, PrintError => 0 }, 
);

After password, "Autocommit" and others DBI options are ignored.
And sometimes you don't want to do transaction, so i want my Autocommit
to 1.

I included my patch attached piece.


Congratulations.
Bye.


-- 
APR-JOB                 9, rue de Lens              92000 Nanterre
Mickaël JOUANNE         Tel: 0146526820           Fax : 0146526811
WEBMASTER           m.jouanne@apr-job.com         ICQ :   42799256
* If Linux doesn't have the solution, you have the wrong problem *

--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="CDBI.pm.patch"

--- /tmp/CDBI.pm	Wed Jun  2 18:37:26 2004
+++ Model/CDBI.pm	Wed Jun  2 18:53:29 2004
@@ -127,13 +127,14 @@
 }
 
 sub setup_database {
-    my ($self, $config, $namespace, $dsn, $u, $p) = @_;
+    my ($self, $config, $namespace, $dsn, $u, $p, $opts) = @_;
     $config->{dsn} = $dsn;
     $config->{loader} = Class::DBI::Loader->new(
         namespace => $namespace,
         dsn => $dsn,
         user => $u,
         password => $p,
+	options  => $opts # for postgresql autocommit
     );
     $config->{classes} = [ $config->{loader}->classes ];
     $config->{tables}  = [ $config->{loader}->tables ];

--6c2NcOVqGQ03X4Wi--