[freetds] [ freetds-Patches-1583025 ] SQL Native Client compatibility updates

SourceForge.net noreply at sourceforge.net
Wed Oct 25 04:30:05 EDT 2006


Patches item #1583025, was opened at 2006-10-23 19:16
Message generated for change (Comment added) made by freddy77
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=1583025&group_id=33106

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: odbc
Group: None
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: Dave Gray (yargevad)
Assigned to: Nobody/Anonymous (nobody)
Summary: SQL Native Client compatibility updates

Initial Comment:
The attached patch was necessary when porting an
application written using SQL Native Client against MS
SQL Server 2005 to use unixODBC and FreeTDS.

----------------------------------------------------------------------

>Comment By: Frediano Ziglio (freddy77)
Date: 2006-10-25 10:30

Message:
Logged In: YES 
user_id=75766

I don't understand what is intented to fix this patch. Could
you provide a brief test case or some lines of code that do
not works.

Looking at patch

@@ -216,6 +216,12 @@
 			case SQL_C_BINARY:
 				len = drec_apd->sql_desc_octet_length;
 				break;
+			case SQL_C_BIT:
+				len = 1;
+				break;
+			case SQL_C_LONG:
+				len = SIZEOF_LONG;
+				break;
 			case SQL_C_DATE:
 			case SQL_C_TYPE_DATE:
 				len = sizeof(DATE_STRUCT);

this should be handled by default case

@@ -278,6 +284,23 @@
 		if (sql_len < 0) {
 			/* test for SQL_C_CHAR/SQL_C_BINARY */
 			switch (sql_src_type) {
+			case SQL_C_DATE           :
+			case SQL_C_TIME           :
+			case SQL_C_TIMESTAMP      :
+			case SQL_C_TYPE_DATE      :
+			case SQL_C_TYPE_TIME      :
+			case SQL_C_TYPE_TIMESTAMP :
+				dest_type = SQL_TYPE_TIMESTAMP;
+				break;
+			case SQL_C_NUMERIC:
+				dest_type = SQL_NUMERIC;
+				break;
+			case SQL_C_LONG:
+				dest_type = SQL_INTEGER;
+				break;
+			case SQL_C_BIT:
+				dest_type = SQL_BIT;
+				break;
 			case SQL_C_CHAR:
 			case SQL_C_BINARY:
 				break;

I really don't understand this code...

@@ -242,7 +242,7 @@
 		return SQL_ERROR;
 
 	if (stmt->param_num > stmt->apd->header.sql_desc_count ||
stmt->param_num > stmt->ipd->header.sql_desc_count)
-		return SQL_ERROR;
+		return SQL_SUCCESS;
 	drec_apd = &stmt->apd->records[stmt->param_num - 1];
 	drec_ipd = &stmt->ipd->records[stmt->param_num - 1];
 
if param is not binded just ignore the param??

@@ -158,7 +158,7 @@
 			if (stmt->param_num > stmt->apd->header.sql_desc_count
 			    || stmt->param_num > stmt->ipd->header.sql_desc_count) {
 				/* TODO set error */
-				return SQL_ERROR;
+				return SQL_SUCCESS_WITH_INFO;
 			}
 
 			switch (sql2tds

...

@@ -5242,13 +5246,22 @@
 			ODBC_RETURN(stmt, SQL_NEED_DATA);
 		}
 		++stmt->param_num;
+
+        { int swiflag = 0;
+          SQLRETURN sret;
 		switch (res = parse_prepared_query(stmt, 1)) {
 		case SQL_NEED_DATA:
 			*prgbValue = stmt->apd->records[stmt->param_num -
1].sql_desc_data_ptr;
 			ODBC_RETURN(stmt, SQL_NEED_DATA);
+		case SQL_SUCCESS_WITH_INFO:
+			res = SQL_SUCCESS;
+			stmt->params->num_cols--;
+			swiflag=1;
 		case SQL_SUCCESS:
-			return _SQLExecute(stmt);
-		}
+				sret = _SQLExecute(stmt);
+	            if (swiflag) stmt->params->num_cols++;
+	            return sret;
+		}}
 		ODBC_RETURN(stmt, res);
 	}
 
Are you trying using one less parameter??

freddy77

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=1583025&group_id=33106


More information about the FreeTDS mailing list