call to PostgreSQL function executed twice ? - Mailing list pgsql-odbc

From Jan van der Weijde
Subject call to PostgreSQL function executed twice ?
Date
Msg-id 4B9C73D1EB78FE4A81475AE8A553B3C60780BB@exch-lei1.attachmate.com
Whole thread Raw
List pgsql-odbc
Hello,
 
I have an ODBC C-program that executes a call to a PostgreSQL function called testprocedure.
The call is first prepared, using SQLPrepare(). Next SQLNumResultCols() and SQLDescribeCol() are used to get information about the result of the call.
Finally SQLExecute() is called to execute the call to the procedure.
The result now is that two records are inserted into table test, with other words the PostgreSQL function testprocedure is called twice!
 
I use the next procedure:
 
CREATE OR REPLACE FUNCTION testprocedure("varchar") RETURNS void AS $$
BEGIN
insert into test values($1);
end;
$$
language 'plpgsql';
 
And the prepared and executed call is "select testProcedure('vib') as strout"
 
I use PostgreSQL 8.1.4 on Windows XP professional and ODBC Driver 'PostgreSQL ANSI', version 8.01.02.00 from the PostgreSQL Global Deveopment Group
 
It turns out, that SQLNumResultCols() or SQLDescribeCol() also execute the call. And that the call to SQLExecute() then executes it a second time. 
When I leave SQLNumResultCols() out,  SQLDescribeCol() will execute the statement and the other way around.
 
Is this a bug or do I do something wrong?
From what I understand from the ODBC documentation, only SQLExecute() should execute a prepared function call.
 
Thank you,
Jan
 
Jan Ch. van der Weijde
Senior Software Engineer

Schipholweg 103
2316 XC  Leiden
The Netherlands
+31 71 368 1173 phone
+31 71 368 1181 fax
Jan.van.der.Weijde@attachmate.com

www.attachmate.com

 

 
Attachment

pgsql-odbc by date:

Previous
From: Richard Wesley
Date:
Subject: List databases using ODBC through OLE DB
Next
From:
Date:
Subject: [ psqlodbc-Bugs-1000706 ] SQLTables SQL_ALL_TABLE_TYPES return code 100