Problem about ODBC with type bytea and anomal byte 92 - Mailing list pgsql-interfaces

From Massimo Lo iacono
Subject Problem about ODBC with type bytea and anomal byte 92
Date
Msg-id 3A2574FB.973F574D@cpr.it
Whole thread Raw
List pgsql-interfaces
Hy,
excuse me for my bad english:)

we have postgres 7.03 on Linux and an client VB6 on W98 using ODBC
pgsqlodbc 6.5.
We have to handle jpg files.
We have a table so:
 create table prova (     c_path      varchar(15)            not null,     i_num       int4                   not null,
   oid_img     oid                        null );
 

We insert images files on oid field using lo_import('path') so:
 insert into prova values(         '/tmp/ciao.jpg',         1,         lo_import('/tmp/ciao.jpg') );

We have build an shared library, named libpgcrea.so, with a c function:
 extern bytea *getchunk(const Oid oidFd, const int4 len, const int4
pos);

and create an SQL function on c function:
 create function getchunk(oid, int4, int4) returns bytea as '/home/massimo/lib/libpgcrea.so'     language 'C';
 commit;

Then we can run psql and execute:
 select getchunk(prova.oid_img, 0, 8) as datac from prova where i_num = 1;

This return right all the byte of file ciao.jpg.

The problem appears when we run this select from VB client. In this case
the byte 92 (in decimal) is corrupted and so are all bytes following it.

Important(?) The byte 92 is equivalent than '\' character.

On the contrary, all appear right with JDBC driver.

Please help!!!


-- 
Massimo Lo Iacono
Consorzio Pisa Ricerche - gruppo CREA
tel. 0347 7276358 - 050 540027
ITALIA


pgsql-interfaces by date:

Previous
From: Tim Uckun
Date:
Subject: RE: postgreSQL and javascript
Next
From: Constantin Teodorescu
Date:
Subject: Re: PgAccess is available on Mac OS X