Skip to Content.
Sympa Menu

freetds - RE: re-use of dbprocess structure (was: Re: [freetds] state ofdbrpcsend())

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: re-use of dbprocess structure (was: Re: [freetds] state ofdbrpcsend())
  • Date: Thu, 15 Jul 2004 09:34:07 +0200

>
> On Thu, Jul 08, 2004 at 11:50:58AM +0200, Frediano Ziglio wrote:
>
> > This patch should fix the problem (committed in 0.63, not in 0.62)
>
> Unfortunately, that patch also introduces a bug where stored
> procedures
> with no arguments/paramaters can not be executed. The check to
> ensure malloc() has succeeded catches the case where
> param_info_alloc()
> correctly does to return anything.
>
> Here is a patch that fixes the issue.
>
> --- rpc.c 2004-06-14 09:43:36.000000000 +1000
> +++ rpc.c 2004-07-15 15:23:10.000000000 +1000
> @@ -239,10 +239,22 @@
>
> for (rpc = dbproc->rpc; rpc != NULL; rpc = rpc->next) {
> int erc;
> - TDSPARAMINFO *pparam_info =
> param_info_alloc(dbproc->tds_socket, rpc);
> + TDSPARAMINFO *pparam_info = NULL;
> +
> + /* liam AT inodes.org: allow stored procedures to have no
> + * paramaters
> + */
> + if (rpc->param_list != NULL) {
> + pparam_info =
> param_info_alloc(dbproc->tds_socket, rpc);
> + if (!pparam_info)
> + return FAIL;
> + }
> +
> + erc = tds_submit_rpc(dbproc->tds_socket,
> + dbproc->rpc->name, pparam_info);
> +
> + tds_free_param_results(pparam_info);
>
> - erc = tds_submit_rpc(dbproc->tds_socket,
> dbproc->rpc->name, pparam_info);
> - ;
>
> Can this be commited to CVS please.
>

Committed. Also backported some minor fixes.

> I suspect the source distribution needs some more
> comprehensive RPC unit
> tests. Unless there are any objections, I will write some.
>

Thanks. I don't know if you prefer to extend rpc.c unittests or just
write a new one.
Some hint:
- no parameters
- all input
- some output
- mix named parameters with unnamed ones
- test data (input parameters and output parameters)
- test result code from procedure
- different data types

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page