field of type oid - Mailing list pgsql-jdbc

From RaviShankar K
Subject field of type oid
Date
Msg-id 030d01c120ad$618965b0$0400a8c0@ejan.net
Whole thread Raw
List pgsql-jdbc
Hi Barry,

    Thank you for the mail.

    In my application Blobs will not get deleted ever .
    However "oid" references in first table will get deleted . But the same
"oid"s will be inserted and they will exist
 in second table permanently.So as per your suggestion I can delete oids
from first table.

Thanks & Regards,
Ravi

----- Original Message -----
From: "Barry Lind" <barry@xythos.com>
To: "RaviShankar K" <ravi@e-jan.co.jp>
Cc: <pgsql-jdbc@postgresql.org>
Sent: Tuesday, August 07, 2001 AM 11:04
Subject: Re: field of type oid


Ravi,

Yes this will work.  The blob oid is just a pointer to the blob.
Multiple rows can have an oid reference to the same blob.  I don't know
if this is how you want to code your application though.  That would
depend on what you are trying to accomplish overall and you haven't
provided enough information here to answer that question.  The one
question I would ask you about your application design is how/when do
blobs finally get deleted?  (Are you keeping reference counts to know
when no more rows are referencing the blob so that it is OK to delete?)

thanks,
--Barry

RaviShankar K wrote:
> Hi ,
>
>
>
>     I have 2 tables in my postgres DB .
>
>     2 tables have a field "my_image" of type "oid" ( Blob) .
>
>
>
>     I have to
>
>         1.get a row from table A
>
>         2.insert it in table B
>
>         3.delete that from table A .
>
>
>
>     Can I do like this ?
>
>         ResultSet rs ;
>
>         PreparedStatement pstmt;
>
>         String qry2 = "SELECT * FROM A";
>
>         String qry = "INSERT INTO B (my_image) VALUES(?)";
>
>
>
>         /*This part is doubtful to me */
>
>         pstmt.setInt(rs.getInt("my_image"));
>
>
>
>         I am using rs.getInt() because I need only oid . It is working
> fine when I tested this code.
>
> I am able to insert integer in to field of type oid . I can retrieve
> image(Blob object) from table B using that inserted integer.
>
>
>
>     However I don't know how much correct this way is . Please advice me.
>
>     Thanks in advance.
>
>
>
> Regards,
>
> Ravi
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






pgsql-jdbc by date:

Previous
From: "RaviShankar K"
Date:
Subject: Retrieving field of type bigint[]
Next
From: Rene Pijlman
Date:
Subject: Re: Retrieving field of type bigint[]