Re: object id

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: maet(at)gmx(dot)de
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: object id
Date: 2001-03-12 16:11:08
Message-ID: 5.0.2.1.0.20010312160856.0216c080@mail.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-jdbc

At 16:40 06/03/01 +0100, maet(at)gmx(dot)de wrote:
> > Hi,
> >
> > I'm using the setBytes() method of jdbc to store a large object to
> > database. Now i want to store the object id to another table. Is there
> > a
> >
> > possibility to get the oid of an object directly after the object is
> > stored to store this id into another table.
>
>
>setBytes() actually stores the large object's OID in that column, so to get
>the
>oid, simply use getInt() or getString() on the same column.
>Only getBytes() & get*Stream() methods (as well as the set* equivalents)
>actually operate on the large object itself. The others would see just the
>oid value.
>
>Peter
>
>
>O.K. but is it possible to get the oid during or directly after inserting
>the object into the table without a query to find the column again? I want to
>insert an object at the same time into different tables and they should have
>the same oid so i can use a join on these tables.
>
>thanks,
>Martin

Hmm, not really. The only oid you can get is one from an Insert, but thats
for the most recent row inserted.
The only way is to create the blob first, then insert into both tables
afterwards.

Peter

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message J. T. Vermeulen 2001-03-12 16:37:56 libpq++: combined patches based on 7.1b5
Previous Message Frank Joerdens 2001-03-12 10:19:53 Re: Data type for storing images?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-12 16:47:48 Re: JDBC build patches
Previous Message Peter Mount 2001-03-12 15:59:38 Re: callable statements, latest snapshot