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

Re: [INTERFACES] bug in ODBC driver ?

From: Byron Nikolaidis <byronn(at)insightdist(dot)com>
To: Sergio Kessler <ser(at)perio(dot)unlp(dot)edu(dot)ar>
Cc: Pgsql-Interfaces <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] bug in ODBC driver ?
Date: 1998-12-14 17:53:52
Message-ID: 367550B0.94492CE2@insightdist.com (view raw or flat)
Thread:
Lists: pgsql-interfaces

Sergio Kessler wrote:

> Hi (Byron ?),
>
> I think I've found a bug in the postODBC driver, version
> 6.40.0001.
>
> The problem is with the function SQLGetData.
>
> According to the docs of ODBC, when retrieving long data
> (blobs), if the buffer is not enough, this function must
> return SQL_SUCCESS_WITH_INFO and SQLSTATE 01004
> (String data, right truncated) and in the variable
> length_or_ind, it must return the _remaining_ byte
> length of the data.
>
> The function is not working this way, ie I call it
> (in Delphi):
>
> SQLGetData( hstmt, FieldNo, SQL_BINARY, PChar(TargetValue),
>             15, @strlen_or_ind);
>
> Note that I put 15 as the buffer size, I _know_ that the
> total size of the field (a text field in postgres) is 23
> bytes, so this call must return SQL_SUCCESS_WITH_INFO
> and SQLSTATE 01004 and the value of strlen_or_ind must
> be 8.
> But it return SQL_SUCCESS and strlen_or_ind = 23.
>
> Also, the driver, don't must write more bytes than
> the buffer size, ie. if the buffer size is 15 the
> driver should write no more than 15 bytes.
>
> Maybe this is the cause why other people are insulting the
> BDE with blob fields (I don't use the BDE, btw)
>
> Hope this help.
>

Well, I looked into this.

First, the multiple call logic *only* works on LONGVARBINARY fields.  In
other words, you can only call SQLGetData multiple times for a field if
its a Large Object type.  (At the time, this addition was awesome). It
will not work on BINARY, or VARBINARY.  For those, it will simply return
SQL_SUCCESS (it should return SQL_SUCCESS_WITH_INFO and data truncated).

Second, if you do try to use multiple calls on LONGVARBINARY, it works,
but it returns SQL_NO_TOTAL for the amount remaining.  Even though this
is not very useful, it is valid according to the odbc spec if the driver
doesn't know how much is left.

So there really is nothing wrong, except the return for binary and
varbinary types.  However, time permitting,  I will try to enhance the
shortcomings in this area.

Byron



In response to

Responses

pgsql-interfaces by date

Next:From: Byron NikolaidisDate: 1998-12-14 20:17:49
Subject: Re: [INTERFACES] bug in ODBC driver ?
Previous:From: SergioDate: 1998-12-14 17:24:49
Subject: Re: [INTERFACES] bug in ODBC driver ?

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