data-at-execute param number error

[email protected]
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.