X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8B6039DC9F4 for ; Fri, 16 Dec 2005 17:22:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47779-06 for ; Fri, 16 Dec 2005 17:22:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id E118E9DC84E for ; Fri, 16 Dec 2005 17:22:35 -0400 (AST) Received: (qmail 12028 invoked from network); 17 Dec 2005 06:22:35 +0900 X-Authentication: inoue was authenticated by dns.tpf.co.jp at 17 Dec 2005 06:22:35 +0900 Received: from unknown (HELO ?192.168.11.2?) (219.61.40.10) by dns.tpf.co.jp with SMTP; 17 Dec 2005 06:22:35 +0900 Message-ID: <43A3301A.5070406@tpf.co.jp> Date: Sat, 17 Dec 2005 06:22:34 +0900 From: Hiroshi Inoue User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: ja, en-us, en MIME-Version: 1.0 To: Ludek Finstrle CC: pgsql-odbc@postgresql.org Subject: Re: More strict bind param count checking References: <20051214002452.GA9345@soptik.pzkagis.cz> <43A0EE2D.8090702@tpf.co.jp> <20051215051256.GA21336@soptik.pzkagis.cz> <43A10178.5070107@tpf.co.jp> <20051216172713.GB22756@soptik.pzkagis.cz> In-Reply-To: <20051216172713.GB22756@soptik.pzkagis.cz> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/215 X-Sequence-Number: 6694 Ludek Finstrle wrote: >>>We have problems with Visual FoxPro. It calls SQLCancel without >>>FreeStmt(SQL_RESET_PARAMS). It leads to failure becouse next >>>ExecDirect with fewer parameters in some cases think that it >>>has data_at_exec (which was parameters from previous). >>> >>> >>Isn't it the right solution for the problem to check data_at_exec >>appropriately ? >> >> > >Please Hiroshi could you take a look on solution for data_at_exec check? >I see no problem but I didn't see it in previous patch also. > >Thanks a lot > >Luf > > >------------------------------------------------------------------------ > >diff -c psqlodbc.orig\execute.c psqlodbc\execute.c >*** psqlodbc.orig\execute.c Tue Dec 06 21:53:30 2005 >--- psqlodbc\execute.c Fri Dec 16 18:11:16 2005 >*************** >*** 542,547 **** >--- 542,548 ---- > UInt4 offset = apdopts->param_offset_ptr ? *apdopts->param_offset_ptr : 0; > Int4 bind_size = apdopts->param_bind_type; > Int4 current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row; >+ SWORD param_count; > > /* > * Increment the number of currently processed rows >*************** >*** 549,555 **** > if (ipdopts->param_processed_ptr) > (*ipdopts->param_processed_ptr)++; > stmt->data_at_exec = -1; >! for (i = 0; i < apdopts->allocated; i++) > { > Int4 *pcVal = apdopts->parameters[i].used; > >--- 550,559 ---- > if (ipdopts->param_processed_ptr) > (*ipdopts->param_processed_ptr)++; > stmt->data_at_exec = -1; >! /* Check bind parameters count */ >! if (SQL_SUCCESS != PGAPI_NumParams(stmt, ¶m_count)) >! return SQL_ERROR; >! for (i = 0; i < param_count; i++) > > Looks pretty good to me. It's more safe to adjust the param_count in case of apdopts->allocated < param_count. Also it's safe to change the following code in PGAPI_ParamData. /* At least 1 data at execution parameter, so Fill in the token value */ for (; i < apdopts->allocated; i++) regars, Hiroshi Inoue.