Changeset: c6ded36cc0bf for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6ded36cc0bf
Modified Files:
        MonetDB.spec
        clients/ChangeLog.Feb2013
        clients/odbc/driver/ODBCConvert.c
        clients/odbc/driver/ODBCDesc.h
        clients/odbc/driver/SQLFetch.c
        configure.ag
        debian/changelog
        java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
        testing/ChangeLog-Archive
Branch: default
Log Message:

Merge with Feb2013 branch.


diffs (truncated from 333 to 300 lines):

diff --git a/clients/ChangeLog.Feb2013 b/clients/ChangeLog.Feb2013
--- a/clients/ChangeLog.Feb2013
+++ b/clients/ChangeLog.Feb2013
@@ -1,3 +1,7 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Fri Oct  4 2013 Sjoerd Mullender <sjo...@acm.org>
+- ODBC: Implemented retrieving variable-length data in parts with
+  SQLGetData.  See bug 3381.
+
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
@@ -1255,7 +1255,25 @@ ODBCFetch(ODBCStmt *stmt,
                case SQL_WCHAR:
                case SQL_WVARCHAR:
                case SQL_WLONGVARCHAR:
-                       copyString(data, datalen, ptr, buflen, lenp, SQLLEN, 
addStmtError, stmt, return SQL_ERROR);
+                       if (irdrec->already_returned > datalen) {
+                               data += datalen;
+                               datalen = 0;
+                       } else {
+                               data += irdrec->already_returned;
+                               datalen -= irdrec->already_returned;
+                       }
+                       if (datalen == 0 && irdrec->already_returned != 0) {
+                               /* no more data to return */
+                               if (type == SQL_C_WCHAR)
+                                       free(ptr);
+                               return SQL_NO_DATA;
+                       }
+                       copyString(data, datalen, ptr, buflen, lenp, SQLLEN,
+                                  addStmtError, stmt, return SQL_ERROR);
+                       if (datalen < (size_t) buflen)
+                               irdrec->already_returned += datalen;
+                       else
+                               irdrec->already_returned += buflen;
                        break;
                case SQL_BINARY:
                case SQL_VARBINARY:
@@ -1273,6 +1291,19 @@ ODBCFetch(ODBCStmt *stmt,
                                        free(ptr);
                                return SQL_ERROR;
                        }
+                       if (irdrec->already_returned > datalen) {
+                               data += datalen;
+                               datalen = 0;
+                       } else {
+                               data += irdrec->already_returned;
+                               datalen -= irdrec->already_returned;
+                       }
+                       if (datalen == 0 && irdrec->already_returned != 0) {
+                               /* no more data to return */
+                               if (type == SQL_C_WCHAR)
+                                       free(ptr);
+                               return SQL_NO_DATA;
+                       }
                        for (k = 0; k < datalen; k++) {
                                if ('0' <= data[k] && data[k] <= '9')
                                        n = data[k] - '0';
@@ -1296,6 +1327,7 @@ ODBCFetch(ODBCStmt *stmt,
                                } else
                                        c = n << 4;
                        }
+                       irdrec->already_returned += k;
                        if (lenp)
                                *lenp = j;
                        break;
diff --git a/clients/odbc/driver/ODBCDesc.h b/clients/odbc/driver/ODBCDesc.h
--- a/clients/odbc/driver/ODBCDesc.h
+++ b/clients/odbc/driver/ODBCDesc.h
@@ -59,6 +59,7 @@ typedef struct {
        SQLSMALLINT sql_desc_unnamed;
        SQLSMALLINT sql_desc_unsigned;
        SQLSMALLINT sql_desc_updatable;
+       size_t already_returned;
 } ODBCDescRec;
 
 typedef struct {
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
@@ -128,6 +128,9 @@ SQLFetch_(ODBCStmt *stmt)
 
                stmt->rowSetSize++;
 
+               for (i = 1; i <= ird->sql_desc_count; i++)
+                       ird->descRec[i].already_returned = 0;
+
                for (i = 1; i <= ard->sql_desc_count; i++) {
                        rec = &ard->descRec[i];
                        if (rec->sql_desc_data_ptr == NULL)
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -1324,34 +1324,46 @@ if test "x$enable_testing" != xno ; then
 fi
 
 RUBY=ruby
+AC_PATH_PROG(RUBY,$RUBY,no,$PATH)
 have_rubygem_dir=auto
 AC_ARG_WITH(rubygem-dir,
        AS_HELP_STRING([--with-rubygem-dir=DIR], [Ruby gems are installed in 
DIR]),
        have_rubygem_dir="$withval")
 
 case "$have_rubygem_dir" in
-       yes|auto)
-               AC_PATH_PROG(RUBY,$RUBY,no,$PATH)
+       no) ;;
+       *)
                if test "x$RUBY" = xno; then
                        if test "x$have_rubygem_dir" != xauto; then
