Changeset: 84f9e6aad65d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=84f9e6aad65d
Modified Files:
        sql/backends/monet5/Makefile.ag
Branch: default
Log Message:

Merge from Dec2011 branch.


diffs (truncated from 314 to 300 lines):

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
@@ -126,21 +126,18 @@ extern char *ODBCutf82wchar(const SQLCHA
        } while (0)
 #define fixWcharOut(r, s, sl, ws, wsl, wslp, cw, errfunc, hdl)         \
        do {                                                            \
-               if (SQL_SUCCEEDED(r)) {                                 \
-                       char *e = ODBCutf82wchar((s), (sl), (ws), (wsl) / (cw), 
&(sl)); \
-                       if (e) {                                        \
-                               /* General error */                     \
-                               errfunc((hdl), "HY000", e, 0);          \
-                               (r) = SQL_ERROR;                        \
-                       } else if ((sl) * (cw) >= (wsl)) {              \
-                               /* String data, right-truncated */      \
-                               errfunc((hdl), "01004", NULL, 0);       \
-                               (r) = SQL_SUCCESS_WITH_INFO;            \
-                       }                                               \
-                       if (wslp)                                       \
-                               *(wslp) = (sl) * (cw);                  \
+               char *e = ODBCutf82wchar((s), (sl), (ws), (wsl) / (cw), &(sl)); 
\
+               if (e) {                                                \
+                       /* General error */                             \
+                       errfunc((hdl), "HY000", e, 0);                  \
+                       (r) = SQL_ERROR;                                \
+               } else if ((sl) * (cw) >= (wsl)) {                      \
+                       /* String data, right-truncated */              \
+                       errfunc((hdl), "01004", NULL, 0);               \
+                       (r) = SQL_SUCCESS_WITH_INFO;                    \
                }                                                       \
-               free(s);                                                \
+               if (wslp)                                               \
+                       *(wslp) = (sl) * (cw);                          \
        } while (0)
 #endif /* WITH_WCHAR */
 
diff --git a/clients/odbc/driver/SQLBrowseConnect.c 
b/clients/odbc/driver/SQLBrowseConnect.c
--- a/clients/odbc/driver/SQLBrowseConnect.c
+++ b/clients/odbc/driver/SQLBrowseConnect.c
@@ -302,8 +302,11 @@ SQLBrowseConnectW(SQLHDBC ConnectionHand
                   addDbcError, dbc, return SQL_ERROR);
        out = malloc(1024);
        rc = SQLBrowseConnect_(dbc, in, SQL_NTS, out, 1024, &n);
-       fixWcharOut(rc, out, n, OutConnectionString, BufferLength,
-                   StringLength2Ptr, 1, addDbcError, dbc);
+       if (SQL_SUCCEEDED(rc) || rc == SQL_NEED_DATA) {
+               fixWcharOut(rc, out, n, OutConnectionString, BufferLength,
+                           StringLength2Ptr, 1, addDbcError, dbc);
+       }
+       free(out);
        if (in)
                free(in);
        return rc;
diff --git a/clients/odbc/driver/SQLColAttribute.c 
b/clients/odbc/driver/SQLColAttribute.c
--- a/clients/odbc/driver/SQLColAttribute.c
+++ b/clients/odbc/driver/SQLColAttribute.c
@@ -340,10 +340,14 @@ SQLColAttributeW(SQLHSTMT StatementHandl
        rc = SQLColAttribute_(stmt, ColumnNumber, FieldIdentifier, ptr,
                              n, &n, NumericAttributePtr);
 
-       if (ptr != CharacterAttributePtr)
-               fixWcharOut(rc, ptr, n, CharacterAttributePtr, BufferLength,
-                           StringLengthPtr, 2, addStmtError, stmt);
-       else if (StringLengthPtr)
+       if (ptr != CharacterAttributePtr) {
+               if (SQL_SUCCEEDED(rc)) {
+                       fixWcharOut(rc, ptr, n, CharacterAttributePtr,
+                                   BufferLength, StringLengthPtr, 2,
+                                   addStmtError, stmt);
+               }
+               free(ptr);
+       } else if (StringLengthPtr)
                *StringLengthPtr = n;
 
        return rc;
diff --git a/clients/odbc/driver/SQLColAttributes.c 
b/clients/odbc/driver/SQLColAttributes.c
--- a/clients/odbc/driver/SQLColAttributes.c
+++ b/clients/odbc/driver/SQLColAttributes.c
@@ -181,10 +181,14 @@ SQLColAttributesW(SQLHSTMT StatementHand
        rc = SQLColAttributes_(stmt, ColumnNumber, FieldIdentifier, ptr,
                               n, &n, NumericAttributePtr);
 
-       if (ptr != CharacterAttributePtr)
-               fixWcharOut(rc, ptr, n, CharacterAttributePtr, BufferLength,
-                           StringLengthPtr, 2, addStmtError, stmt);
-       else if (StringLengthPtr)
+       if (ptr != CharacterAttributePtr) {
+               if (SQL_SUCCEEDED(rc)) {
+                       fixWcharOut(rc, ptr, n, CharacterAttributePtr,
+                                   BufferLength, StringLengthPtr, 2,
+                                   addStmtError, stmt);
+               }
+               free(ptr);
+       } else if (StringLengthPtr)
                *StringLengthPtr = n;
 
        return rc;
diff --git a/clients/odbc/driver/SQLDataSources.c 
b/clients/odbc/driver/SQLDataSources.c
--- a/clients/odbc/driver/SQLDataSources.c
+++ b/clients/odbc/driver/SQLDataSources.c
@@ -147,12 +147,16 @@ SQLDataSourcesW(SQLHENV EnvironmentHandl
                             server, 100, &length1,
                             descr, 100, &length2);
 
-       fixWcharOut(rc, server, length1,
-                   ServerName, BufferLength1, NameLength1,
-                   1, addEnvError, env);
-       fixWcharOut(rc, descr, length2,
-                   Description, BufferLength2, NameLength2,
-                   1, addEnvError, env);
+       if (SQL_SUCCEEDED(rc)) {
+               fixWcharOut(rc, server, length1,
+                           ServerName, BufferLength1, NameLength1,
+                           1, addEnvError, env);
+               fixWcharOut(rc, descr, length2,
+                           Description, BufferLength2, NameLength2,
+                           1, addEnvError, env);
+       }
+       free(server);
+       free(descr);
 
        return rc;
 }
diff --git a/clients/odbc/driver/SQLDescribeCol.c 
b/clients/odbc/driver/SQLDescribeCol.c
--- a/clients/odbc/driver/SQLDescribeCol.c
+++ b/clients/odbc/driver/SQLDescribeCol.c
@@ -225,8 +225,11 @@ SQLDescribeColW(SQLHSTMT StatementHandle
                             ColumnSizePtr,
                             DecimalDigitsPtr,
                             NullablePtr);
-       fixWcharOut(rc, colname, n, ColumnName, BufferLength, NameLengthPtr,
-                   1, addStmtError, stmt);
+       if (SQL_SUCCEEDED(rc)) {
+               fixWcharOut(rc, colname, n, ColumnName, BufferLength,
+                           NameLengthPtr, 1, addStmtError, stmt);
+       }
+       free(colname);
 
        return rc;
 }
diff --git a/clients/odbc/driver/SQLDriverConnect.c 
b/clients/odbc/driver/SQLDriverConnect.c
--- a/clients/odbc/driver/SQLDriverConnect.c
+++ b/clients/odbc/driver/SQLDriverConnect.c
@@ -434,8 +434,11 @@ SQLDriverConnectW(SQLHDBC ConnectionHand
        out = malloc(n);
        rc = SQLDriverConnect_(dbc, WindowHandle, in, SQL_NTS, out, n, &n,
                               DriverCompletion, 0);
-       fixWcharOut(rc, out, n, OutConnectionString, BufferLength,
-                   StringLength2Ptr, 1, addDbcError, dbc);
+       if (SQL_SUCCEEDED(rc)) {
+               fixWcharOut(rc, out, n, OutConnectionString, BufferLength,
+                           StringLength2Ptr, 1, addDbcError, dbc);
+       }
+       free(out);
        if (in)
                free(in);
        return rc;
diff --git a/clients/odbc/driver/SQLGetConnectAttr.c 
b/clients/odbc/driver/SQLGetConnectAttr.c
--- a/clients/odbc/driver/SQLGetConnectAttr.c
+++ b/clients/odbc/driver/SQLGetConnectAttr.c
@@ -196,10 +196,13 @@ SQLGetConnectAttrW(SQLHDBC ConnectionHan
        rc = SQLGetConnectAttr_(dbc, Attribute, ptr, n, &n);
 
        if (ptr != ValuePtr) {
-               SQLSMALLINT nn = (SQLSMALLINT) n;
+               if (SQL_SUCCEEDED(rc)) {
+                       SQLSMALLINT nn = (SQLSMALLINT) n;
 
-               fixWcharOut(rc, ptr, nn, ValuePtr, BufferLength,
-                           StringLengthPtr, 2, addDbcError, dbc);
+                       fixWcharOut(rc, ptr, nn, ValuePtr, BufferLength,
+                                   StringLengthPtr, 2, addDbcError, dbc);
+               }
+               free(ptr);
        } else if (StringLengthPtr)
                *StringLengthPtr = n;
 
diff --git a/clients/odbc/driver/SQLGetConnectOption.c 
b/clients/odbc/driver/SQLGetConnectOption.c
--- a/clients/odbc/driver/SQLGetConnectOption.c
+++ b/clients/odbc/driver/SQLGetConnectOption.c
@@ -135,11 +135,15 @@ SQLGetConnectOptionW(SQLHDBC ConnectionH
        rc = SQLGetConnectOption_(dbc, Option, ptr);
 
        if (ptr != ValuePtr) {
-               SQLSMALLINT n = (SQLSMALLINT) strlen((char *) ptr);
-               SQLSMALLINT *nullp = NULL;
+               if (SQL_SUCCEEDED(rc)) {
+                       SQLSMALLINT n = (SQLSMALLINT) strlen((char *) ptr);
+                       SQLSMALLINT *nullp = NULL;
 
-               fixWcharOut(rc, ptr, n, ValuePtr, SQL_MAX_OPTION_STRING_LENGTH,
-                           nullp, 2, addDbcError, dbc);
+                       fixWcharOut(rc, ptr, n, ValuePtr,
+                                   SQL_MAX_OPTION_STRING_LENGTH, nullp, 2,
+                                   addDbcError, dbc);
+               }
+               free(ptr);
        }
 
        return rc;
diff --git a/clients/odbc/driver/SQLGetCursorName.c 
b/clients/odbc/driver/SQLGetCursorName.c
--- a/clients/odbc/driver/SQLGetCursorName.c
+++ b/clients/odbc/driver/SQLGetCursorName.c
@@ -121,8 +121,11 @@ SQLGetCursorNameW(SQLHSTMT StatementHand
        n++;                    /* account for NUL byte */
        cursor = malloc(n);
        rc = SQLGetCursorName_(stmt, cursor, BufferLength, &n);
-       fixWcharOut(rc, cursor, n, CursorName, BufferLength,
-                   NameLengthPtr, 1, addStmtError, stmt);
+       if (SQL_SUCCEEDED(rc))    {
+               fixWcharOut(rc, cursor, n, CursorName, BufferLength,
+                           NameLengthPtr, 1, addStmtError, stmt);
+       }
+       free(cursor);
 
        return rc;
 }
diff --git a/clients/odbc/driver/SQLGetDescField.c 
b/clients/odbc/driver/SQLGetDescField.c
--- a/clients/odbc/driver/SQLGetDescField.c
+++ b/clients/odbc/driver/SQLGetDescField.c
@@ -377,10 +377,13 @@ SQLGetDescFieldW(SQLHDESC DescriptorHand
        rc = SQLGetDescField_(desc, RecordNumber, FieldIdentifier, ptr, n, &n);
 
        if (ptr != ValuePtr) {
-               SQLSMALLINT nn = (SQLSMALLINT) n;
+               if (SQL_SUCCEEDED(rc)) {
+                       SQLSMALLINT nn = (SQLSMALLINT) n;
 
-               fixWcharOut(rc, ptr, nn, ValuePtr, BufferLength,
-                           StringLengthPtr, 2, addDescError, desc);
+                       fixWcharOut(rc, ptr, nn, ValuePtr, BufferLength,
+                                   StringLengthPtr, 2, addDescError, desc);
+               }
+               free(ptr);
        } else if (StringLengthPtr)
                *StringLengthPtr = n;
 
diff --git a/clients/odbc/driver/SQLGetInfo.c b/clients/odbc/driver/SQLGetInfo.c
--- a/clients/odbc/driver/SQLGetInfo.c
+++ b/clients/odbc/driver/SQLGetInfo.c
@@ -867,10 +867,13 @@ SQLGetInfoW(SQLHDBC ConnectionHandle,
 
        rc = SQLGetInfo_(dbc, InfoType, ptr, n, &n);
 
-       if (ptr != InfoValuePtr)
-               fixWcharOut(rc, ptr, n, InfoValuePtr, BufferLength,
-                           StringLengthPtr, 2, addDbcError, dbc);
-       else if (StringLengthPtr)
+       if (ptr != InfoValuePtr) {
+               if (SQL_SUCCEEDED(rc)) {
+                       fixWcharOut(rc, ptr, n, InfoValuePtr, BufferLength,
+                                   StringLengthPtr, 2, addDbcError, dbc);
+               }
+               free(ptr);
+       } else if (StringLengthPtr)
                *StringLengthPtr = n;
 
        return rc;
diff --git a/clients/odbc/driver/SQLNativeSql.c 
b/clients/odbc/driver/SQLNativeSql.c
--- a/clients/odbc/driver/SQLNativeSql.c
+++ b/clients/odbc/driver/SQLNativeSql.c
@@ -150,8 +150,11 @@ SQLNativeSqlW(SQLHSTMT StatementHandle,
        sqlout = malloc(n);
        rc = SQLNativeSql_(stmt, sqlin, SQL_NTS, sqlout, n, &n);
        nn = (SQLSMALLINT) n;
-       fixWcharOut(rc, sqlout, nn, OutStatementText, BufferLength,
-                   TextLength2Ptr, 1, addStmtError, stmt);
+       if (SQL_SUCCEEDED(rc)) {
+               fixWcharOut(rc, sqlout, nn, OutStatementText, BufferLength,
+                           TextLength2Ptr, 1, addStmtError, stmt);
+       }
+       free(sqlout);
 
        return rc;
 }
diff --git a/sql/backends/monet5/LSST/Makefile.ag 
b/sql/backends/monet5/LSST/Makefile.ag
--- a/sql/backends/monet5/LSST/Makefile.ag
+++ b/sql/backends/monet5/LSST/Makefile.ag
@@ -28,15 +28,14 @@ INCLUDES = .. \
        ../../../../clients/mapilib \
        ../../../../common/options \
        ../../../../common/stream \
-       ../../../../gdk \
-       $(READLINE_INCS) $(MSEED_CFLAGS) $(cfitsio_CFLAGS) $(curl_CFLAGS)
+       ../../../../gdk
 
 lib__lsst = {
        MODULE
        DIR = libdir/monetdb5
        SOURCES = lsst.c
        LIBS = ../../../../monetdb5/tools/libmonetdb5 \
-               ../../../../gdk/libbat $(curl_LIBS)
+               ../../../../gdk/libbat
 }
 
 headers_lsstmal = {
diff --git a/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.reqtests 
b/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.reqtests
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/LSST/Tests/lsst_htmxmatch.reqtests
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to