[freetds] BCP performance

Craig A. Berry craigberry at mac.com
Thu Feb 6 17:20:50 EST 2003


At 4:55 PM -0500 2/5/03, Lowden, James K wrote:
>
>The assert should express:
>
>	if host_term is not null then host_termlen >= 0
>	if host_term is null,  then host_termlen == -1
>
>But if host_termlen is -1 the value of host_term is moot, really.  Perhaps:
>
>	assert ((host_termlen >= 0)? (host_term != NULL) : (host_term ==
>-1));
>
>expresses it better. 

In your revised assert(), when host_termlen == 0, host_term is
required to be non-null, but if I understood your explanation, that's
the normal state of affairs for Microsoft servers when host_term is
not present.  I *think* what you need is this (or some less verbose
expression of the same logic):

--- src/dblib/bcp.c;-0	Wed Feb  5 13:17:08 2003
+++ src/dblib/bcp.c	Thu Feb  6 17:15:28 2003
@@ -309,7 +309,10 @@
 		return FAIL;
 
 	/* if there's a valid terminator, it needs a nonzero length.  If there's no terminator, its length should show that.  */
-	assert ((host_term != NULL && host_termlen >= 0) || (host_term == NULL && host_termlen == -1));
+	assert ((host_term != NULL)
+		? (host_termlen > 0)
+		  : ((host_termlen == -1)	/* Sybase says no terminator */
+		    || (host_termlen == 0)));	/* Microsoft says no terminator */
 
 	hostcol = dbproc->host_columns[host_colnum - 1];
 
[end of patch]

t0017 stops blowing up for me when I do that.

-- 
________________________________________
Craig A. Berry
mailto:craigberry at mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser



More information about the FreeTDS mailing list