summaryrefslogtreecommitdiffstats
path: root/dev-db/freetds/files/SQLGetData_cvs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-db/freetds/files/SQLGetData_cvs.patch')
-rw-r--r--dev-db/freetds/files/SQLGetData_cvs.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/dev-db/freetds/files/SQLGetData_cvs.patch b/dev-db/freetds/files/SQLGetData_cvs.patch
new file mode 100644
index 0000000..5631c22
--- /dev/null
+++ b/dev-db/freetds/files/SQLGetData_cvs.patch
@@ -0,0 +1,67 @@
+diff -dPNur freetds-0.82-ds1/src/odbc/odbc.c freetds-0.82-ds2/src/odbc/odbc.c
+--- freetds-0.82-ds1/src/odbc/odbc.c 2008-07-01 19:19:14.000000000 +0200
++++ freetds-0.82-ds2/src/odbc/odbc.c 2008-07-01 19:19:25.000000000 +0200
+@@ -4564,6 +4564,7 @@
+ SQLLEN dummy_cb;
+ int nSybType;
+
++ TDS_INT converted_column_cur_size;
+ int extra_bytes = 0;
+
+ INIT_HSTMT;
+@@ -4599,6 +4600,7 @@
+ ODBC_RETURN(stmt, SQL_ERROR);
+ }
+ colinfo = resinfo->columns[icol - 1];
++ converted_column_cur_size = colinfo->column_cur_size;
+
+ if (colinfo->column_cur_size < 0) {
+ *pcbValue = SQL_NULL_DATA;
+@@ -4624,7 +4626,7 @@
+ if (is_blob_type(colinfo->column_type))
+ src = ((TDSBLOB *) src)->textvalue;
+
+- if (fCType == SQL_C_CHAR && colinfo->column_text_sqlgetdatapos) {
++ if (fCType == SQL_C_CHAR) {
+ TDS_CHAR buf[3];
+ SQLLEN len;
+
+@@ -4667,12 +4669,15 @@
+ }
+ } else {
+ nread = colinfo->column_text_sqlgetdatapos / 2;
+- if (nread >= colinfo->column_cur_size)
++
++ if (colinfo->column_text_sqlgetdatapos > 0
++ && nread >= colinfo->column_cur_size)
+ ODBC_RETURN(stmt, SQL_NO_DATA);
+ }
+
+ src += nread;
+ srclen = colinfo->column_cur_size - nread;
++ converted_column_cur_size *= 2;
+ break;
+ default:
+ if (colinfo->column_text_sqlgetdatapos >= colinfo->column_cur_size)
+@@ -4701,6 +4706,12 @@
+
+ src += nread;
+ srclen = colinfo->column_cur_size - nread;
++
++ if (converted_column_cur_size%2)
++ converted_column_cur_size = (converted_column_cur_size + 1) / 2;
++ else
++ converted_column_cur_size /= 2;
++
+ break;
+ default:
+ if (colinfo->column_text_sqlgetdatapos > 0
+@@ -4751,7 +4762,7 @@
+ if (colinfo->column_text_sqlgetdatapos == 0 && cbValueMax > 0)
+ ++colinfo->column_text_sqlgetdatapos;
+ /* not all readed ?? */
+- if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size) {
++ if (colinfo->column_text_sqlgetdatapos < converted_column_cur_size) {
+ odbc_errs_add(&stmt->errs, "01004", "String data, right truncated");
+ ODBC_RETURN(stmt, SQL_SUCCESS_WITH_INFO);
+ }