Skip to Content.
Sympa Menu

freetds - [freetds] data-at-execute param number error

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: wigyxz-freetds AT yahoo.com
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] data-at-execute param number error
  • Date: Wed, 22 Sep 2010 08:56:49 -0700 (PDT)

Hi all,

I"ve been trying to execute some ODBC code to invoke a stored procedure
where with one parameter, SQLBindParameter() is used to send the
parameter data in a data-at-execute manner. I believe initially had
thought this might be necessary as the parameter is a potentially
lengthy text string.

Anyhow, after I call SQLExecute(), I'm getting an error when I call
SQLParamData() when I am trying to send the parameter data.

What I'm seeing down in the driver code is that in prepare_query.c
the call to prepared_rpc() is returning SQL_ERROR in this part of the
code:

...
case '?':
/* find binded parameter */
if (stmt->param_num > stmt->apd->header.sql_desc_count
|| stmt->param_num > stmt->ipd->header.sql_desc_count) {
tds_free_param_result(temp_params);
/* TODO set error */
return SQL_ERROR;
}

In my case, stmt->param_num is +1 greater than both the apd and ipd
header.sql_desc_count. My stored procedure has 3 parameters, but
param_num has been incremented to 4 at this point hence the error.

I've seen some comments in the archives that some data-at-execute
functionality may be lacking, but perhaps my code is just wrong.
Some insights would be much appreciated. I can post a simplified
version of my call if that helps.

In any case, I seem to be able to provide my long strings as
parameters in an immediate style rather than data-at-exec so perhaps
I don't need this anyway.

thanks.







Archive powered by MHonArc 2.6.24.

Top of Page