Re: Request for help on retrieving binary data from bytea column using ODBC calls

From: Ganesh Borse <bganesh05(at)gmail(dot)com>
To: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>, pgsql-odbc(at)postgresql(dot)org
Subject: Re: Request for help on retrieving binary data from bytea column using ODBC calls
Date: 2012-02-28 02:54:56
Message-ID: CAEhYC0HC=6C312P3CNgwmFwRDLcG=2y_b6+0zkULkpFufa_QWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi,

I am using the following PostgreSQL ODBC Windows driver:

PostgreSQL 64bit 8.03.04.00 PSQLODBC_X64_RELEASE.DLL 8/3/2009 -- the one
which got installed with PostgreSQL 9.0 server that I downloaded from
PostgreSQL website.

Thanks,

On Mon, Feb 27, 2012 at 4:30 PM, Ganesh Borse <bganesh05(at)gmail(dot)com> wrote:

> Log is as below:
> Â
> cf11e0a1b11ae1000000000000000000000000000000003b000300feff0900060000000000000000000000010000006a00000000000000001000006700000001000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
>
> Memory dump in VC++ debug window:
> Address Hex Value
> 0x0000000000367850 a0 63 66 31 31 65 30 61 31 62 31 31 61 65 31 30 30 30
> 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
> 30 30 30 30 33 62 30 30 30 33 30 30 66 65
> cf11e0a1b11ae1000000000000000000000000000000003b000300fe
> 0x0000000000367889 66 66 30 39 30 30 30 36 30 30 30 30 30 30 30 30 30 30
> 30 30 30 30 30 30 30 30 30 30 30 30 30 31 30 30 30 30 30 30 36 61 30 30 30
> 30 30 30 30 30 30 30 30 30 30 30 30 30 31
> ff0900060000000000000000000000010000006a00000000000000001
> 0x00000000003678C2 30 30 30 30 30 36 37 30 30 30 30 30 30 30 31 30 30 30
> 30 30 30 66 65 66 66 66 66 66 66 30 30 30 30 30 30 30 30 30 30 30 30 30 30
> 30 30 66 66 66 66 66 66 66 66 66 66 66 66
> 000006700000001000000feffffff0000000000000000ffffffffffff
> 0x00000000003678FB 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
> 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
> 66 66 66 66 66 66 66 66 66 66 66 66 66 66
> fffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> 0x0000000000367934 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66
> 66 66 66 66 66 66 66 66 66 66 66 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> fffffffffffffffffffffffffffff............................
>
>
> On Sat, Feb 25, 2012 at 5:47 AM, Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp> wrote:
>
>> (2012/02/24 18:56), Ganesh Borse wrote:
>>
>>> Hi,
>>>
>>> I used the steps same as outlined below:
>>>
>>> xxd -p /home/user/myimage.png | tr -d '\n' > /tmp/image.hex
>>> DELETE FROM hexdump; -- hexdump table is: -- CREATE TABLE hexdump
>>> (hex text);
>>> COPY hexdump FROM '/tmp/image.hex';
>>> UPDATE users SET image= (SELECT decode(hex, 'hex') FROM hexdump
>>> LIMIT 1) where id=15489
>>>
>>> Is this the correct way of inserting binary data into bytea column?
>>>
>>> When I fetch a small part of this column, I get output as below:
>>>
>>> select substring(smallblob,0,64) from longdata where blobi d=1;
>>>
>>> \**xd0cf11e0a1b11ae10000000000000**00000000000000000003b000300fef**f09000600000000000
>>> 00000000000010000006a000000000**0000000100000670000 (1 row)
>>>
>>
>> Looks OK to me.
>> Could you send me directly the Mylog output of the simple test case?
>>
>> regards,
>> Hiroshi Inoue
>>
>
>

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Inoue, Hiroshi 2012-02-28 03:43:17 Re: Request for help on retrieving binary data from bytea column using ODBC calls
Previous Message Hiroshi Inoue 2012-02-24 21:47:58 Re: Request for help on retrieving binary data from bytea column using ODBC calls