Обсуждение: call to PostgreSQL function executed twice ?

Поиск
Список
Период
Сортировка

call to PostgreSQL function executed twice ?

От
"Jan van der Weijde"
Дата:
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

 

 
Вложения