Skip to Content.
Sympa Menu

freetds - RE: [freetds] big commit: language command variable support added

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] big commit: language command variable support added
  • Date: Wed, 12 Mar 2003 08:46:19 -0000

Mark,

I've discovered a small issue with the code you changed in token.c
(version 1.51, "added support for sending variables/parameters with a
language command via ctlib. required changes to tds layer")

You've added the line :

tds_process_result_tokens(TDSSOCKET * tds, TDS_INT * result_type)
{
int marker;
int done_flags;

if (tds->state == TDS_COMPLETED) {
tdsdump_log(TDS_DBG_FUNC, "%L inside tds_process_result_tokens()
state is COMPLETED\n");
*result_type = TDS_CMD_DONE;
return TDS_NO_MORE_RESULTS;
}

+ tds->curr_resinfo = NULL;
for (;;) {

to the top of tds_process_result_tokens.

As a result, I have a problem with sqsh 1.7

When you submit a query "select * from table where 1 = 2"
sqsh should display the column headings. It no longer does so.
The sequence of events is as follows:

sqsh calls ct_results(). This reads the RESULTS token by calling
tds_process_result_tokens, setting tds->curr_resinfo to tds->resinfo as it
does so.
It then reads the next token , again by calling tds_process_result_tokens,
but tds->curr_resinfo is set to NULL as it does so.
The next token it reads is an end token. the tds_process_end() function does
not do anything with tds->curr_resinfo, so it is left as NULL.
control is now passed back to the calling program, which then calls
ct_res_info(CS_NUMDATA) to return the number of columns.
because tds->curr_resinfo is still set to NULL, ct_res_info returns 0 as the
number of columns, hence no column headers.

can you remember the reason for setting tds->curr_resinfo to NULL at the top
of tds_process_result_tokens ?
I'm not sure whether to take this out, or to find a place to set it properly
to cover this circumstance...

regards,

Bill

> -----Original Message-----
> From: Mark J. Lilback [SMTP:mark AT lilback.com]
> Sent: 07 March 2003 13:33
> To: FreeTDS Development Group
> Subject: Re: [freetds] big commit: language command variable support
> added
>
> At 7:59 AM +0100 3/7/2003, Frediano Ziglio wrote:
> >Why BITN are treated like numeric? Does ct_convert ignore destination
> >length for fixed types?
>
> Yes. Pretty much every ctlib function is suppose to ignore
> destination lengths for fixed types.
>
> >Also, to support the same on TDS7/8: use mix prepare and execute code
> >and call sp_prepexec RPC (it do something like sp_prepare, sp_execute,
> >sp_unprepare), see code in query.c.
>
> The links you sent on sp_executesql seem like the best solution. I
> was looking at changing the sql to include declare and sets for each
> variable, but that is a much better solution. More of a pain than
> what Sybase offers, but it should be workable.
>
> --
> __________________________________________________________________________
> "They that can give up essential
> liberty
> Mark J. Lilback to obtain a little temporary safety
> <mark AT lilback.com> deserve neither liberty or safety."
> http://www.lilback.com/ -- Benjamin Franklin
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page