Changeset: 2c9688c28b1c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c9688c28b1c
Added Files:
        clients/odbc/samples/arraytest.c
Modified Files:
        clients/odbc/driver/ODBCConvert.c
        clients/odbc/driver/ODBCDbc.c
        clients/odbc/driver/ODBCDbc.h
        clients/odbc/driver/ODBCEnv.c
        clients/odbc/driver/ODBCEnv.h
        clients/odbc/driver/ODBCError.c
        clients/odbc/driver/ODBCError.h
        clients/odbc/driver/ODBCGlobal.h
        clients/odbc/driver/ODBCStmt.c
        clients/odbc/driver/ODBCStmt.h
        clients/odbc/driver/ODBCUtil.c
        clients/odbc/driver/ODBCUtil.h
        clients/odbc/driver/SQLAllocConnect.c
        clients/odbc/driver/SQLAllocEnv.c
        clients/odbc/driver/SQLAllocHandle.c
        clients/odbc/driver/SQLAllocStmt.c
        clients/odbc/driver/SQLBindCol.c
        clients/odbc/driver/SQLBindParameter.c
        clients/odbc/driver/SQLBrowseConnect.c
        clients/odbc/driver/SQLBulkOperations.c
        clients/odbc/driver/SQLCancel.c
        clients/odbc/driver/SQLCloseCursor.c
        clients/odbc/driver/SQLColAttribute.c
        clients/odbc/driver/SQLColAttributes.c
        clients/odbc/driver/SQLColumnPrivileges.c
        clients/odbc/driver/SQLConnect.c
        clients/odbc/driver/SQLCopyDesc.c
        clients/odbc/driver/SQLDataSources.c
        clients/odbc/driver/SQLDescribeCol.c
        clients/odbc/driver/SQLDescribeParam.c
        clients/odbc/driver/SQLDisconnect.c
        clients/odbc/driver/SQLDriverConnect.c
        clients/odbc/driver/SQLEndTran.c
        clients/odbc/driver/SQLError.c
        clients/odbc/driver/SQLExecDirect.c
        clients/odbc/driver/SQLExecute.c
        clients/odbc/driver/SQLExtendedFetch.c
        clients/odbc/driver/SQLFetch.c
        clients/odbc/driver/SQLFetchScroll.c
        clients/odbc/driver/SQLForeignKeys.c
        clients/odbc/driver/SQLFreeConnect.c
        clients/odbc/driver/SQLFreeEnv.c
        clients/odbc/driver/SQLFreeHandle.c
        clients/odbc/driver/SQLFreeStmt.c
        clients/odbc/driver/SQLGetConnectAttr.c
        clients/odbc/driver/SQLGetConnectOption.c
        clients/odbc/driver/SQLGetCursorName.c
        clients/odbc/driver/SQLGetData.c
        clients/odbc/driver/SQLGetDescField.c
        clients/odbc/driver/SQLGetDescRec.c
        clients/odbc/driver/SQLGetDiagField.c
        clients/odbc/driver/SQLGetDiagRec.c
        clients/odbc/driver/SQLGetEnvAttr.c
        clients/odbc/driver/SQLGetFunctions.c
        clients/odbc/driver/SQLGetInfo.c
        clients/odbc/driver/SQLGetStmtAttr.c
        clients/odbc/driver/SQLGetStmtOption.c
        clients/odbc/driver/SQLGetTypeInfo.c
        clients/odbc/driver/SQLMoreResults.c
        clients/odbc/driver/SQLNativeSql.c
        clients/odbc/driver/SQLNumParams.c
        clients/odbc/driver/SQLNumResultCols.c
        clients/odbc/driver/SQLParamData.c
        clients/odbc/driver/SQLParamOptions.c
        clients/odbc/driver/SQLPrepare.c
        clients/odbc/driver/SQLPrimaryKeys.c
        clients/odbc/driver/SQLProcedureColumns.c
        clients/odbc/driver/SQLProcedures.c
        clients/odbc/driver/SQLPutData.c
        clients/odbc/driver/SQLRowCount.c
        clients/odbc/driver/SQLSetConnectAttr.c
        clients/odbc/driver/SQLSetConnectOption.c
        clients/odbc/driver/SQLSetCursorName.c
        clients/odbc/driver/SQLSetDescField.c
        clients/odbc/driver/SQLSetDescRec.c
        clients/odbc/driver/SQLSetEnvAttr.c
        clients/odbc/driver/SQLSetParam.c
        clients/odbc/driver/SQLSetPos.c
        clients/odbc/driver/SQLSetScrollOptions.c
        clients/odbc/driver/SQLSetStmtAttr.c
        clients/odbc/driver/SQLSetStmtOption.c
        clients/odbc/driver/SQLSpecialColumns.c
        clients/odbc/driver/SQLStatistics.c
        clients/odbc/driver/SQLTablePrivileges.c
        clients/odbc/driver/SQLTables.c
        clients/odbc/driver/SQLTransact.c
        clients/odbc/samples/Makefile.ag
