pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <inoue@tpf.co.jp>
To: Ludek Finstrle <luf@pzkagis.cz>
Cc: pgsql-odbc@postgresql.org
Subject: Re: More strict bind param count checking
Date: Sat, 17 Dec 2005 06:22:34 +0900
Message-ID: <43A3301A.5070406@tpf.co.jp> (raw)
In-Reply-To: <20051216172713.GB22756@soptik.pzkagis.cz>
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>

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, &param_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.




view thread (11+ messages)  latest in thread

Message-ID: <43A3301A.5070406@tpf.co.jp>
Permalink:  ../43A3301A.5070406@tpf.co.jp/
Also on:    postgresql.org/message-id/43A3301A.5070406@tpf.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: inoue@tpf.co.jp, luf@pzkagis.cz
  Subject: Re: More strict bind param count checking
  In-Reply-To: <43A3301A.5070406@tpf.co.jp>
  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> <43A3301A.5070406@tpf.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox