From: Julius Tuskenis <julius@nsoft.lt>
To: pgsql-odbc@postgresql.org
Subject: odbc 9.0.200 on delphi
Date: Fri, 18 Mar 2011 00:13:15 +0200
Message-ID: <4D82877B.9050108@nsoft.lt> (raw)
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: julius@nsoft.lt
Subject: Re: odbc 9.0.200 on delphi
In-Reply-To: <4D82877B.9050108@nsoft.lt>
References: <4D82877B.9050108@nsoft.lt>
* 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