Re: Datestyle and Postmaster
От | Marc SCHAEFER |
---|---|
Тема | Re: Datestyle and Postmaster |
Дата | |
Msg-id | Pine.LNX.3.96.1001116200523.1018A-100000@defian.alphanet.ch обсуждение исходный текст |
Ответ на | Datestyle and Postmaster (Jason Everett <jeverett@esu10.org>) |
Список | pgsql-general |
On Thu, 16 Nov 2000, Jason Everett wrote: > work using psql but I'm not quite sure how to get my programs to do the > same (other than rewrite them to use the ISO, US style). Is there a way I use this in my open_database() Perl function: # NAME # open_database # DESCRIPTION # Opens a database and sets up a reasonable set of defaults. # RESULT # The database handle, or undef. # NOTES # BUGS # TODO sub open_database { # NOTES # - We set AutoCommit to 1 (no transactions for now) # and RaiseError to 0, since we check explicitely all # results. my $dbh = DBI->connect("dbi:Pg" . ":dbname=$the_database" . ";host=$the_server", $the_user, $the_password, { RaiseError => 0, AutoCommit => 1 }); if (defined($dbh)) { # Also sets up reasonable defaults. my $result = 0; my $sth = $dbh->prepare("SET DATESTYLE=\'ISO\'"); if (defined($sth)) { my $rv = $sth->execute; if (defined($rv)) { $result = 1; undef $rv; } $sth->finish; undef $sth; } if ($result == 0) { undef $dbh; } } return $dbh; }
В списке pgsql-general по дате отправления: