Changeset: e3e8d8c98460 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3e8d8c98460
Modified Files:
        clients/odbc/driver/ODBCStmt.h
        clients/odbc/driver/SQLExtendedFetch.c
        clients/odbc/driver/SQLFetch.c
        clients/odbc/driver/SQLFetchScroll.c
        configure.ag
        gdk/gdk_atomic.h
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_utils.c
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 313 to 300 lines):

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
@@ -199,9 +199,9 @@ SQLRETURN MNDBColAttribute(ODBCStmt *stm
 SQLRETURN MNDBExecDirect(ODBCStmt *stmt, SQLCHAR *szSqlStr,
                         SQLINTEGER nSqlStr);
 SQLRETURN MNDBExecute(ODBCStmt *stmt);
-SQLRETURN MNDBFetch(ODBCStmt *stmt);
+SQLRETURN MNDBFetch(ODBCStmt *stmt, SQLUSMALLINT *RowStatusArray);
 SQLRETURN MNDBFetchScroll(ODBCStmt *stmt, SQLSMALLINT nOrientation,
-                         SQLLEN nOffset);
+                         SQLLEN nOffset, SQLUSMALLINT *RowStatusArray);
 SQLRETURN MNDBFreeStmt(ODBCStmt *stmt, SQLUSMALLINT option);
 SQLRETURN MNDBGetStmtAttr(ODBCStmt *stmt, SQLINTEGER Attribute,
                          SQLPOINTER Value, SQLINTEGER BufferLength,
diff --git a/clients/odbc/driver/SQLExtendedFetch.c 
b/clients/odbc/driver/SQLExtendedFetch.c
--- a/clients/odbc/driver/SQLExtendedFetch.c
+++ b/clients/odbc/driver/SQLExtendedFetch.c
@@ -41,7 +41,6 @@ SQLExtendedFetch(SQLHSTMT StatementHandl
                 SQLUSMALLINT *RowStatusArray)
 {
        ODBCStmt *stmt = (ODBCStmt *) StatementHandle;
-       SQLUSMALLINT *array_status_ptr;
        SQLRETURN rc;
 
 #ifdef ODBCDEBUG
@@ -69,12 +68,8 @@ SQLExtendedFetch(SQLHSTMT StatementHandl
                return SQL_ERROR;
        }
 
-       array_status_ptr = stmt->ImplRowDescr->sql_desc_array_status_ptr;
-       stmt->ImplRowDescr->sql_desc_array_status_ptr = RowStatusArray;
-
-       rc = MNDBFetchScroll(stmt, FetchOrientation, FetchOffset);
-
-       stmt->ImplRowDescr->sql_desc_array_status_ptr = array_status_ptr;
+       rc = MNDBFetchScroll(stmt, FetchOrientation, FetchOffset,
+                            RowStatusArray);
 
        if (SQL_SUCCEEDED(rc) || rc == SQL_NO_DATA)
                stmt->State = EXTENDEDFETCHED;
diff --git a/clients/odbc/driver/SQLFetch.c b/clients/odbc/driver/SQLFetch.c
--- a/clients/odbc/driver/SQLFetch.c
+++ b/clients/odbc/driver/SQLFetch.c
@@ -34,14 +34,13 @@
 #endif
 
 SQLRETURN
-MNDBFetch(ODBCStmt *stmt)
+MNDBFetch(ODBCStmt *stmt, SQLUSMALLINT *RowStatusArray)
 {
        ODBCDesc *ard, *ird;
        ODBCDescRec *rec;
        int i;
        SQLULEN row;
        SQLLEN offset;
-       SQLUSMALLINT *statusp;
 
        /* stmt->startRow is the (0 based) index of the first row we
         * stmt->need to fetch */
@@ -62,8 +61,6 @@ MNDBFetch(ODBCStmt *stmt)
 
        stmt->State = FETCHED;
 
-       statusp = ird->sql_desc_array_status_ptr;
-
        if (stmt->retrieveData == SQL_RD_OFF) {
                /* don't really retrieve the data, just do as if,
                   updating the SQL_DESC_ARRAY_STATUS_PTR */
@@ -76,14 +73,14 @@ MNDBFetch(ODBCStmt *stmt)
                        stmt->rowSetSize = 0;
                        return SQL_NO_DATA;
                }
-               if (statusp) {
+               if (RowStatusArray) {
                        for (row = 0; (SQLLEN) row < stmt->rowSetSize; row++) {
-                               WriteValue(statusp, SQL_ROW_SUCCESS);
-                               statusp++;
+                               WriteValue(RowStatusArray, SQL_ROW_SUCCESS);
+                               RowStatusArray++;
                        }
                        for (; row < ard->sql_desc_array_size; row++) {
-                               WriteValue(statusp, SQL_ROW_NOROW);
-                               statusp++;
+                               WriteValue(RowStatusArray, SQL_ROW_NOROW);
+                               RowStatusArray++;
                        }
                }
                return SQL_SUCCESS;
@@ -101,23 +98,23 @@ MNDBFetch(ODBCStmt *stmt)
                                        return SQL_NO_DATA;
                                break;
                        case MTIMEOUT:
-                               if (statusp)
-                                       WriteValue(statusp, SQL_ROW_ERROR);
+                               if (RowStatusArray)
+                                       WriteValue(RowStatusArray, 
SQL_ROW_ERROR);
                                /* Timeout expired / Communication
                                 * link failure */
                                addStmtError(stmt, 
stmt->Dbc->sql_attr_connection_timeout ? "HYT00" : "08S01", 
mapi_error_str(stmt->Dbc->mid), 0);
                                return SQL_ERROR;
                        default:
-                               if (statusp)
-                                       WriteValue(statusp, SQL_ROW_ERROR);
+                               if (RowStatusArray)
+                                       WriteValue(RowStatusArray, 
SQL_ROW_ERROR);
                                /* General error */
                                addStmtError(stmt, "HY000", 
mapi_error_str(stmt->Dbc->mid), 0);
                                return SQL_ERROR;
                        }
                        break;
                }
-               if (statusp)
-                       WriteValue(statusp, SQL_ROW_SUCCESS);
+               if (RowStatusArray)
+                       WriteValue(RowStatusArray, SQL_ROW_SUCCESS);
 
                stmt->rowSetSize++;
 
@@ -139,20 +136,20 @@ MNDBFetch(ODBCStmt *stmt)
                                      rec->sql_desc_scale,
                                      rec->sql_desc_datetime_interval_precision,
                                      offset, row) == SQL_ERROR) {
-                               if (statusp)
-                                       WriteValue(statusp, 
SQL_ROW_SUCCESS_WITH_INFO);
+                               if (RowStatusArray)
+                                       WriteValue(RowStatusArray, 
SQL_ROW_SUCCESS_WITH_INFO);
                        }
                }
