changeset 1422:063222328572

upgrade package freetds to cvs
author Mark Brand <mabrand@mabrand.nl>
date Fri, 26 Nov 2010 16:11:23 +0100
parents 007b72759805
children 37a4c4febabd
files src/freetds-1-fastforward.patch
diffstat 1 files changed, 393 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/freetds-1-fastforward.patch	Fri Nov 26 15:50:52 2010 +0100
+++ b/src/freetds-1-fastforward.patch	Fri Nov 26 16:11:23 2010 +0100
@@ -158778,3 +158778,396 @@
  	for (i = 0; i < nparams; ++i) {
  		if (tds_dstr_isempty(&params[i].value) && params[i].type != 'V')
  			continue;
+
+commit c0328b6cc569930eeddc96d1a5de9a3829214703
+Author: freddy77 <freddy77>
+Date:   Fri Nov 26 08:41:26 2010 +0000
+
+    add and use IS_TDS72_PLUS
+
+diff --git a/ChangeLog b/ChangeLog
+index fa9be02..99f1c67 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,8 @@
++Fri Nov 26 09:40:25 CET 2010    Frediano Ziglio <freddy77_A_gmail_D_com>
++	* include/tds.h src/server/server.c src/tds/bulk.c src/tds/data.c:
++	* src/tds/login.c src/tds/query.c src/tds/token.c:
++	- add and use IS_TDS72_PLUS
++
+ Thu Nov 25 20:31:38 CET 2010    Frediano Ziglio <freddy77_A_gmail_D_com>
+ 	* src/odbc/odbc.c:
+ 	- remove additional space from statistic procedure names
+@@ -3018,4 +3023,4 @@ Wed Jan  9 19:54:43 EST 2008	JK Lowden <jklowden@freetds.org>
+ 	* ChangeLog-0.82 added because of release
+ 	
+ $FreeTDS$
+-$Id: ChangeLog,v 1.3160 2010/11/25 19:31:49 freddy77 Exp $
++$Id: ChangeLog,v 1.3161 2010/11/26 08:41:26 freddy77 Exp $
+diff --git a/include/tds.h b/include/tds.h
+index dba4cfa..64d9f82 100644
+--- a/include/tds.h
++++ b/include/tds.h
+@@ -21,7 +21,7 @@
+ #ifndef _tds_h_
+ #define _tds_h_
+ 
+-/* $Id: tds.h,v 1.344 2010/11/09 15:46:42 freddy77 Exp $ */
++/* $Id: tds.h,v 1.345 2010/11/26 08:41:26 freddy77 Exp $ */
+ 
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -1646,6 +1646,7 @@ int tds_writetext_end(TDSSOCKET *tds);
+ 
+ #define IS_TDS7_PLUS(x) ((x)->tds_version>=0x700)
+ #define IS_TDS71_PLUS(x) ((x)->tds_version>=0x701)
++#define IS_TDS72_PLUS(x) ((x)->tds_version>=0x702)
+ 
+ #define TDS_MAJOR(x) ((x)->tds_version >> 8)
+ #define TDS_MINOR(x) ((x)->tds_version & 0xff)
+diff --git a/src/server/server.c b/src/server/server.c
+index 13ba955..ffb066f 100644
+--- a/src/server/server.c
++++ b/src/server/server.c
+@@ -1,5 +1,6 @@
+ /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
+  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
++ * Copyright (C) 2010  Frediano Ziglio
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+@@ -30,7 +31,7 @@
+ #include "tds.h"
+ #include "tdssrv.h"
+ 
+-static char software_version[] = "$Id: server.c,v 1.26 2009/08/25 14:25:35 freddy77 Exp $";
++static char software_version[] = "$Id: server.c,v 1.27 2010/11/26 08:41:26 freddy77 Exp $";
+ static void *no_unused_var_warn[] = { software_version, no_unused_var_warn };
+ 
+ void
+@@ -230,7 +231,7 @@ tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows)
+ 	tds_put_byte(tds, token);
+ 	tds_put_smallint(tds, flags);
+ 	tds_put_smallint(tds, 2); /* are these two bytes the transaction status? */
+-	if (IS_TDS72(tds))
++	if (IS_TDS72_PLUS(tds))
+ 		tds_put_int8(tds, numrows);
+ 	else
+ 		tds_put_int(tds, numrows);
+diff --git a/src/tds/bulk.c b/src/tds/bulk.c
+index e0c4ffb..ad7045a 100644
+--- a/src/tds/bulk.c
++++ b/src/tds/bulk.c
+@@ -1,5 +1,5 @@
+ /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
+- * Copyright (C) 2008  Frediano Ziglio
++ * Copyright (C) 2008-2010  Frediano Ziglio
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+@@ -43,7 +43,7 @@
+ #include <dmalloc.h>
+ #endif
+ 
+-TDS_RCSID(var, "$Id: bulk.c,v 1.10 2009/08/25 14:25:35 freddy77 Exp $");
++TDS_RCSID(var, "$Id: bulk.c,v 1.11 2010/11/26 08:41:26 freddy77 Exp $");
+ 
+ #ifndef MAX
+ #define MAX(a,b) ( (a) > (b) ? (a) : (b) )
+@@ -829,7 +829,7 @@ tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
+ 			continue;
+ 		}
+ 
+-		if (IS_TDS72(tds))
++		if (IS_TDS72_PLUS(tds))
+ 			tds_put_int(tds, bcpcol->column_usertype);
+ 		else
+ 			tds_put_smallint(tds, bcpcol->column_usertype);
+diff --git a/src/tds/data.c b/src/tds/data.c
+index b7d6e89..fdd4034 100644
+--- a/src/tds/data.c
++++ b/src/tds/data.c
+@@ -1,5 +1,5 @@
+ /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
+- * Copyright (C) 2003, 2004, 2005 Frediano Ziglio
++ * Copyright (C) 2003-2010 Frediano Ziglio
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+@@ -35,7 +35,7 @@
+ #include <dmalloc.h>
+ #endif
+ 
+-TDS_RCSID(var, "$Id: data.c,v 1.26 2010/10/29 08:49:30 freddy77 Exp $");
++TDS_RCSID(var, "$Id: data.c,v 1.27 2010/11/26 08:41:26 freddy77 Exp $");
+ 
+ /**
+  * Set type of column initializing all dependency 
+@@ -132,19 +132,19 @@ tds_set_param_type(TDSSOCKET * tds, TDSCOLUMN * curcol, TDS_SERVER_TYPE type)
+ 		curcol->column_cur_size = -1;
+ 		break;
+ 	case SYBNTEXT:
+-		if (IS_TDS72(tds)) {
++		if (IS_TDS72_PLUS(tds)) {
+ 			curcol->column_varint_size = 8;
+ 			curcol->on_server.column_type = XSYBNVARCHAR;
+ 		}
+ 		break;
+ 	case SYBTEXT:
+-		if (IS_TDS72(tds)) {
++		if (IS_TDS72_PLUS(tds)) {
+ 			curcol->column_varint_size = 8;
+ 			curcol->on_server.column_type = XSYBVARCHAR;
+ 		}
+ 		break;
+ 	case SYBIMAGE:
+-		if (IS_TDS72(tds)) {
++		if (IS_TDS72_PLUS(tds)) {
+ 			curcol->column_varint_size = 8;
+ 			curcol->on_server.column_type = XSYBVARBINARY;
+ 		}
+diff --git a/src/tds/login.c b/src/tds/login.c
+index b6b5734..ea8d6f1 100644
+--- a/src/tds/login.c
++++ b/src/tds/login.c
+@@ -51,7 +51,7 @@
+ #include <dmalloc.h>
+ #endif
+ 
+-TDS_RCSID(var, "$Id: login.c,v 1.199 2010/10/02 07:07:17 freddy77 Exp $");
++TDS_RCSID(var, "$Id: login.c,v 1.200 2010/11/26 08:41:26 freddy77 Exp $");
+ 
+ static int tds_send_login(TDSSOCKET * tds, TDSCONNECTION * connection);
+ static int tds8_do_login(TDSSOCKET * tds, TDSCONNECTION * connection);
+@@ -333,7 +333,7 @@ tds_connect(TDSSOCKET * tds, TDSCONNECTION * connection, int *p_oserr)
+ 		};
+ 
+ 	/* disable tds9 if iconv wanted, currently not supported */
+-	if (IS_TDS72(connection) && tds->use_iconv)
++	if (IS_TDS72_PLUS(connection) && tds->use_iconv)
+ 		connection->tds_version = 0x701;
+ 
+ 	if (TDS_MAJOR(connection) == 0) {
+@@ -689,9 +689,9 @@ tds7_send_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 
+ 	static const unsigned char client_progver[] = { 6, 0x83, 0xf2, 0xf8 };
+ 
+-	static const unsigned char tds7Version[] = { 0x00, 0x00, 0x00, 0x70 };
+-	static const unsigned char tds8Version[] = { 0x01, 0x00, 0x00, 0x71 };
+-	static const unsigned char tds9Version[] = { 0x02, 0x00, 0x09, 0x72 };
++	static const unsigned char tds70Version[] = { 0x00, 0x00, 0x00, 0x70 };
++	static const unsigned char tds71Version[] = { 0x01, 0x00, 0x00, 0x71 };
++	static const unsigned char tds72Version[] = { 0x02, 0x00, 0x09, 0x72 };
+ 
+ 	static const unsigned char connection_id[] = { 0x00, 0x00, 0x00, 0x00 };
+ 	unsigned char option_flag1 = 0x00;
+@@ -736,7 +736,7 @@ tds7_send_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 	if (password_len > 128)
+ 		password_len = 128;
+ 
+-	current_pos = IS_TDS72(tds) ? 86 + 8 : 86;	/* ? */
++	current_pos = IS_TDS72_PLUS(tds) ? 86 + 8 : 86;	/* ? */
+ 
+ 	packet_size = current_pos + (host_name_len + app_name_len + server_name_len + library_len + language_len + database_len) * 2;
+ 
+@@ -775,12 +775,12 @@ tds7_send_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 	tdsdump_off();
+ #endif
+ 	TDS_PUT_INT(tds, packet_size);
+-	if (IS_TDS72(tds)) {
+-		tds_put_n(tds, tds9Version, 4);
++	if (IS_TDS72_PLUS(tds)) {
++		tds_put_n(tds, tds72Version, 4);
+ 	} else if (IS_TDS71_PLUS(tds)) {
+-		tds_put_n(tds, tds8Version, 4);
++		tds_put_n(tds, tds71Version, 4);
+ 	} else {
+-		tds_put_n(tds, tds7Version, 4);
++		tds_put_n(tds, tds70Version, 4);
+ 	}
+ 
+ 	if (connection->block_size < 1000000 && connection->block_size >= 512)
+@@ -867,14 +867,16 @@ tds7_send_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 	TDS_PUT_SMALLINT(tds, auth_len);	/* this matches numbers at end of packet */
+ 	current_pos += auth_len;
+ 
+-	/* unknown */
++	/* db file */
+ 	TDS_PUT_SMALLINT(tds, current_pos);
+ 	tds_put_smallint(tds, 0);
+ 
+-	if (IS_TDS72(tds)) {
++	if (IS_TDS72_PLUS(tds)) {
++		/* new password */
+ 		TDS_PUT_SMALLINT(tds, current_pos);
+ 		tds_put_smallint(tds, 0);
+ 
++		/* SSPI long */
+ 		tds_put_int(tds, 0);
+ 	}
+ 
+@@ -963,7 +965,7 @@ tds8_do_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 	TDS_UCHAR *p;
+ 
+ 	SET_UI16BE(13, instance_name_len);
+-	if (!IS_TDS72(tds)) {
++	if (!IS_TDS72_PLUS(tds)) {
+ 		SET_UI16BE(16, START_POS + 6 + 1 + instance_name_len);
+ 		buf[20] = 0xff;
+ 	} else {
+@@ -992,7 +994,7 @@ tds8_do_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 
+ 	tds_put_n(tds, buf, start_pos);
+ 	/* netlib version */
+-	tds_put_n(tds, IS_TDS72(tds) ? netlib9 : netlib8, 6);
++	tds_put_n(tds, IS_TDS72_PLUS(tds) ? netlib9 : netlib8, 6);
+ 	/* encryption */
+ #if !defined(HAVE_GNUTLS) && !defined(HAVE_OPENSSL)
+ 	/* not supported */
+@@ -1005,7 +1007,7 @@ tds8_do_login(TDSSOCKET * tds, TDSCONNECTION * connection)
+ 	/* pid */
+ 	tds_put_int(tds, getpid());
+ 	/* MARS (1 enabled) */
+-	if (IS_TDS72(tds))
++	if (IS_TDS72_PLUS(tds))
+ 		tds_put_byte(tds, 0);
+ 	if (tds_flush_packet(tds) == TDS_FAIL)
+ 		return TDS_FAIL;
+diff --git a/src/tds/query.c b/src/tds/query.c
+index 1114416..ec1aa83 100644
+--- a/src/tds/query.c
++++ b/src/tds/query.c
+@@ -1,6 +1,6 @@
+ /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
+  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005  Brian Bruns
+- * Copyright (C) 2006, 2007, 2008, 2009  Frediano Ziglio
++ * Copyright (C) 2006, 2007, 2008, 2009, 2010  Frediano Ziglio
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+@@ -46,7 +46,7 @@
+ 
+ #include <assert.h>
+ 
+-TDS_RCSID(var, "$Id: query.c,v 1.244 2010/06/19 09:51:36 freddy77 Exp $");
++TDS_RCSID(var, "$Id: query.c,v 1.245 2010/11/26 08:41:26 freddy77 Exp $");
+ 
+ static void tds_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags);
+ static void tds7_put_query_params(TDSSOCKET * tds, const char *query, size_t query_len);
+@@ -250,7 +250,7 @@ static const TDS_UCHAR tds9_query_start[] = {
+ 
+ #define START_QUERY \
+ do { \
+-	if (IS_TDS72(tds)) \
++	if (IS_TDS72_PLUS(tds)) \
+ 		tds_start_query(tds); \
+ } while(0)
+ 
+@@ -2606,7 +2606,7 @@ tds_cursor_fetch(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_FETCH fetch_typ
+ 			/* strangely dynamic cursor do not support absolute so emulate it with first + relative */
+ 			tds7_put_cursor_fetch(tds, cursor->cursor_id, 1, 0, 0);
+ 			/* TODO define constant */
+-			tds_put_byte(tds, IS_TDS72(tds) ? 0xff : 0x80);
++			tds_put_byte(tds, IS_TDS72_PLUS(tds) ? 0xff : 0x80);
+ 			tds7_put_cursor_fetch(tds, cursor->cursor_id, 0x20, i_row, cursor->cursor_rows);
+ 		} else {
+ 			/* TODO check fetch_type ?? */
+@@ -3264,7 +3264,7 @@ tds_multiple_execute(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC * dyn)
+ 	if (IS_TDS7_PLUS(tds)) {
+ 		if (multiple->flags & MUL_STARTED) {
+ 			/* TODO define constant */
+-			tds_put_byte(tds, IS_TDS72(tds) ? 0xff : 0x80);
++			tds_put_byte(tds, IS_TDS72_PLUS(tds) ? 0xff : 0x80);
+ 		}
+ 		multiple->flags |= MUL_STARTED;
+ 
+diff --git a/src/tds/token.c b/src/tds/token.c
+index ba50fd7..155271f 100644
+--- a/src/tds/token.c
++++ b/src/tds/token.c
+@@ -43,7 +43,7 @@
+ #include <dmalloc.h>
+ #endif
+ 
+-TDS_RCSID(var, "$Id: token.c,v 1.390 2010/09/28 09:55:26 freddy77 Exp $");
++TDS_RCSID(var, "$Id: token.c,v 1.391 2010/11/26 08:41:26 freddy77 Exp $");
+ 
+ #define USE_ICONV tds->use_iconv
+ 
+@@ -1462,7 +1462,7 @@ tds7_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol)
+ 	CHECK_COLUMN_EXTRA(curcol);
+ 
+ 	/*  User defined data type of the column */
+-	curcol->column_usertype = IS_TDS72(tds) ? tds_get_int(tds) : tds_get_smallint(tds);
++	curcol->column_usertype = IS_TDS72_PLUS(tds) ? tds_get_int(tds) : tds_get_smallint(tds);
+ 
+ 	curcol->column_flags = tds_get_smallint(tds);	/*  Flags */
+ 
+@@ -1484,7 +1484,7 @@ tds7_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol)
+ 	case 2:
+ 		curcol->column_size = tds_get_smallint(tds);
+ 		/* under TDS9 this means ?var???(MAX) */
+-		if (curcol->column_size < 0 && IS_TDS72(tds)) {
++		if (curcol->column_size < 0 && IS_TDS72_PLUS(tds)) {
+ 			curcol->column_size = 0x3ffffffflu;
+ 			curcol->column_varint_size = 8;
+ 		}
+@@ -1524,11 +1524,11 @@ tds7_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol)
+ 	if (is_blob_type(curcol->column_type)) {
+ 		/* discard this additional byte */
+ 		/* TODO discover its meaning */
+-		if (IS_TDS72(tds))
++		if (IS_TDS72_PLUS(tds))
+ 			tds_get_byte(tds);
+ 		curcol->table_namelen =
+ 			tds_get_string(tds, tds_get_smallint(tds), curcol->table_name, sizeof(curcol->table_name) - 1);
+-	} else if (IS_TDS72(tds) && curcol->column_type == SYBMSXML)
++	} else if (IS_TDS72_PLUS(tds) && curcol->column_type == SYBMSXML)
+ 		tds_get_byte(tds);
+ 
+ 	/*
+@@ -1681,7 +1681,7 @@ tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param)
+ 			, might_be_nullable	= 0x0800 
+ 		};
+ 		/* TODO: implement members in TDSCOLUMN */
+-		if (IS_TDS72(tds)) {
++		if (IS_TDS72_PLUS(tds)) {
+ 			curcol->is_computed = 		(curcol->column_flags & (1 << 4)) > 1;
+ 			curcol->us_reserved_odbc1 = 	(curcol->column_flags & (1 << 5)) > 1;
+ 			curcol->us_reserved_odbc2 = 	(curcol->column_flags & (1 << 6)) > 1;
+@@ -1690,7 +1690,7 @@ tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param)
+ #endif 
+ 	} 
+ 
+-	if (IS_TDS72(tds)) {
++	if (IS_TDS72_PLUS(tds)) {
+ 		tds_get_n(tds, NULL, 2);
+ #if 0
+ 		/* TODO: implement members in TDSCOLUMN, values untested */
+@@ -1722,7 +1722,7 @@ tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param)
+ 		/* assure > 0 */
+ 		curcol->column_size = tds_get_smallint(tds);
+                 /* under TDS9 this means ?var???(MAX) */
+-		if (curcol->column_size < 0 && IS_TDS72(tds)) {
++		if (curcol->column_size < 0 && IS_TDS72_PLUS(tds)) {
+ 			curcol->column_size = 0x3ffffffflu;
+ 			curcol->column_varint_size = 8;
+ 		}
+@@ -2488,7 +2488,7 @@ tds_process_end(TDSSOCKET * tds, int marker, int *flags_parm)
+ 	 * have no result set.
+ 	 */
+ 
+-	rows_affected = IS_TDS72(tds) ? tds_get_int8(tds) : tds_get_int(tds);
++	rows_affected = IS_TDS72_PLUS(tds) ? tds_get_int8(tds) : tds_get_int(tds);
+ 	tdsdump_log(TDS_DBG_FUNC, "                rows_affected = %" TDS_I64_FORMAT "\n", rows_affected);
+ 	if (done_count_valid)
+ 		tds->rows_affected = rows_affected;
+@@ -2728,7 +2728,7 @@ tds_process_msg(TDSSOCKET * tds, int marker)
+ 	rc += tds_alloc_get_string(tds, &msg.proc_name, tds_get_byte(tds));
+ 
+ 	/* line number in the sql statement where the problem occured */
+-	msg.line_number = IS_TDS72(tds) ? tds_get_int(tds) : tds_get_smallint(tds);
++	msg.line_number = IS_TDS72_PLUS(tds) ? tds_get_int(tds) : tds_get_smallint(tds);
+ 
+ 	/*
+ 	 * If the server doesen't provide an sqlstate, map one via server native errors