odbc 9.0.200 on delphi

From: Julius Tuskenis <julius(at)nsoft(dot)lt>
To: pgsql-odbc(at)postgresql(dot)org
Subject: odbc 9.0.200 on delphi
Date: 2011-03-17 22:13:15
Message-ID: 4D82877B.9050108@nsoft.lt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hello, postgresql ODBC community

This is my first post so firstly I'd like to thank you for the ODBC
driver. We have several products using it (programming with Delphi 2006
using ADO components (dbGo)).

We are now upgrading Postgresql server to v9, so we had to change odbc
driver from 8.03.04.00 to 9.00.02.00. We observed some interesting
behavior - sometimes the query is executed, but now rows are returned
although we have no such problems executing queries using pgAdmin.

The problem occurs when the string parameter size is left as is (-1 in
Delphi ) and value of 5 characters is passed. If I pass more or less
character string - everything works as expected. Is the number 5 somehow
"magical" in pqsql ODBC ?...

Steps to reproduce:
1. Create a function
CREATE OR REPLACE FUNCTION _test(prm_1 character varying)
RETURNS integer AS
'select 0'
LANGUAGE sql VOLATILE
COST 100;

2. Create a test Delphi program that would have a ADOConnection,
ADOQuery, DataSource and DBGrid. Set the connection parameters, link the
objects.

3. Add SQL to ADOQuery:
select _test(:prm_test ) as kuku;

4. Add button to the project with code in OnClick event
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOConnection1.Connected := false;
ADOQuery1.Parameters[0].Value := '12345';
ADOQuery1.Open;
Caption := IntToStr(ADOQuery1.RecordCount);
end;

5. Execute the program, hit the button, observe the query returning
empty field in DBGrid, Caption becomes '0';

System info:
Server Version string PostgreSQL 9.0.3 on i486-pc-linux-gnu, compiled
by GCC gcc-4.4.real (Debian 4.4.5-10) 4.4.5, 32-bit
Client WinXP SP3
ODBC version 9.00.02.00 (Using PostgreSQL Unicode driver)

I understand It's two systems (odbc and delphi) that are tested, but I
don't know how to test ODBC only... Please advice what should I do about
it. Odbc v8.03.04.00 does not act like this.

Some more notices:
1. If I change OnClict event to
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOConnection1.Connected := false;
ADOQuery1.Parameters[0].Value := '12345';
ADOQuery1.Open;
ADOQuery1.Close;
ADOQuery1.Open;
Caption := IntToStr(ADOQuery1.RecordCount);
end;
Everything works as expected.

2. If I use query without parameters ( select _test('12345' ) as kuku;)
- everything is OK.

3. If I set parameter size of at least 6 result is ok.

I don't know what else to check. If there is a person who is willing to
fix the problem I'd be more than pleased to help. Don't hesitate to ask
for some logs or what ever information you find useful. I can provide
Delphi source for the test application if needed.

--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Julius Tuskenis 2011-03-18 07:23:25 Re: odbc 9.0.200 on delphi
Previous Message Arnaud Lesauvage 2011-03-16 09:20:50 Re: Access Autonumber fields not detected in 9.0.0200