Skip to Content.
Sympa Menu

freetds - RE: [freetds] Re: Bug in Code ? (dbih_setup_fbav: invalid number of fields)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Re: Bug in Code ? (dbih_setup_fbav: invalid number of fields)
  • Date: 02 Jan 2003 19:13:39 +0100

Il gio, 2003-01-02 alle 16:06, Lowden, James K ha scritto:
> > From: Daniel Schwager [mailto:Daniel.Schwager AT dtnet.de]
> > Sent: January 2, 2003 5:23 AM
> > >
> > > Commited two lines to CVS. Will be in tomorrow's snapshot.
> >
> > here is the new freetds.log.
>
> Hi Daniel,
>
> Thanks. The log is very clear:
>
> 2003-01-02 10:52:09.625412 ct_res_info(): Number of columns is -14344
>
> means we're telling perl there are -14344 columns. Perl correctly guesses
> that "NUM_OF_FIELDS attribute [is] probably not set right".
>
> I don't know why yet.
>
> > Is it possible start writing
> > the Logfile with showing the FreeTDS-Library Version ?
>
> I would like to do something like that, but there is no "FreeTDS-Library
> Version" that can be automatically incremented. All we have are the CSV
> revision numbers and dates, which are per-file (not per library). If the
> Makefile would somehow sift through the various modules and record the
> latest commit date to a public variable, we could use that to stamp the log.
> Or perhaps we could grab the first line of the ChangeLog (or even its date).
> But for the moment we're stuck, afaik. :(
>

I wrote a small patch that should fix some issue... attached but not
tested... is generate a dummy row with returned status.

Other problem is related to ct_describe that return still 7 columns... this
is caused by not deleting results at DONE but on next query... see also Bill
main (I didn't find it...)

freddy77

Index: src/ctlib/ct.c
===================================================================
RCS file: /cvsroot/freetds/freetds/src/ctlib/ct.c,v
retrieving revision 1.64
diff -u -u -1 -0 -b -r1.64 ct.c
--- src/ctlib/ct.c	2 Jan 2003 01:59:52 -0000	1.64
+++ src/ctlib/ct.c	2 Jan 2003 18:01:47 -0000
@@ -508,20 +508,22 @@
 CS_RETCODE
 ct_results(CS_COMMAND * cmd, CS_INT * result_type)
 {
 TDSSOCKET *tds;
 CS_CONTEXT *context;
 
 int tdsret;
 int rowtype;
 int computeid;
 CS_INT res_type;
+TDSRESULTINFO* resinfo;
+TDSCOLINFO* curcol;
 
 	tdsdump_log(TDS_DBG_FUNC, "%L inside ct_results()\n");
 
 	context = cmd->con->ctx;
 
 	if (cmd->dynamic_cmd) {
 		return ct_results_dyn(cmd, result_type);
 	}
 
 	tds = cmd->con->tds_socket;
@@ -584,22 +586,42 @@
 				/* results or not...                          */
 
 				if (tds->res_info)
 					*result_type = CS_CMD_DONE;
 				else
 					*result_type = CS_CMD_SUCCEED;
 
 				return CS_SUCCEED;
 				break;
 
-
 			case CS_STATUS_RESULT:
+				*result_type = res_type;
+
+				/* build a false row containing returned status */
+				if (tds->res_info)
+					tds_free_results(tds->res_info);
+				resinfo = tds_alloc_results(1);
+				tds->res_info = tds->curr_resinfo = resinfo;
+				if (!resinfo)
+					return CS_FAIL;
+				curcol = resinfo->columns[0];
+				tds_set_column_type(curcol, SYBINT4);
+				curcol->column_offset = resinfo->row_size;
+				resinfo->row_size += sizeof(TDS_INT);
+				resinfo->current_row = tds_alloc_row(resinfo);
+				if (!resinfo->current_row)
+					return CS_FAIL;
+				*((TDS_INT*)&resinfo->current_row[curcol->column_offset]) = tds->ret_status;
+				cmd->row_prefetched = 1;
+				return CS_SUCCEED;
+				break;
+
 			default:
 				*result_type = res_type;
 				return CS_SUCCEED;
 				break;
 			}
 			break;
 		case TDS_NO_MORE_RESULTS:
 			return CS_END_RESULTS;
 			break;
 		case TDS_FAIL:
 



Archive powered by MHonArc 2.6.24.

Top of Page