-               if (statusp)
-                       statusp++;
+               if (RowStatusArray)
+                       RowStatusArray++;
        }
        if (ird->sql_desc_rows_processed_ptr)
                *ird->sql_desc_rows_processed_ptr = (SQLULEN) stmt->rowSetSize;
 
-       if (statusp)
+       if (RowStatusArray)
                while (row++ < ard->sql_desc_array_size) {
-                       WriteValue(statusp, SQL_ROW_NOROW);
-                       statusp++;
+                       WriteValue(RowStatusArray, SQL_ROW_NOROW);
+                       RowStatusArray++;
                }
 
        return stmt->Error ? SQL_SUCCESS_WITH_INFO : SQL_SUCCESS;
@@ -188,5 +185,5 @@ SQLFetch(SQLHSTMT StatementHandle)
 
        stmt->startRow += stmt->rowSetSize;
 
-       return MNDBFetch(stmt);
+       return MNDBFetch(stmt, stmt->ImplRowDescr->sql_desc_array_status_ptr);
 }
diff --git a/clients/odbc/driver/SQLFetchScroll.c 
b/clients/odbc/driver/SQLFetchScroll.c
--- a/clients/odbc/driver/SQLFetchScroll.c
+++ b/clients/odbc/driver/SQLFetchScroll.c
@@ -34,7 +34,8 @@
 SQLRETURN
 MNDBFetchScroll(ODBCStmt *stmt,
                SQLSMALLINT FetchOrientation,
-               SQLLEN FetchOffset)
+               SQLLEN FetchOffset,
+               SQLUSMALLINT *RowStatusArray)
 {
        assert(stmt->hdl);
 
@@ -168,7 +169,7 @@ MNDBFetchScroll(ODBCStmt *stmt,
                return SQL_ERROR;
        }
 
-       return MNDBFetch(stmt);
+       return MNDBFetch(stmt, RowStatusArray);
 }
 
 SQLRETURN SQL_API
@@ -202,5 +203,6 @@ SQLFetchScroll(SQLHSTMT StatementHandle,
                return SQL_ERROR;
        }
 
-       return MNDBFetchScroll(stmt, FetchOrientation, FetchOffset);
+       return MNDBFetchScroll(stmt, FetchOrientation, FetchOffset,
+                              stmt->ImplRowDescr->sql_desc_array_status_ptr);
 }
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1411,8 +1411,8 @@ case "$have_rubygem_dir" in
                                yes|auto)
                                        AC_MSG_CHECKING([where rubygems are 
stored])
                                        RUBY_DIR=
-                                       d=`$RUBY -rrbconfig -e "puts 
Config::CONFIG[['prefix']]" 2>/dev/null`
-                                       RUBY_DIR=`$RUBY -rrbconfig -e "puts 
Config::CONFIG[['sitelibdir']]" 2>/dev/null | sed -e "s|^$d/||" -e 
's/site_ruby/gems/'`
+                                       d=`$RUBY -rrbconfig -e "puts 
RbConfig::CONFIG[['prefix']]" 2>/dev/null`
+                                       RUBY_DIR=`$RUBY -rrbconfig -e "puts 
RbConfig::CONFIG[['sitelibdir']]" 2>/dev/null | sed -e "s|^$d/||" -e 
's/site_ruby/gems/'`
                                        if test x"$RUBY_DIR" = x ; then
                                                if test x"$have_rubygem_dir" != 
