Re: using callbacks with connect_cached

"David E. Wheeler" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On Aug 21, 2013, at 8:09 PM, Vincent Veyron <[email protected]> wrote:

>    my $dbh = DBI->connect_cached( "DBI:Pg:dbname=aspro", 'www-data',
> undef, {
> 	PrintError =>1,
>    	RaiseError => 1,
>    	AutoCommit => 1,
>    	pg_bool_tf => 't',
> 	private_preferred_datestyle => $preferred_datestyle,
> 
> Callbacks => {
>                 "connect_cached.new" => sub {
>                     shift->do(qq{
> 			SET datestyle TO $preferred_datestyle
>                     });
> 		     return;
>                 }
> 		 }
> 	
> 				   } ) 
>    	or croak "Cannot connect to db: $DBI::errstr";
> 
>    return $dbh;
> 
> }

Try the connected callback, instead:

  http://justatheory.com/computers/databases/postgresql/execute-on-select.html

Best,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.