Re: perl Pg module and result status

From: "Edward Q(dot) Bridges" <ed(dot)bridges(at)buzznik(dot)com>
To: "Neil Conway" <nconway(at)klamath(dot)dyndns(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: perl Pg module and result status
Date: 2000-09-21 15:11:25
Message-ID: 200009211513.e8LFDZs39062@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 20 Sep 2000 21:24:17 -0400, Neil Conway wrote:

> 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.
>

ahhh! "i see" said the blind man :)

> 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.
>

yes, i agree totally. it also makes using a new database a lot
easier, since you're just calling the same functions.

> If you don't mind me commenting on your code:

not at all!

> > $user = '';
> > $pass = '';
> > $dburl = ''; # should be: dbi:Pg:dbname=[your database name]

> Is there a reason you're not using constants? e.g.
>
> use constant DB_USER => 'foo';
> use constant DB_PASSWD => 'qwerty';
>

nope. didn't occur to me for this sort of example. also seems to
bring in extra overhead. is there an advantage?

> You might also want to add the "$DBI::errstr" to the error message
> on a connection failure.
>

yeah, i used it on the other method calls. should have put it there
as well. i think, tho, that the driver will by default print out that
error string when it dies.

regards
--e--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Indraneel Majumdar 2000-09-21 16:29:34 How do I run a search on array
Previous Message Edward Q. Bridges 2000-09-21 15:06:48 Re: Re: sequences