Re: More strict bind param count checking
От | Hiroshi Inoue |
---|---|
Тема | Re: More strict bind param count checking |
Дата | |
Msg-id | 43A3301A.5070406@tpf.co.jp обсуждение исходный текст |
Ответ на | Re: More strict bind param count checking (Ludek Finstrle <luf@pzkagis.cz>) |
Ответы |
Re: More strict bind param count checking
|
Список | pgsql-odbc |
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.
В списке pgsql-odbc по дате отправления: