Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UIJvP-0003Zq-G4 for pgsql-odbc@arkaria.postgresql.org; Wed, 20 Mar 2013 14:23:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UIJvO-0007Qu-9e for pgsql-odbc@arkaria.postgresql.org; Wed, 20 Mar 2013 14:23:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UIJvF-0007Ji-G9 for pgsql-odbc@postgresql.org; Wed, 20 Mar 2013 14:23:21 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UIJv6-0005VZ-Bu for pgsql-odbc@postgresql.org; Wed, 20 Mar 2013 14:23:21 +0000 Received: (qmail 27396 invoked by uid 512); 20 Mar 2013 14:23:07 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 20 Mar 2013 14:23:07 -0000 Received: from unknown (HELO ?192.168.1.4?) (183.76.63.59) by sd.tpf.co.jp with SMTP; 20 Mar 2013 14:23:07 -0000 Message-ID: <5149C649.506@tpf.co.jp> Date: Wed, 20 Mar 2013 23:23:05 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Heikki Linnakangas CC: pgsql-odbc@postgresql.org Subject: Re: SQLExecute returns 0 rows with BoolsAsChar=1 References: <51479445.7020905@vmware.com> <514979A7.4060005@tpf.co.jp> <5149B3C7.5030109@vmware.com> In-Reply-To: <5149B3C7.5030109@vmware.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -4.4 (----) 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 (2013/03/20 22:04), Heikki Linnakangas wrote: > On 20.03.2013 10:56, Hiroshi Inoue wrote: >> Hi, >> >> (2013/03/19 7:25), Heikki Linnakangas wrote: >>> If you SQLPrepare a query, and bind a VARCHAR parameter with column_size >>> of exactly 5, and you have BoolsAsChar=1 (which is the default), the >>> subsequent SQLExecute will return 0 rows. >>> >>> With those conditions, HowToPrepareBeforeExec returns shouldExec, which >>> means that the query is sent to the server to be parse, in a Parse >>> message. PGAPI_Execute() calls HowToPrepareBeforeExec, and calls >>> prepareParameters(), which sends the Parse message, and reads the >>> resulting ParameterDescription messages from the server. It also creates >>> a new QResultClass object, and stores it as the statement's result. Now, >>> when PGAPI_Execute() proceeds to execute the statement for real, it >>> doesn't clear the dummy result set created by prepareParameters(), but >>> just appends the real result set to the statement object's chain of >>> results. When SQLExecute() returns, the first result set (the one that >>> the application cares about) is the dummy one, with 0 rows. >>> >>> As a quick fix, but which I believe is quite safe and correct anyway, is >> >> I don't think it's safe. >> It's in the middle of handling an array of parameter set and may >> go back to next_param_row label. > > Ah, I see. > >> In addtion, apps may get out of PGAPI_Execute() in the middle of >> paramater handling when there are data at execution parameters. > > Hmm, I don't think that's a problem. Even with data-at-execution > parameters, the statement is only really going to be executed once. The statement may be executed many (at most parameter set array size) times in the current implementation. > Until all data-at-execution parameters have filled in by the > application, PGAPI_Execute() won't actually execute the statement, it > will just return SQL_NEED_DATA. It's OK to reset the result set between > those PGAPI_Execute() calls - there shouldn't be any results yet. The > last PGAPI_Execute() call produces all the result sets. -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc