pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Byron Nikolaidis <byronn@insightdist.com>
To: Andrzej Szydlo <andrzej@maciek.gv.edu.pl>
Cc: pgsql-interfaces@hub.org
Subject: Re: [INTERFACES] ODBC, Delphi and BLOBs (images)
Date: Tue, 18 Aug 1998 15:34:44 -0400
Message-ID: <35D9D754.F00E9F98@insightdist.com> (raw)
References: <Pine.BSF.3.96.980818191706.9350A-100000@maciek.gv.edu.pl>

It seems that the error handling in the _SQLFetch routine was a little
behind the times, which is confusing things even more and producing the
"unrecognized return value from copy_and_convert...".

I have fixed the error handling code so that it should hopefully return a
better description of the problem.

FYI, there are three possibilities that can cause the 0 to appear:

1. The large object couldn't be opened
2. The large object couldn't be read
3. Something is wrong/incompatible with the multiple GetData calls.

I'm gonna send you the new driver with the better error handling to try in
another mailing.

Byron


Andrzej Szydlo wrote:

> Hello,
>
> I'm trying to access PostgreSQL database from Delphi via ODBC.
> Everything works fast and reliably. The only problem are BLOBs,
> images in this case.
>
> I created the "lo" type according to the FAQ:
>
>      create type lo (
>      internallength=4,  externallength=10,
>      input=int4in, output=int4out,
>      default='',  passedbyvalue
>      );
>
> and then created a table and an index:
>
> CREATE TABLE test_tab(nr int4, img lo);
> CREATE UNIQUE INDEX test_inx ON test_tab (nr);
>
> I attached a DBImage control to the "img" field and DBEdit to "nr"
>
> When I insert "images" to the table manually, later  Delphi displays
> it without any problem.
>
> When I try to insert any image from Dephi, the value "0" is inserted
> instead of any real OID value, which causes:
>
>  "Unrecognized return value from copy_and_convert_field."
>
> on a select attempt.
>
> What can cause "0" to be inserted instead of any value, say 16648?
> Have anyone ever had similar problem? How can it be solved?
>
> It seems that the problem is caused by the Delphi-ODBC interaction.
> With Access everything works well.
>
> If the information I gave here is not precise enough or unclear,
> please ask me for any extra details.
>
> I'd appreciate any suggestions pointing me to the right direction.
>
> Here are software versions and logs:
>
> Delphi: 2.0
> BDE: 4.51
> Postgres - ODBC: 6.30.0248
> Postgres: 6.3.2
> ODBC Admin: 3.0.23.1
>
> In case of UPDATE the psqlodbc.log looks like this:
>
> conn=44173436, query='SELECT "img" FROM "test_tab" WHERE "nr"=255'
>     [ fetched 1 rows ]
> conn=44173436, query='BEGIN'
> conn=44173436, query='UPDATE "test_tab" SET "img"=0 WHERE "nr"=255'
>                                              ^^^^^^
>                                              why 0?
> conn=44173436, query='COMMIT'
> conn=44173436, query='SELECT "img" FROM "test_tab" WHERE "nr"=255'
>     [ fetched 1 rows ]
> STATEMENT ERROR: func=SQLFetch, desc='', errnum=8, errmsg='Unrecognized
> return
> value from copy_and_convert_field.'
>
> Andrzej






view thread (7+ messages)  latest in thread

Message-ID: <35D9D754.F00E9F98@insightdist.com>
Permalink:  ../35D9D754.F00E9F98@insightdist.com/
Also on:    postgresql.org/message-id/35D9D754.F00E9F98@insightdist.com

 · 

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: byronn@insightdist.com, andrzej@maciek.gv.edu.pl, pgsql-interfaces@hub.org
  Subject: Re: [INTERFACES] ODBC, Delphi and BLOBs (images)
  In-Reply-To: <35D9D754.F00E9F98@insightdist.com>

* 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