-                               AC_MSG_ERROR([No Ruby executable found, specify 
--with-rubygem-dir explicitly])
+                               AC_MSG_ERROR([No Ruby executable found])
                        fi
                        have_rubygem_dir=no
                else
-                       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/'`
-                       if test x"$RUBY_DIR" = x ; then
-                               AC_MSG_ERROR([unable to determine rubygems 
location])
-                       else
-                               AC_MSG_RESULT([$RUBY_DIR])
-                       fi
+                       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/'`
+                                       if test x"$RUBY_DIR" = x ; then
+                                               if test x"$have_rubygem_dir" != 
xauto; then
+                                                       AC_MSG_ERROR([unable to 
determine rubygems location])
+                                               else
+                                                       AC_MSG_RESULT([unable 
to determine rubygems location])
+                                                       RUBY=no
+                                                       have_rubygem_dir=no
+                                               fi
+                                       else
+                                               AC_MSG_RESULT([$RUBY_DIR])
+                                       fi
+                                       ;;
+                               *)
+                                       RUBY_DIR="$have_rubygem_dir"
+                                       ;;
+                       esac
                fi
                ;;
-       no) ;;
        *)
-               RUBY_DIR="$have_rubygem_dir"
                ;;
 esac
 case "$RUBY_DIR" in
@@ -2322,7 +2334,7 @@ yes|auto)
                                AC_MSG_ERROR([geos-config not found in $XPATH])
                        else
                                have_geos=no
-                               why_have_geos="(geos-config not found in 
$XPATH)"
+                               why_have_geos="(geos-config not found)"
                        fi
                fi
        fi
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -106,20 +106,19 @@ monetdb (11.15.1-20130212) unstable; urg
 
 monetdb (11.15.1-20130212) unstable; urgency=low
 
-  * testing:
-enabled "top-level" Mtest.py
-So far, while Mtest.py could be called in any subdirectory of the MonetDB
-source tree (and could then run all tests in the entire sub-tree),
-it was not possible to call Mtest.py in the top-level MonetDB source
-directory to run all tests.  Instead, to run all tests, Mtest.py had to
-be called at least 4 times, once in each of these directories: "clients",
-"monetdb5", "sql", "geom".
-Now, it is possible to call Mtest.py once in the top-level MonetDB source
-directory to run all tests in one go.
-The behaviour of calling Mtest.py in any subdirectory, including the
-four mentioned above, did not changed, other than that now obsolete
-command line options "-p / --package <package>" and "-5 / --monetdb5"
-have been removed.
+  * testing: enabled "top-level" Mtest.py
+    So far, while Mtest.py could be called in any subdirectory of the MonetDB
+    source tree (and could then run all tests in the entire sub-tree),
+    it was not possible to call Mtest.py in the top-level MonetDB source
+    directory to run all tests.  Instead, to run all tests, Mtest.py had to
+    be called at least 4 times, once in each of these directories: "clients",
+    "monetdb5", "sql", "geom".
+    Now, it is possible to call Mtest.py once in the top-level MonetDB source
+    directory to run all tests in one go.
+    The behaviour of calling Mtest.py in any subdirectory, including the
+    four mentioned above, did not changed, other than that now obsolete
+    command line options "-p / --package <package>" and "-5 / --monetdb5"
+    have been removed.
 
  -- Stefan Manegold <stefan.maneg...@cwi.nl>  Thu, 17 Jan 2013 09:51:39 +0100
 
