Re: perl Pg module and result status
От | Neil Conway |
---|---|
Тема | Re: perl Pg module and result status |
Дата | |
Msg-id | 20000920212417.B274@klamath.dyndns.org обсуждение исходный текст |
Ответ на | Re: perl Pg module and result status ("Edward Q. Bridges" <ed.bridges@buzznik.com>) |
Ответы |
Re: perl Pg module and result status
|
Список | pgsql-general |
On Wed, Sep 20, 2000 at 07:27:40PM -0400, Edward Q. Bridges wrote: > i can't seem to locate the reference to the documentation > you mention in the perldoc for DBD::Pg, can you reference > it? I believe he is using straight Pg - the perl interface to Postgres. AFAIK, that's independant of DBI::Pg, which is the Postgres driver for DBI. I agree with you, however: I've found DBD::Pg quite a bit easier to work with than Pg. It also gives you the possibility of moving your code to another database with relatively small changes. If you don't mind me commenting on your code: > use DBI; > $user = ''; > $pass = ''; > $dburl = ''; # should be: dbi:Pg:dbname=[your database name] > $db = DBI->connect($dburl, $user, $pass, {AutoCommit=>0} ) > or die "Can't connect to db"; Is there a reason you're not using constants? e.g. use constant DB_USER => 'foo'; use constant DB_PASSWD => 'qwerty'; You might also want to add the "$DBI::errstr" to the error message on a connection failure. (Sorry, I just couldn't resist nit-picking :D) HTH, Neil -- Neil Conway <neilconway@home.com> Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc Encrypted mail welcomed Is uniformity [of religion] attainable? Millions of innocent men, women, and children, since the introduction of Christianity, have been burnt, tortured, fined, imprisoned; yet we have not advanced one inch towards uniformity. -- Thomas Jefferson, "Notes on Virginia"
Вложения
В списке pgsql-general по дате отправления: