Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrTyv-00057H-Dx for pgsql-odbc@arkaria.postgresql.org; Mon, 02 Jun 2014 15:17:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrTyu-0001Et-0M for pgsql-odbc@arkaria.postgresql.org; Mon, 02 Jun 2014 15:17:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WrTyt-0001Em-24 for pgsql-odbc@postgresql.org; Mon, 02 Jun 2014 15:16:59 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrTyp-0002d3-J7 for pgsql-odbc@postgresql.org; Mon, 02 Jun 2014 15:16:57 +0000 Received: (qmail 28130 invoked by uid 512); 2 Jun 2014 15:16:54 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 2 Jun 2014 15:16:54 -0000 Received: from unknown (HELO ?192.168.1.4?) (183.76.63.174) by sd.tpf.co.jp with SMTP; 2 Jun 2014 15:16:54 -0000 Message-ID: <538C9563.7020401@tpf.co.jp> Date: Tue, 03 Jun 2014 00:16:51 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: lev.bukovski@teliasonera.com, pgsql-odbc@postgresql.org Subject: Re: Prepared statement error with UseServerSidePrepare=1 References: <619ABD714EEDD84E8E582E993559DB36142ADA8C@EXMB12TSTRZ2.tcad.telia.se> <538BF6A0.1020404@tpf.co.jp> <619ABD714EEDD84E8E582E993559DB36142AFEB6@EXMB12TSTRZ2.tcad.telia.se> In-Reply-To: <619ABD714EEDD84E8E582E993559DB36142AFEB6@EXMB12TSTRZ2.tcad.telia.se> Content-Type: multipart/mixed; boundary="------------080809080905000202020600" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --------------080809080905000202020600 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit (2014/06/02 22:11), lev.bukovski@teliasonera.com wrote: > Hi Hiroshi, > > I applied your patch on psqlodbc 9.3.3 (NOT on the head branch). > Now I can't even get to insert operations, because I get error while application configuration fetch. > > I have this CONFIG table, from where I load configuration parameters (SELECT VALUE2, VALUE3 FROM CONFIG WHERE VALUE1 = ?) > Each execute of the SQL returns one row. So the first execute success, but second returns with 'Null statement result in PGAPI_ExtendedFetch' error. > > psqlodbc and mylog files are in attechaments. Thanks for the report. Please apply the attached patch also. It's the same as the one attached in the thread [ODBC] Problems using SQLFetch on prepared INSERT with RETURNING clause . regards, Hiroshi Inoue --------------080809080905000202020600 Content-Type: text/x-patch; name="insertreturning_twice.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="insertreturning_twice.patch" diff --git a/statement.c b/statement.c index 0aa31ce..4bbf132 100644 --- a/statement.c +++ b/statement.c @@ -317,6 +317,7 @@ PGAPI_FreeStmt(HSTMT hstmt, { return SQL_ERROR; } + SC_set_Curres(stmt, NULL); } else if (fOption == SQL_RESET_PARAMS) SC_free_params(stmt, STMT_FREE_PARAMS_ALL); @@ -2260,6 +2261,8 @@ inolog("res->next=%p\n", tres); last->next = res; self->curr_param_result = 1; } + if (NULL == SC_get_Curres(self)) + SC_set_Curres(self, SC_get_Result(self)); ipdopts = SC_get_IPDF(self); has_out_para = FALSE; --------------080809080905000202020600 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --------------080809080905000202020600--