diff --git a/java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java 
b/java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -1708,23 +1708,26 @@ public class MonetDatabaseMetaData exten
                        "AS smallint) AS \"DATA_TYPE\", " +
                        "\"columns\".\"type\" AS \"TYPE_NAME\", " +
                        "\"columns\".\"type_digits\" AS \"COLUMN_SIZE\", " +
-                       "\"columns\".\"type_scale\" AS \"DECIMAL_DIGITS\", 0 AS 
\"BUFFER_LENGTH\", " +
+                       "0 AS \"BUFFER_LENGTH\", " +
+                       "\"columns\".\"type_scale\" AS \"DECIMAL_DIGITS\", " +
                        "10 AS \"NUM_PREC_RADIX\", " +
                        "cast(CASE \"null\" " +
                                "WHEN true THEN " + 
ResultSetMetaData.columnNullable + " " +
                                "WHEN false THEN " + 
ResultSetMetaData.columnNoNulls + " " +
-                       "END AS int) AS \"NULLABLE\", cast(null AS varchar(1)) 
AS \"REMARKS\", " +
-                       "\"columns\".\"default\" AS \"COLUMN_DEF\", 0 AS 
\"SQL_DATA_TYPE\", " +
+                       "END AS int) AS \"NULLABLE\", " +
+                       "cast(null AS varchar(1)) AS \"REMARKS\", " +
+                       "\"columns\".\"default\" AS \"COLUMN_DEF\", " +
+                       "0 AS \"SQL_DATA_TYPE\", " +
                        "0 AS \"SQL_DATETIME_SUB\", 0 AS \"CHAR_OCTET_LENGTH\", 
" +
                        "\"columns\".\"number\" + 1 AS \"ORDINAL_POSITION\", " +
+                       "CASE \"null\" " +
+                               "WHEN true THEN CAST ('YES' AS varchar(3)) " +
+                               "WHEN false THEN CAST ('NO' AS varchar(3)) " +
+                       "END AS \"IS_NULLABLE\", " +
                        "cast(null AS varchar(1)) AS \"SCOPE_CATALOG\", " +
                        "cast(null AS varchar(1)) AS \"SCOPE_SCHEMA\", " +
                        "cast(null AS varchar(1)) AS \"SCOPE_TABLE\", " +
-                       "cast(" + MonetDriver.getJavaType("other") + " AS 
smallint) AS \"SOURCE_DATA_TYPE\", " +
-                       "CASE \"null\" " +
-                               "WHEN true THEN CAST ('YES' AS varchar(3)) " +
-                               "WHEN false THEN CAST ('NO' AS varchar(3)) " +
-                       "END AS \"IS_NULLABLE\" " +
+                       "cast(" + MonetDriver.getJavaType("other") + " AS 
smallint) AS \"SOURCE_DATA_TYPE\" " +
                                "FROM \"sys\".\"columns\" AS \"columns\", " +
                                        "\"sys\".\"tables\" AS \"tables\", " +
                                        "\"sys\".\"schemas\" AS \"schemas\" " +
@@ -2102,7 +2105,7 @@ public class MonetDatabaseMetaData exten
                        "\"schemas\".\"name\" AS \"TABLE_SCHEM\", " +
                        "\"tables\".\"name\" AS \"TABLE_NAME\", " +
                        "\"objects\".\"name\" AS \"COLUMN_NAME\", " +
-                       "\"objects\".\"nr\" AS \"KEY_SEQ\", \"keys\".\"name\" 
AS \"PK_NAME\" " +
+                       "\"objects\".\"nr\" + 1 AS \"KEY_SEQ\", 
\"keys\".\"name\" AS \"PK_NAME\" " +
                "FROM \"sys\".\"keys\" AS \"keys\", " +
                        "\"sys\".\"objects\" AS \"objects\", " +
                        "\"sys\".\"tables\" AS \"tables\", " +
@@ -2124,16 +2127,20 @@ public class MonetDatabaseMetaData exten
                return getStmt().executeQuery(query);
        }
 
