pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Massimo Lo iacono <m.loiacono@cpr.it>
To: pgsql-interfaces@postgresql.org <pgsql-interfaces@postgresql.org>
Subject: Problem about ODBC with type bytea and anomal byte 92
Date: Wed, 29 Nov 2000 22:28:27 +0100
Message-ID: <3A2574FB.973F574D@cpr.it> (raw)

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



Message-ID: <3A2574FB.973F574D@cpr.it>
Permalink:  ../3A2574FB.973F574D@cpr.it/
Also on:    postgresql.org/message-id/3A2574FB.973F574D@cpr.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: m.loiacono@cpr.it
  Subject: Re: Problem about ODBC with type bytea and anomal byte 92
  In-Reply-To: <3A2574FB.973F574D@cpr.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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