[freetds] bcp missing patch chunk.

Christos Zoulas christos at zoulas.com
Mon Jan 5 17:30:30 EST 2004


So I dowloaded the rc2 version [please bump the version in the future
if you make changes, there seem to be too many rc2's now]. The one in
nightly compiles, the one that is marked release candidate does not.

I found that a chunk of the patch that I sent was not applied, and I
think I sent the second chunk in another patch today that should fix
freddy's problem. The first part absolutely necessary. The second is
untested and should only affect tds < 7.0.

christos

Index: bcp.c
===================================================================
RCS file: /src/twosigma/cvsroot/pub/devel/freetds/src/dblib/bcp.c,v
retrieving revision 1.1.1.6
diff -u -u -r1.1.1.6 bcp.c
--- bcp.c	5 Jan 2004 19:24:25 -0000	1.1.1.6
+++ bcp.c	5 Jan 2004 22:27:35 -0000
@@ -994,6 +994,10 @@
 					return (FAIL);
 				}
 				collen = len;
+				if (collen == -1) {
+					collen = 0;
+					data_is_null = 1;
+				}
 			}
 			coldata = (BYTE *) calloc(1, 1 + collen);
 			if (coldata == NULL) {
@@ -1275,9 +1279,12 @@
 				memcpy(&rowbuffer[row_pos], num->array, cpbytes);
 			} else {
 				/* compute the length to copy to the row ** buffer */
-
-				cpbytes = bcpcol->data_size > bcpcol->db_length ? bcpcol->db_length : bcpcol->data_size;
-				memcpy(&rowbuffer[row_pos], bcpcol->data, cpbytes);
+				if (bcpcol->data_size == -1) {
+					cpbytes = 0;
+				} else {
+					cpbytes = bcpcol->data_size > bcpcol->db_length ? bcpcol->db_length : bcpcol->data_size;
+					memcpy(&rowbuffer[row_pos], bcpcol->data, cpbytes);
+				}
 
 			}
 


More information about the FreeTDS mailing list