-       final static String keyQuery =
-               ", \"pkschema\".\"name\" AS \"PKTABLE_SCHEM\", " +
-               "\"pktable\".\"name\" AS \"PKTABLE_NAME\", 
\"pkkeycol\".\"name\" AS \"PKCOLUMN_NAME\", " +
+       final static String keyQuery = "SELECT 'DBSCHEMA_TOKEN' AS 
\"PKTABLE_CAT\", " +
+               "\"pkschema\".\"name\" AS \"PKTABLE_SCHEM\", " +
+               "\"pktable\".\"name\" AS \"PKTABLE_NAME\", " +
+               "\"pkkeycol\".\"name\" AS \"PKCOLUMN_NAME\", " +
+               "'DBSCHEMA_TOKEN'  AS \"FKTABLE_CAT\", " +
                "\"fkschema\".\"name\" AS \"FKTABLE_SCHEM\", " +
-               "\"fktable\".\"name\" AS \"FKTABLE_NAME\", 
\"fkkeycol\".\"name\" AS \"FKCOLUMN_NAME\", " +
-               "\"pkkeycol\".\"nr\" AS \"KEY_SEQ\", " +
+               "\"fktable\".\"name\" AS \"FKTABLE_NAME\", " +
+               "\"fkkeycol\".\"name\" AS \"FKCOLUMN_NAME\", " +
+               "\"pkkeycol\".\"nr\" + 1 AS \"KEY_SEQ\", " +
                DatabaseMetaData.importedKeyNoAction + " AS \"UPDATE_RULE\", " +
                "" + DatabaseMetaData.importedKeyNoAction + " AS 
\"DELETE_RULE\", " +
-               "\"fkkey\".\"name\" AS \"FK_NAME\", \"pkkey\".\"name\" AS 
\"PK_NAME\", " +
-               "" + DatabaseMetaData.importedKeyNotDeferrable + " AS 
\"DEFERRABILITY\" " +
+               "\"fkkey\".\"name\" AS \"FK_NAME\", " +
+               "\"pkkey\".\"name\" AS \"PK_NAME\", " +
+               DatabaseMetaData.importedKeyNotDeferrable + " AS 
\"DEFERRABILITY\" " +
                        "FROM \"sys\".\"keys\" AS \"fkkey\", \"sys\".\"keys\" 
AS \"pkkey\", \"sys\".\"objects\" AS \"fkkeycol\", " +
                        "\"sys\".\"objects\" AS \"pkkeycol\", 
\"sys\".\"tables\" AS \"fktable\", \"sys\".\"tables\" AS \"pktable\", " +
                        "\"sys\".\"schemas\" AS \"fkschema\", 
\"sys\".\"schemas\" AS \"pkschema\" " +
@@ -2145,7 +2152,7 @@ public class MonetDatabaseMetaData exten
 
        static String keyQuery(String cat) {
                // FIXME: cat should probably be single-quote-escaped
-               return "SELECT '" + cat + "' AS \"PKTABLE_CAT\", '" + cat + "' 
AS \"FKTABLE_CAT\"" + keyQuery;
+               return keyQuery.replaceAll("DBSCHEMA_TOKEN",cat);
        }
 
        /**
@@ -2539,7 +2546,7 @@ public class MonetDatabaseMetaData exten
                                "\"schemas\".\"name\" AS \"TABLE_SCHEM\", " +
                                "CASE WHEN \"keys\".\"name\" IS NULL THEN true 
ELSE false END AS \"NON_UNIQUE\", " +
                                "CASE \"idxs\".\"type\" WHEN 0 THEN " + 
DatabaseMetaData.tableIndexHashed + " ELSE " + DatabaseMetaData.tableIndexOther 
+ " END AS \"TYPE\", " +
-                               "\"objects\".\"nr\" AS \"ORDINAL_POSITION\", " +
+                               "\"objects\".\"nr\" + 1 AS 
\"ORDINAL_POSITION\", " +
                                "\"columns\".\"name\" as \"COLUMN_NAME\", " +
                                "cast(null AS varchar(1)) AS 
\"INDEX_QUALIFIER\", " +
                                "cast(null AS varchar(1)) AS \"ASC_OR_DESC\", " 
+
diff --git a/testing/ChangeLog-Archive b/testing/ChangeLog-Archive
--- a/testing/ChangeLog-Archive
+++ b/testing/ChangeLog-Archive
@@ -2,20 +2,19 @@
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to