Thread: Retrieving binary data

Retrieving binary data

From
David Garnier
Date:
Hello,

I need to retrieve the binary representation of a custom type. I can retrieve the type just fine with the standard
method,but the results of getBytes is altered. getString shows just the right thing, but I need the binary. I looked at
thesource of the driver, and I still don't know exactly what I'm supposed to do. It seems to me that the QueryExecutor
isable to fetch a binary tuple, but I don't know how to request one. 

Performance is my main problem, so I would like a fast solution. Thanks for helping.

Best regards,
David Garnier



Re: Retrieving binary data

From
Barry Lind
Date:
David,

If I understand what you are trying to do correctly, using a binary
cursor should solve your problem.  See the docs on the "declare [binary]
cursor" SQL command.

thanks,
--Barry

David Garnier wrote:

>Hello,
>
>I need to retrieve the binary representation of a custom type. I can retrieve the type just fine with the standard
method,but the results of getBytes is altered. getString shows just the right thing, but I need the binary. I looked at
thesource of the driver, and I still don't know exactly what I'm supposed to do. It seems to me that the QueryExecutor
isable to fetch a binary tuple, but I don't know how to request one. 
>
>Performance is my main problem, so I would like a fast solution. Thanks for helping.
>
>Best regards,
>David Garnier
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>
>
>
>
>





Re: Retrieving binary data

From
David Garnier
Date:
On Fri, 05 Jul 2002 12:12:45 -0700
Barry Lind <barry@xythos.com> wrote:

> David,
>
> If I understand what you are trying to do correctly, using a binary
> cursor should solve your problem.  See the docs on the "declare [binary]
> cursor" SQL command.

First, thanks for your anwser.
Yeah that's exactly what I'm thinking, but will it work with JDBC? I guess I can execute several queries in a row with
declareand fetch, but will it send me the correct bytes? I'm open to any suggestion (including Fastpath or another JDBC
driver).

Best Regards,
David Garnier

> David Garnier wrote:
>
> >Hello,
> >
> >I need to retrieve the binary representation of a custom type. I can retrieve the type just fine with the standard
method,but the results of getBytes is altered. getString shows just the right thing, but I need the binary. I looked at
thesource of the driver, and I still don't know exactly what I'm supposed to do. It seems to me that the QueryExecutor
isable to fetch a binary tuple, but I don't know how to request one. 
> >
> >Performance is my main problem, so I would like a fast solution. Thanks for helping.
> >
> >Best regards,
> >David Garnier
> >
> >
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 6: Have you searched our list archives?
> >
> >http://archives.postgresql.org
> >
> >
> >
> >
> >
>
>
>



[SOLVED]Re: Retrieving binary data

From
David Garnier
Date:
Binary cursors works just fine with JDBC. I can retrieve my binaries without any problem, and it's very very fast. Now,
canyou assure me that it isn't converted into a String at some point? (I doubt it.) 

Best Regards,
David Garnier

On Fri, 5 Jul 2002 23:24:40 +0200
David Garnier <david.garnier@etudier-online.com> wrote:

> On Fri, 05 Jul 2002 12:12:45 -0700
> Barry Lind <barry@xythos.com> wrote:
>
> > David,
> >
> > If I understand what you are trying to do correctly, using a binary
> > cursor should solve your problem.  See the docs on the "declare [binary]
> > cursor" SQL command.
>
> First, thanks for your anwser.
> Yeah that's exactly what I'm thinking, but will it work with JDBC? I guess I can execute several queries in a row
withdeclare and fetch, but will it send me the correct bytes? I'm open to any suggestion (including Fastpath or another
JDBCdriver). 
>
> Best Regards,
> David Garnier
>
> > David Garnier wrote:
> >
> > >Hello,
> > >
> > >I need to retrieve the binary representation of a custom type. I can retrieve the type just fine with the standard
method,but the results of getBytes is altered. getString shows just the right thing, but I need the binary. I looked at
thesource of the driver, and I still don't know exactly what I'm supposed to do. It seems to me that the QueryExecutor
isable to fetch a binary tuple, but I don't know how to request one. 
> > >
> > >Performance is my main problem, so I would like a fast solution. Thanks for helping.
> > >
> > >Best regards,
> > >David Garnier
> > >
> > >
> > >
> > >---------------------------(end of broadcast)---------------------------
> > >TIP 6: Have you searched our list archives?
> > >
> > >http://archives.postgresql.org
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
>



Re: [SOLVED]Re: Retrieving binary data

From
Barry Lind
Date:
David,

One thing to watch out for using binary cursors is that all of the data
selected comes back in binary form.  Thus if you select an integer value
along with you bytea data you need to realize that that integer value
comes back in the native server 32bit format.  Thus if the client and
server are running different architectures you may have endian
conversion issues.  I use binary cursors to get bytea data without any
problems.  I am quite certain that the data is never converted to a string.

thanks,
--Barry


David Garnier wrote:

>Binary cursors works just fine with JDBC. I can retrieve my binaries without any problem, and it's very very fast.
Now,can you assure me that it isn't converted into a String at some point? (I doubt it.) 
>
>Best Regards,
>David Garnier
>
>On Fri, 5 Jul 2002 23:24:40 +0200
>David Garnier <david.garnier@etudier-online.com> wrote:
>
>
>
>>On Fri, 05 Jul 2002 12:12:45 -0700
>>Barry Lind <barry@xythos.com> wrote:
>>
>>
>>
>>>David,
>>>
>>>If I understand what you are trying to do correctly, using a binary
>>>cursor should solve your problem.  See the docs on the "declare [binary]
>>>cursor" SQL command.
>>>
>>>
>>First, thanks for your anwser.
>>Yeah that's exactly what I'm thinking, but will it work with JDBC? I guess I can execute several queries in a row
withdeclare and fetch, but will it send me the correct bytes? I'm open to any suggestion (including Fastpath or another
JDBCdriver). 
>>
>>Best Regards,
>>David Garnier
>>
>>
>>
>>>David Garnier wrote:
>>>
>>>
>>>
>>>>Hello,
>>>>
>>>>I need to retrieve the binary representation of a custom type. I can retrieve the type just fine with the standard
method,but the results of getBytes is altered. getString shows just the right thing, but I need the binary. I looked at
thesource of the driver, and I still don't know exactly what I'm supposed to do. It seems to me that the QueryExecutor
isable to fetch a binary tuple, but I don't know how to request one. 
>>>>
>>>>Performance is my main problem, so I would like a fast solution. Thanks for helping.
>>>>
>>>>Best regards,
>>>>David Garnier
>>>>
>>>>
>>>>
>>>>---------------------------(end of broadcast)---------------------------
>>>>TIP 6: Have you searched our list archives?
>>>>
>>>>http://archives.postgresql.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 6: Have you searched our list archives?
>>
>>http://archives.postgresql.org
>>
>>
>>
>>
>>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>
>
>
>