Branch: default
Log Message:

Merged from Apr2012


diffs (truncated from 1802 to 300 lines):

diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -25,6 +25,7 @@
 #ifdef HAVE_STRINGS_H
 #include <strings.h>           /* for strncasecmp */
 #endif
+#include <float.h>             /* for FLT_MAX */
 
 #if SIZEOF_INT==8
 # define ULL_CONSTANT(val)     (val)
@@ -520,7 +521,7 @@ parseoptionalbracketednumber(char **sval
                sval = eptr;
                *val2p = val;
        }
-               
+
        if (slen == 0 || *sval != ')')
                return SQL_ERROR;
        slen--;
@@ -529,7 +530,7 @@ parseoptionalbracketednumber(char **sval
        *slenp = slen;
        return SQL_SUCCESS;
 }
-       
+
 static SQLRETURN
 parsemonthintervalstring(char **svalp,
                         SQLLEN *slenp,
@@ -2256,13 +2257,12 @@ ODBCFetch(ODBCStmt *stmt,
                if (type == SQL_C_FLOAT) {
                        if (ardrec && row > 0)
                                ptr = (SQLPOINTER) ((char *) ptr + row * 
(bind_type == SQL_BIND_BY_COLUMN ? sizeof(float) : bind_type));
-                       *(float *) ptr = (float) fval;
-
-                       if ((double) *(float *) ptr != fval) {
+                       if (fval < -FLT_MAX || fval > FLT_MAX) {
                                /* Numeric value out of range */
                                addStmtError(stmt, "22003", NULL, 0);
                                return SQL_ERROR;
                        }
+                       *(float *) ptr = (float) fval;
                        if (lenp)
                                *lenp = sizeof(float);
                } else {
@@ -2715,7 +2715,7 @@ ODBCStore(ODBCStmt *stmt,
 {
        ODBCDescRec *ipdrec, *apdrec;
        SQLPOINTER ptr;
-       SQLLEN *indicator_ptr;
+       SQLLEN *strlen_or_ind_ptr;
        SQLUINTEGER bind_type;
        SQLSMALLINT ctype, sqltype;
        char *sval = NULL;
@@ -2742,11 +2742,11 @@ ODBCStore(ODBCStmt *stmt,
        ptr = apdrec->sql_desc_data_ptr;
        if (ptr && offset)
                ptr = (SQLPOINTER) ((char *) ptr + offset + row * (bind_type == 
SQL_BIND_BY_COLUMN ? sizeof(SQLPOINTER) : bind_type));
-       indicator_ptr = apdrec->sql_desc_indicator_ptr;
-       if (indicator_ptr && offset)
-               indicator_ptr = (SQLLEN *) ((char *) indicator_ptr + offset + 
row * (bind_type == SQL_BIND_BY_COLUMN ? sizeof(SQLINTEGER) : bind_type));
+       strlen_or_ind_ptr = apdrec->sql_desc_indicator_ptr;
+       if (strlen_or_ind_ptr && offset)
+               strlen_or_ind_ptr = (SQLLEN *) ((char *) strlen_or_ind_ptr + 
offset + row * (bind_type == SQL_BIND_BY_COLUMN ? sizeof(SQLINTEGER) : 
bind_type));
        if (ptr == NULL &&
-           (indicator_ptr == NULL || *indicator_ptr != SQL_NULL_DATA)) {
+           (strlen_or_ind_ptr == NULL || *strlen_or_ind_ptr != SQL_NULL_DATA)) 
{
                /* COUNT field incorrect */
                addStmtError(stmt, "07002", NULL, 0);
                return SQL_ERROR;
@@ -2771,7 +2771,7 @@ ODBCStore(ODBCStmt *stmt,
                break;
        }
 
-       if (indicator_ptr != NULL && *indicator_ptr == SQL_NULL_DATA) {
+       if (strlen_or_ind_ptr != NULL && *strlen_or_ind_ptr == SQL_NULL_DATA) {
                assigns(buf, bufpos, buflen, "NULL", stmt);
                *bufp = buf;
                *bufposp = bufpos;
@@ -2779,16 +2779,20 @@ ODBCStore(ODBCStmt *stmt,
                return SQL_SUCCESS;
        }
 
+       strlen_or_ind_ptr = apdrec->sql_desc_octet_length_ptr;
+       if (strlen_or_ind_ptr && offset)
+               strlen_or_ind_ptr = (SQLLEN *) ((char *) strlen_or_ind_ptr + 
offset + row * (bind_type == SQL_BIND_BY_COLUMN ? sizeof(SQLINTEGER) : 
bind_type));
+
        switch (ctype) {
        case SQL_C_CHAR:
        case SQL_C_BINARY:
-               slen = apdrec->sql_desc_octet_length_ptr ? 
*apdrec->sql_desc_octet_length_ptr : SQL_NTS;
+               slen = strlen_or_ind_ptr ? *strlen_or_ind_ptr : SQL_NTS;
                sval = (char *) ptr;
                fixODBCstring(sval, slen, SQLLEN, addStmtError, stmt, return 
SQL_ERROR);
                break;
 #ifdef WITH_WCHAR
        case SQL_C_WCHAR:
-               slen = apdrec->sql_desc_octet_length_ptr ? 
*apdrec->sql_desc_octet_length_ptr : SQL_NTS;
+               slen = strlen_or_ind_ptr ? *strlen_or_ind_ptr : SQL_NTS;
                sval = (char *) ptr;
                fixWcharIn((SQLWCHAR *) ptr, slen, char, sval, addStmtError, 
stmt, return SQL_ERROR);
                break;
@@ -3667,7 +3671,7 @@ ODBCStore(ODBCStmt *stmt,
                        fval = (double) (60 * (60 * (24 * 
ival.intval.day_second.day + ival.intval.day_second.hour) + 
ival.intval.day_second.minute) + ival.intval.day_second.second);
                        if (ival.intval.day_second.fraction && ivalprec > 0) {
                                int f = 1;
-                               
+
                                for (i = 0; i < ivalprec; i++)
                                        f *= 10;
                                fval += ival.intval.day_second.fraction / 
(double) f;
diff --git a/clients/odbc/driver/ODBCDbc.c b/clients/odbc/driver/ODBCDbc.c
--- a/clients/odbc/driver/ODBCDbc.c
+++ b/clients/odbc/driver/ODBCDbc.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCDbc.h b/clients/odbc/driver/ODBCDbc.h
--- a/clients/odbc/driver/ODBCDbc.h
+++ b/clients/odbc/driver/ODBCDbc.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCEnv.c b/clients/odbc/driver/ODBCEnv.c
--- a/clients/odbc/driver/ODBCEnv.c
+++ b/clients/odbc/driver/ODBCEnv.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCEnv.h b/clients/odbc/driver/ODBCEnv.h
--- a/clients/odbc/driver/ODBCEnv.h
+++ b/clients/odbc/driver/ODBCEnv.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCError.c b/clients/odbc/driver/ODBCError.c
--- a/clients/odbc/driver/ODBCError.c
+++ b/clients/odbc/driver/ODBCError.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCError.h b/clients/odbc/driver/ODBCError.h
--- a/clients/odbc/driver/ODBCError.h
+++ b/clients/odbc/driver/ODBCError.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCGlobal.h b/clients/odbc/driver/ODBCGlobal.h
--- a/clients/odbc/driver/ODBCGlobal.h
+++ b/clients/odbc/driver/ODBCGlobal.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCStmt.c b/clients/odbc/driver/ODBCStmt.c
--- a/clients/odbc/driver/ODBCStmt.c
+++ b/clients/odbc/driver/ODBCStmt.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCStmt.h b/clients/odbc/driver/ODBCStmt.h
--- a/clients/odbc/driver/ODBCStmt.h
+++ b/clients/odbc/driver/ODBCStmt.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCUtil.c b/clients/odbc/driver/ODBCUtil.c
--- a/clients/odbc/driver/ODBCUtil.c
+++ b/clients/odbc/driver/ODBCUtil.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/ODBCUtil.h b/clients/odbc/driver/ODBCUtil.h
--- a/clients/odbc/driver/ODBCUtil.h
+++ b/clients/odbc/driver/ODBCUtil.h
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/SQLAllocConnect.c 
b/clients/odbc/driver/SQLAllocConnect.c
--- a/clients/odbc/driver/SQLAllocConnect.c
+++ b/clients/odbc/driver/SQLAllocConnect.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/SQLAllocEnv.c 
b/clients/odbc/driver/SQLAllocEnv.c
--- a/clients/odbc/driver/SQLAllocEnv.c
+++ b/clients/odbc/driver/SQLAllocEnv.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/SQLAllocHandle.c 
b/clients/odbc/driver/SQLAllocHandle.c
--- a/clients/odbc/driver/SQLAllocHandle.c
+++ b/clients/odbc/driver/SQLAllocHandle.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/SQLAllocStmt.c 
b/clients/odbc/driver/SQLAllocStmt.c
--- a/clients/odbc/driver/SQLAllocStmt.c
+++ b/clients/odbc/driver/SQLAllocStmt.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
  * This file has been modified for the MonetDB project.  See the file
  * Copyright in this directory for more information.
  */
diff --git a/clients/odbc/driver/SQLBindCol.c b/clients/odbc/driver/SQLBindCol.c
--- a/clients/odbc/driver/SQLBindCol.c
+++ b/clients/odbc/driver/SQLBindCol.c
@@ -22,7 +22,7 @@
  * This code is LGPL. Please ensure that this message remains in future
  * distributions and uses of this code (thats about all I get out of it).
  * - Peter Harvey [email protected]
- * 
+ *
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to