xauto; then
                                                        AC_MSG_ERROR([unable to 
determine rubygems location])
@@ -1437,7 +1437,7 @@ esac
 case "$RUBY_DIR" in
 ${prefix}/*)
        RUBY_DIR="\${prefix}`echo "$RUBY_DIR" | sed "s|^$prefix||"`";;
-/*)    ;;
+/*)    RUBY_DIR="\${prefix}$RUBY_DIR";;
 *)
        RUBY_DIR="\${prefix}/$RUBY_DIR";;
 esac
diff --git a/gdk/gdk_atomic.h b/gdk/gdk_atomic.h
--- a/gdk/gdk_atomic.h
+++ b/gdk/gdk_atomic.h
@@ -38,7 +38,10 @@
 #ifndef _GDK_ATOMIC_H_
 #define _GDK_ATOMIC_H_
 
-#if defined(HAVE_LIBATOMIC_OPS) && !defined(USE_PTHREAD_LOCKS)
+/* define this if you don't want to use atomic instructions */
+/* #define NO_ATOMIC_INSTRUCTIONS */
+
+#if defined(HAVE_LIBATOMIC_OPS) && !defined(NO_ATOMIC_INSTRUCTIONS)
 
 #include <atomic_ops.h>
 
@@ -60,7 +63,7 @@
 
 #else
 
-#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && 
!defined(USE_PTHREAD_LOCKS)
+#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && 
!defined(NO_ATOMIC_INSTRUCTIONS)
 
 #include <intrin.h>
 
@@ -107,7 +110,7 @@
 #define ATOMIC_TAS(var, lck, fcn)      _InterlockedCompareExchange(&var, 1, 0)
 #pragma intrinsic(_InterlockedCompareExchange)
 
-#elif (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__sun__) 
&& SIZEOF_SIZE_T == SIZEOF_LNG) && !defined(_MSC_VER) && 
!defined(USE_PTHREAD_LOCKS)
+#elif (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__sun__) 
&& SIZEOF_SIZE_T == SIZEOF_LNG) && !defined(_MSC_VER) && 
!defined(NO_ATOMIC_INSTRUCTIONS)
 
 #if SIZEOF_SSIZE_T == SIZEOF_LNG
 #define ATOMIC_TYPE                    lng
@@ -226,7 +229,8 @@ static inline ATOMIC_TYPE
 }
 #define ATOMIC_DEC(var, lck, fcn)              __ATOMIC_DEC(&var, &(lck))
 
-#define ATOMIC_LOCK            /* must use locks */
+#define USE_PTHREAD_LOCKS      /* must use pthread locks */
+#define ATOMIC_LOCK            /* must use locks for atomic access */
 #define ATOMIC_INIT(lck, fcn)  MT_lock_init(&(lck), fcn)
 
 #define ATOMIC_FLAG int
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -57,7 +57,7 @@
 
 MT_Lock MT_system_lock MT_LOCK_INITIALIZER("MT_system_lock");
 
-#if !defined(ATOMIC_LOCK) && !defined(NDEBUG)
+#if !defined(USE_PTHREAD_LOCKS) && !defined(NDEBUG)
 ATOMIC_TYPE volatile GDKlockcnt;
 ATOMIC_TYPE volatile GDKlockcontentioncnt;
 ATOMIC_TYPE volatile GDKlocksleepcnt;
@@ -390,7 +390,7 @@ MT_kill_thread(MT_Id t)
        return -1;
 }
 
-#ifdef ATOMIC_LOCK
+#ifdef USE_PTHREAD_LOCKS
 
 void
 pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t 
*mutexattr)
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -151,7 +151,11 @@ gdk_export int pthread_mutex_unlock(pthr
 
 #include "gdk_atomic.h"
 
-#ifdef ATOMIC_LOCK
+/* define this if you want to use pthread (or Windows) locks instead
+ * of atomic instructions for locking (latching) */
+/* #define USE_PTHREAD_LOCKS */
+
+#ifdef USE_PTHREAD_LOCKS
 
 typedef pthread_mutex_t MT_Lock;
 
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1252,7 +1252,7 @@ GDKexit(int status)
 #endif
                GDKlog(GDKLOGOFF);
                GDKunlockHome();
-#if !defined(ATOMIC_LOCK) && !defined(NDEBUG)
+#if !defined(USE_PTHREAD_LOCKS) && !defined(NDEBUG)
                TEMDEBUG GDKlockstatistics(1);
 #endif
                MT_global_exit(status);
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to