pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
object id
7+ messages / 4 participants
[nested] [flat]

* object id
@ 2001-03-05 10:07 Martin Schild <maet@gmx.de>
  0 siblings, 0 replies; 7+ messages in thread

From: Martin Schild @ 2001-03-05 10:07 UTC (permalink / raw)
  To: pgsql-interfaces

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 that i don't have to use the setBytes method again with the other
table.

thanks,
Martin




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* object id
@ 2001-03-05 11:06 Martin Schild <maet@gmx.de>
  2001-03-06 11:57 ` Re: object id Peter T Mount <peter@retep.org.uk>
  0 siblings, 1 reply; 7+ messages in thread

From: Martin Schild @ 2001-03-05 11:06 UTC (permalink / raw)
  To: pgsql-interfaces

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.

thanks,
Martin






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: object id
  2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
@ 2001-03-06 11:57 ` Peter T Mount <peter@retep.org.uk>
  2001-03-06 15:40   ` Re: object id maet@gmx.de
  2001-03-12 16:11   ` Re: object id Peter Mount <peter@retep.org.uk>
  0 siblings, 2 replies; 7+ messages in thread

From: Peter T Mount @ 2001-03-06 11:57 UTC (permalink / raw)
  To: Martin Schild <maet@gmx.de>; +Cc: pgsql-interfaces

Quoting Martin Schild <maet@gmx.de>:

> 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

-- 
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: object id
  2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
  2001-03-06 11:57 ` Re: object id Peter T Mount <peter@retep.org.uk>
@ 2001-03-06 15:40   ` maet@gmx.de
  1 sibling, 0 replies; 7+ messages in thread

From: maet@gmx.de @ 2001-03-06 15:40 UTC (permalink / raw)
  To: Peter T Mount <peter@retep.org.uk>; +Cc: pgsql-interfaces

> 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

-- 
Sent through GMX FreeMail - http://www.gmx.net




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: object id
  2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
  2001-03-06 11:57 ` Re: object id Peter T Mount <peter@retep.org.uk>
@ 2001-03-12 16:11   ` Peter Mount <peter@retep.org.uk>
  2001-03-12 18:22     ` Re: object id maet@gmx.de
  2001-03-12 20:12     ` Re: [INTERFACES] object id Peter Mount <peter@retep.org.uk>
  1 sibling, 2 replies; 7+ messages in thread

From: Peter Mount @ 2001-03-12 16:11 UTC (permalink / raw)
  To: maet@gmx.de; +Cc: pgsql-interfaces

At 16:40 06/03/01 +0100, maet@gmx.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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: object id
  2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
  2001-03-06 11:57 ` Re: object id Peter T Mount <peter@retep.org.uk>
  2001-03-12 16:11   ` Re: object id Peter Mount <peter@retep.org.uk>
@ 2001-03-12 18:22     ` maet@gmx.de
  1 sibling, 0 replies; 7+ messages in thread

From: maet@gmx.de @ 2001-03-12 18:22 UTC (permalink / raw)
  To: Peter Mount <peter@retep.org.uk>; +Cc: pgsql-interfaces

>Hmm, not really. The only oid you can get is one from an Insert, but thats
>for the most recent row inserted.


How do i get the oid from the blob of the most recent row inserted?


thanks,
Martin

-- 
Sent through GMX FreeMail - http://www.gmx.net




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [INTERFACES] object id
  2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
  2001-03-06 11:57 ` Re: object id Peter T Mount <peter@retep.org.uk>
  2001-03-12 16:11   ` Re: object id Peter Mount <peter@retep.org.uk>
@ 2001-03-12 20:12     ` Peter Mount <peter@retep.org.uk>
  1 sibling, 0 replies; 7+ messages in thread

From: Peter Mount @ 2001-03-12 20:12 UTC (permalink / raw)
  To: maet@gmx.de; +Cc: pgsql-jdbc@postgresql.org

At 19:22 12/03/01 +0100, maet@gmx.de wrote:
> >Hmm, not really. The only oid you can get is one from an Insert, but thats
> >for the most recent row inserted.
>
>
>How do i get the oid from the blob of the most recent row inserted?

The only way is to re-query the row as only the oid of the row is returned 
during the insert.

The only other way is to use the largeobject api (not JDBC) and then you 
have the oid before any inserts.

Peter




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2001-03-12 20:12 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-05 10:07 object id Martin Schild <maet@gmx.de>
2001-03-05 11:06 object id Martin Schild <maet@gmx.de>
2001-03-06 11:57 ` Peter T Mount <peter@retep.org.uk>
2001-03-06 15:40   ` maet@gmx.de
2001-03-12 16:11   ` Peter Mount <peter@retep.org.uk>
2001-03-12 18:22     ` maet@gmx.de
2001-03-12 20:12     ` Peter Mount <peter@retep.org.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox