Skip site navigation (1) Skip section navigation (2)

Problem about ODBC with type bytea and anomal byte 92

From: Massimo Lo iacono <m(dot)loiacono(at)cpr(dot)it>
To: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Problem about ODBC with type bytea and anomal byte 92
Date: 2000-11-29 21:28:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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(

We have build an shared library, named, with a c function:

  extern bytea *getchunk(const Oid oidFd, const int4 len, const int4

and create an SQL function on c function:

  create function getchunk(oid, int4, int4)
  returns bytea
  as '/home/massimo/lib/'
      language 'C';


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

pgsql-interfaces by date

Next:From: Constantin TeodorescuDate: 2000-11-30 07:45:43
Subject: Re: PgAccess is available on Mac OS X
Previous:From: Tim UckunDate: 2000-11-29 19:00:56
Subject: RE: postgreSQL and javascript

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group