X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4ABEDD1B4FC for ; Sun, 21 Sep 2003 09:07:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 45214-05 for ; Sun, 21 Sep 2003 06:07:42 -0300 (ADT) Received: from sd.tpf.co.jp (unknown [210.161.239.34]) by svr1.postgresql.org (Postfix) with SMTP id 5EF71D1B4E3 for ; Sun, 21 Sep 2003 06:07:38 -0300 (ADT) Received: (qmail 17639 invoked from network); 21 Sep 2003 18:07:27 +0900 X-Authentication: inoue was authenticated by tpf.co.jp at 21 Sep 2003 18:07:27 +0900 Received: from unknown (HELO PbgX) (219.61.40.61) by tpf.co.jp with SMTP; 21 Sep 2003 18:07:27 +0900 From: "Hiroshi Inoue" To: "'Albert Graef'" Cc: Subject: Re: problem with multiple result sets Date: Sun, 21 Sep 2003 18:07:25 +0900 Message-ID: <000e01c3801f$c6bc3330$3d283ddb@PbgX> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <3F69D202.2050109@t-online.de> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/89 X-Sequence-Number: 3287 > -----Original Message----- > From: Albert Graef > > ODBC driver version: 7.2.5 > PostgreSQL database version: 7.3.2 > > I'm using the database and odbc driver which ship with SuSE 8.2 > Professional, but the problem is the same with the PostgreSQL > database > and driver on RedHat 9. > > The problem occurs when accessing multiple result sets from a batch > query such as `select * from table1; select * from table2'. > To read back > the result sets, I use a loop involving a call to SQLMoreResults() as > described in the ODBC docs. The basic outline of the loop is > as follows > (with error checking on return values omitted for clarity): > > do { > /* check for the availability of a result set with > SQLNumResultCols() > and get the column titles from the current result set using > SQLDescribeCol() */ > while (SQLFetch(hstmt) != SQL_NO_DATA_FOUND) { > /* get the data from the current row using SQLGetData() */ > } > } while (SQLMoreResults(hstmt) == SQL_SUCCESS); > > I guess that's the right way to do it; I mostly pilfered this > code from > the odbctest program included with iODBC. > > Using this code, I can access single result sets, or multiple > results if > the results are just row counts all right, but when I try to read > multiple result sets from a query like the one above, it seems that > after SQLMoreResults() the cursor is not properly reset to > the first row > in the next result set. Specifically, if the 1st query yields > 8 rows and > the 2nd one 10 rows, then I get all rows from the first > result set, but > only the last one (the 10th row) from the 2nd. Oh I see. I would try to fix it. However, I'm not sure how to fix it in your *nix environment. regards, Hiroshi Inoue