A note on "Programming the Perl DBI (Tim Bunce)"

A note on "Programming the Perl DBI (Tim Bunce)"

am 25.07.2007 08:15:33 von catdogbeloved

Hello,

I got the following error, and no way to understand what it means.

The error:

<< Can't locate object method "pg_oid_status" via package "DBI::db" >>

This is triggered by my command << $bag{$dbh->pg_oid_status} = 1; >>
where I use the oid as index in a structure of my own.

The book (First Edition, February 2000):

Looking into it, the only page that talks about DBI:db is page 72, in
an example. It does not really talk about it; it just mentions it in
the example.

Now, how am I supposed to move on with it?

Bob

Re: A note on "Programming the Perl DBI (Tim Bunce)"

am 25.07.2007 11:39:15 von amos.shapira

------=_Part_187594_31440210.1185356355770
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 25/07/07, Bob wrote:
>
> Hello,
>
> I got the following error, and no way to understand what it means.
>
> The error:
>
> << Can't locate object method "pg_oid_status" via package "DBI::db" >>
>
> This is triggered by my command << $bag{$dbh->pg_oid_status} = 1; >>
> where I use the oid as index in a structure of my own.


Do you have OID's on this table?

Look for "WITH OID" in the following link
http://www.postgresql.org/docs/8.1/static/sql-createtable.ht ml

--Amos

------=_Part_187594_31440210.1185356355770--

Re: A note on "Programming the Perl DBI (Tim Bunce)"

am 25.07.2007 15:38:17 von Greg

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> << Can't locate object method "pg_oid_status" via package "DBI::db" >>
>
> This is triggered by my command << $bag{$dbh->pg_oid_status} = 1; >>
> where I use the oid as index in a structure of my own.

pg_oid_status is an *attribute* of the statement handle, and not a *method*.
So accessing it should be:

$sth->{pg_oid_status};

and thus your particular query would be:

$bag{ $sth->{pg_oid_status} } = 1;

DBI::db in this case refers to the database handle, which is the item
returned by the DBI->connect method: many people follow the standard
name of $dbh, which I assume you have done here. The database handle
does not contain the pg_oid_status attribute, however, the statement
handle does.

Having said all of that, OIDs have been severely deprecated and are not
even turned on by default in recent versions of Postgres. So it is
unlikely that you want to even rely on this attribute except under
very rare and specific cases. You might also want to check the DBI
or DBD::Pg docs for the last_insert_id() method, which may be helpful
in whatever you are trying to do.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200707250928
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B90 6714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFGp1IrvJuQZxSWSsgRA524AKDd1DTHEsRGT0wI8JGioU4akKms+ACg q/yV
FVmdhCfyLSXfeJGewGV/SR0=
=pPOD
-----END PGP SIGNATURE-----