freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] logging public functions
- Date: Mon, 20 Mar 2006 15:36:38 +0100
>
> >
> > For a long time, I've wanted to be able to log every function
> > call made by
> > an application. As an experiment, I wrote the attached
> > script and applied
> > it to dblib.c Some hand editing later, all function calls in
> > db-lib are
> > now logged, with the values of the actual parameters.
> >
> > --jkl
> >
>
> awesome!
> "It's a kind of magic" !!
>
> I saw changes in CVS about logging and checks. I think that
> now there is
> too much tests... It seems that bcp fails (t0016 and t0017 tests), see
> http://freetds.sourceforge.net/out/test/. Also I think that money
> functions has a dbproc parameter only to be able to handle errors so
> dbproc can be NULL.
>
I found the problem
diff -u -1 -0 -r1.144 bcp.c
--- src/dblib/bcp.c 20 Mar 2006 14:01:54 -0000 1.144
+++ src/dblib/bcp.c 20 Mar 2006 14:28:11 -0000
@@ -416,37 +416,38 @@
* \sa bcp_batch(), bcp_bind(), bcp_colfmt_ps(), bcp_collen(),
bcp_colptr(), bcp_columns(),
* bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_sendrow
*/
RETCODE
bcp_colfmt(DBPROCESS * dbproc, int host_colnum, int host_type, int
host_prefixlen, DBINT host_collen, const BYTE * host_term,
int host_termlen, int table_colnum)
{
BCP_HOSTCOLINFO *hostcol;
tdsdump_log(TDS_DBG_FUNC, "bcp_colfmt(%p, %d, %d, %d, %d,
%p)\n",
- dbproc, host_colnum, host_type, host_prefixlen,
host_collen, host_term);
+ dbproc, host_colnum, host_type, host_prefixlen,
(int) host_collen, host_term);
CHECK_PARAMETER(dbproc, SYBENULL);
CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI);
CHECK_PARAMETER(dbproc->hostfileinfo, SYBEBIVI);
/* Microsoft specifies a "file_termlen" of zero if there's no
terminator */
if (dbproc->msdblib && host_termlen == 0)
host_termlen = -1;
if (dbproc->hostfileinfo->host_colcount == 0) {
dbperror(dbproc, SYBEBCBC, 0);
return FAIL;
}
- if (host_colnum < 1)
+ if (host_colnum < 1) {
dbperror(dbproc, SYBEBCFO, 0);
return FAIL;
+ }
if (host_prefixlen != 0 && host_prefixlen != 1 && host_prefixlen
!= 2 && host_prefixlen != 4 && host_prefixlen != -1) {
dbperror(dbproc, SYBEBCPREF, 0);
return FAIL;
}
if (table_colnum <= 0 && host_type == 0) {
dbperror(dbproc, SYBEBCPCTYP, 0);
return FAIL;
}
So bcp_colfmt returned always 0.
However in this strange situation something strange happened: prefix and
column len of all columns were 0 so all columns were NULL. Note however
that no data was readed from file causing an infinite loop where 0 bytes
rows (that is infinite rows) were loaded into server.
I think this is an error condition that should be handled.
freddy77
-
[freetds] logging public functions,
James K. Lowden, 03/17/2006
- <Possible follow-up(s)>
- Re: [freetds] logging public functions, ZIGLIO, Frediano, VF-IT, 03/20/2006
-
Re: [freetds] logging public functions,
ZIGLIO, Frediano, VF-IT, 03/20/2006
- Re: [freetds] logging public functions, James K. Lowden, 03/20/2006
-
Re: [freetds] logging public functions,
ZIGLIO, Frediano, VF-IT, 03/21/2006
- Re: [freetds] logging public functions, James K. Lowden, 03/22/2006
-
Re: [freetds] logging public functions,
ZIGLIO, Frediano, VF-IT, 03/24/2006
- [freetds] nightly tests, James K. Lowden, 03/24/2006
Archive powered by MHonArc 2.6.24.