Обсуждение: pg or DBI

Поиск
Список
Период
Сортировка

pg or DBI

От
"Devinder K Rajput"
Дата:
Hi all,

I have used pg to connect to postgres.  However, I have seen a lot of
people use DBI.  Are there any advantages/disadvantages in using one or the
other for connecting to postgres via perl.  Also, which one is more widely
used?  Thanks for your input.

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



Re: pg or DBI

От
"Gareth Kirwan"
Дата:
I looked into it very heavily when I was first deciding on a method.
I chose to use Pg, and I've found it amazing ever since.
I use it religiously, with Mason, and haven't been let down by it once.

I'm sure the reasons I found were enough for me, and should be enough for
anyone :-)

Gareth

-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Devinder K Rajput
Sent: 24 October 2002 18:05
To: pgsql-novice@postgresql.org; pgsql-admin@postgresql.org
Subject: [ADMIN] pg or DBI


Hi all,

I have used pg to connect to postgres.  However, I have seen a lot of
people use DBI.  Are there any advantages/disadvantages in using one or the
other for connecting to postgres via perl.  Also, which one is more widely
used?  Thanks for your input.

Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



Re: pg or DBI

От
Jeremy Buchmann
Дата:
On Thursday, October 24, 2002, at 10:05 AM, Devinder K Rajput wrote:

> Hi all,
>
> I have used pg to connect to postgres.  However, I have seen a lot of
> people use DBI.  Are there any advantages/disadvantages in using one or
> the
> other for connecting to postgres via perl.  Also, which one is more
> widely
> used?  Thanks for your input.

In theory, DBI is "cross-database", meaning the code you write to access
one database is the same as, or very similar to, the code you write to
access another.  That's nice because if you switch databases, you don't
have to do a huge code re-write, and you don't have to learn a different
set of function calls for each database you use.  Also, DBI is actively
maintained, and I don't know if Perl-Pg is or not.  There has been some
discussion about ditching Perl-Pg in favor of DBI, but I don't know if
anything
became of that.

--Jeremy


Re: pg or DBI

От
"Peter Galbavy"
Дата:
> I have used pg to connect to postgres.  However, I have seen a lot of
> people use DBI.  Are there any advantages/disadvantages in using one or
the
> other for connecting to postgres via perl.  Also, which one is more widely
> used?  Thanks for your input.

I have never used Pg but I had a quick look and appears to be the way to go
if you are going to be using PostgreSQL only. DBI gives you two benefits
which are related; a) You can build software that will work with different
database backends with only minimal changes (if you follow the portability
guidelines) and b) you can work with multiple different database backends in
the same code at the same time.

The later is extremely powerful when you 'inherit' a job that may involve
ODBC, Oracle, PostgreSQL etc. Cough.

Give both a quick try, proof of concept them, and decide.

Peter