Changeset: 2090ae325f78 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2090ae325f78
Modified Files:
        NT/Makefile
        NT/monetdb_config.h.in
        gdk/gdk_bbp.c
        gdk/gdk_logger.c
        java/ChangeLog.Jun2016
        java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
Branch: mosaic
Log Message:

Merge with default


diffs (truncated from 567 to 300 lines):

diff --git a/NT/Makefile b/NT/Makefile
--- a/NT/Makefile
+++ b/NT/Makefile
@@ -16,7 +16,7 @@ all: _all
 
 !INCLUDE "$(TOPDIR)\..\NT\rules.msc"
 
-_all: update_winconfig_conds_py "$(srcdir)\Makefile.msc" monetdb_config.h 
unistd.h inttypes.h .monetdb
+_all: update_winconfig_conds_py "$(srcdir)\Makefile.msc" monetdb_config.h 
unistd.h .monetdb
        $(MAKE) /nologo /f "$(srcdir)\Makefile.msc" "prefix=$(prefix)" 
"bits=$(bits)" all
 
 install: targetdirs all
@@ -46,14 +46,6 @@ unistd.h:
        $(ECHO) #endif >> unistd.h
        $(ECHO) #endif >> unistd.h
 
-inttypes.h:
-       $(ECHO) typedef signed char int8_t; > inttypes.h
-       $(ECHO) typedef unsigned char uint8_t; >> inttypes.h
-       $(ECHO) typedef short int16_t; >> inttypes.h
-       $(ECHO) typedef unsigned short uint16_t; >> inttypes.h
-       $(ECHO) typedef int int32_t; >> inttypes.h
-       $(ECHO) typedef unsigned int uint32_t; >> inttypes.h
-
 .monetdb:
        $(ECHO) user=monetdb> .monetdb
        $(ECHO) password=monetdb>> .monetdb
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -148,7 +148,7 @@
 /* #undef HAVE_FDATASYNC */
 
 /* Define to 1 if you have the <fenv.h> header file. */
-#if !defined(_MSC_VER) || _MSC_VER > 1600
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
 #define HAVE_FENV_H 1
 #endif
 
@@ -234,7 +234,9 @@
 /* #undef HAVE_IEEEFP_H */
 
 /* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1      /* generated by the Makefile */
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+#define HAVE_INTTYPES_H 1
+#endif
 
 /* Define to 1 if you have the <io.h> header file. */
 #define HAVE_IO_H 1
@@ -526,13 +528,15 @@
 #define HAVE_SQLGETPRIVATEPROFILESTRING 1
 
 /* Define to 1 if stdbool.h conforms to C99. */
-/* #undef HAVE_STDBOOL_H */
+#if !defined(_MSC_VER) || _MSC_VER >= 1800
+#define HAVE_STDBOOL_H 1
+#endif
 
 /* Define to 1 if you have the <stddef.h> header file. */
 #define HAVE_STDDEF_H 1
 
 /* Define to 1 if you have the <stdint.h> header file. */
-#if !defined(_MSC_VER) || _MSC_VER > 1600
+#if !defined(_MSC_VER) || _MSC_VER >= 1600
 #define HAVE_STDINT_H 1
 #endif
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -76,6 +76,14 @@
 #include "gdk_private.h"
 #include "gdk_storage.h"
 #include "mutils.h"
+
+#ifndef F_OK
+#define F_OK 0
+#endif
+#ifdef _MSC_VER
+#define access(f, m)   _access(f, m)
+#endif
+
 /*
  * The BBP has a fixed address, so re-allocation due to a growing BBP
  * caused by one thread does not disturb reads to the old entries by
@@ -3653,6 +3661,18 @@ BBPsync(int cnt, bat *subcommit)
                        if (BBP_status(i) & BBPEXISTING) {
                                if (b != NULL && BBPbackup(b, subcommit != 
NULL) != GDK_SUCCEED)
                                        break;
+                       } else if (subcommit && (b = BBP_desc(i)) && 
BBP_status(i) & BBPDELETED) {
+                               char o[10];
+                               char *f;
+                               snprintf(o, sizeof(o), "%o", b->batCacheid);
+                               f = GDKfilepath(b->theap.farmid, BAKDIR, o, 
"tail");
+                               if (access(f, F_OK) == 0)
+                                       file_move(b->theap.farmid, BAKDIR, 
SUBDIR, o, "tail");
+                               GDKfree(f);
+                               f = GDKfilepath(b->theap.farmid, BAKDIR, o, 
"theap");
+                               if (access(f, F_OK) == 0)
+                                       file_move(b->theap.farmid, BAKDIR, 
SUBDIR, o, "theap");
+                               GDKfree(f);
                        }
                }
                if (idx < cnt)
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1250,7 +1250,6 @@ bm_subcommit(logger *lg, BAT *list_bid, 
        n[i++] = catalog_bid->batCacheid;
        n[i++] = catalog_nme->batCacheid;
        n[i++] = dcatalog->batCacheid;
-       assert((BUN) i <= nn);
        if (BATcount(dcatalog) > (BATcount(catalog_nme)/2) && catalog_bid == 
list_bid && catalog_nme == list_nme && lg->catalog_bid == catalog_bid) {
                BAT *bids, *nmes, *tids = bm_tids(catalog_bid, dcatalog), *b;
 
@@ -1276,6 +1275,7 @@ bm_subcommit(logger *lg, BAT *list_bid, 
                lg->catalog_bid = catalog_bid = bids;
                lg->catalog_nme = catalog_nme = nmes;
        }
+       assert((BUN) i <= nn);
        BATcommit(catalog_bid);
        BATcommit(catalog_nme);
        BATcommit(dcatalog);
diff --git a/java/ChangeLog.Jun2016 b/java/ChangeLog.Jun2016
--- a/java/ChangeLog.Jun2016
+++ b/java/ChangeLog.Jun2016
@@ -1,3 +1,30 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Thu Jul  7 2016 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Corrected PROCEDURE_TYPE output value of method 
DatabaseMetaData.getProcedures().
+  It used to return procedureReturnsResult. Now it returns procedureNoResult.
+  Corrected ORDINAL_POSITION output value of method 
DatabaseMetaData.getProcedureColumns().
+  It used to start with 0, but as procedures do not return a result value it 
now
+  starts with 1 for all the procedure arguments, as defined by the JDBC API.
+- Improved output of method DatabaseMetaData.getProcedures(). The REMARKS
+  column now contains the procedure definition as stored in sys.functions.func.
+  The SPECIFIC_NAME column now contains the procedure unique identifier as
+  stored in sys.functions.id. This allows the caller to retrieve the specific
+  overloaded procedure which has the same name, but different arguments.
+  Also improved output of method DatabaseMetaData.getProcedureColumns().
+  The SPECIFIC_NAME column now contains the procedure unique identifier as
+  stored in sys.functions.id. This allows the caller to retrieve the proper
+  arguments of the specific overloaded procedure by matching the SPECIFIC_NAME
+  value.
+- Improved output of method DatabaseMetaData.getFunctions(). The REMARKS
+  column now contains the function definition as stored in sys.functions.func.
+  The SPECIFIC_NAME column now contains the function unique identifier as
+  stored in sys.functions.id. This allows the caller to retrieve the specific
+  overloaded function which has the same name, but different arguments.
+  Also improved output of method DatabaseMetaData.getFunctionColumns().
+  The SPECIFIC_NAME column now contains the function unique identifier as
+  stored in sys.functions.id. This allows the caller to retrieve the proper
+  arguments of the specific overloaded function by matching the SPECIFIC_NAME
+  value.
+
diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 
 /**
  * A DatabaseMetaData object suitable for the MonetDB database.
- * 
  *
  * @author Fabian Groffen, Martin van Dinther
  * @version 0.6
@@ -239,8 +238,7 @@ public class MonetDatabaseMetaData exten
        }
 
        /**
-        * What is the version string of this JDBC driver?      Again, this is
-        * static.
+        * Retrieves the version number of this JDBC driver as a String.
         *
         * @return the JDBC driver version string
         */
@@ -505,14 +503,7 @@ public class MonetDatabaseMetaData exten
                        " UNION SELECT 'extract'" +
                        " UNION SELECT 'ifthenelse'" +
                        " UNION SELECT 'isnull'" +
-                       " UNION SELECT 'nullif'" +
-                       // for completeness include also some pseudo columns
-                       " UNION SELECT 'current_role'" +
-                       " UNION SELECT 'current_schema'" +
-                       " UNION SELECT 'current_timezone'" +
-                       " UNION SELECT 'current_user'" +
-                       " UNION SELECT 'session_user'" +
-                       " UNION SELECT 'user'";
+                       " UNION SELECT 'nullif'";
                return getConcatenatedStringFromQuery(FunctionsSelect + 
wherePart + " ORDER BY 1");
        }
 
@@ -1480,11 +1471,12 @@ public class MonetDatabaseMetaData exten
        /**
         * What is the maximum length of a catalog
         *
-        * @return the max length
+        * @return the maximum number of characters allowed in a catalog name;
+        * a result of zero means that there is no limit or the limit is not 
known
         */
        @Override
        public int getMaxCatalogNameLength() {
-               return 1024;
+               return 0;  // MonetDB does not support catalog names
        }
 
        /**
@@ -1682,13 +1674,15 @@ public class MonetDatabaseMetaData exten
         *        <li> procedureReturnsResult - Returns a result
         *      </ul>
         * </ol>
-        * <li><b>SPECIFIC_NAME</b> String => The name which uniquely 
identifies this procedure within its schema. 
+        * <li><b>SPECIFIC_NAME</b> String => The name which uniquely 
identifies this procedure within its schema.
         *
-        * @param catalog - a catalog name; "" retrieves those without a
-        *      catalog; null means drop catalog name from criteria
-        * @param schemaPattern - a schema name pattern; "" retrieves those
-        *      without a schema - we ignore this parameter
-        * @param procedureNamePattern - a procedure name pattern
+        * @param catalog - a catalog name; must match the catalog name as it 
is stored in the database;
+        *      "" retrieves those without a catalog;
+        *      null means that the catalog name should not be used to narrow 
the search
+        * @param schemaPattern - a schema name pattern; must match the schema 
name as it is stored in the database;
+        *      "" retrieves those without a schema;
+        *      null means that the schema name should not be used to narrow 
the search
+        * @param procedureNamePattern - a procedure name pattern; must match 
the procedure name as it is stored in the database
         * @return ResultSet - each row is a procedure description
         * @throws SQLException if a database access error occurs
         */
@@ -1700,19 +1694,18 @@ public class MonetDatabaseMetaData exten
        ) throws SQLException
        {
                StringBuilder query = new StringBuilder(980);
-               query.append("SELECT DISTINCT cast(null as varchar(1)) AS 
\"PROCEDURE_CAT\", " +
+               query.append("SELECT cast(null as varchar(1)) AS 
\"PROCEDURE_CAT\", " +
                        "\"schemas\".\"name\" AS \"PROCEDURE_SCHEM\", " +
                        "\"functions\".\"name\" AS \"PROCEDURE_NAME\", " +
                        "cast(null as char(1)) AS \"Field4\", " +
                        "cast(null as char(1)) AS \"Field5\", " +
                        "cast(null as char(1)) AS \"Field6\", " +
-                       "cast(null as char(1)) AS \"REMARKS\", " +
-                       "CAST(CASE \"args\".\"type\" WHEN NULL THEN 
").append(DatabaseMetaData.procedureNoResult)
-                       .append(" ELSE 
").append(DatabaseMetaData.procedureReturnsResult).append(" END AS smallint) AS 
\"PROCEDURE_TYPE\", " +
-                       "CAST(CASE \"functions\".\"language\" WHEN 0 THEN 
\"functions\".\"mod\" || '.' || \"functions\".\"func\"" +
-                       " ELSE \"schemas\".\"name\" || '.' || 
\"functions\".\"name\" END AS VARCHAR(1500)) AS \"SPECIFIC_NAME\" " +
-               "FROM \"sys\".\"functions\" JOIN \"sys\".\"schemas\" ON 
(\"functions\".\"schema_id\" = \"schemas\".\"id\")" +
-               " LEFT OUTER JOIN \"sys\".\"args\" ON (\"args\".\"func_id\" = 
\"functions\".\"id\" and \"args\".\"number\" = 0) " +
+                       "cast(\"functions\".\"func\" as varchar(9999)) AS 
\"REMARKS\", " +
+                       // in MonetDB procedures have no return value by design.
+                       
"CAST(").append(DatabaseMetaData.procedureNoResult).append(" AS smallint) AS 
\"PROCEDURE_TYPE\", " +
+                       // only the id value uniquely identifies a procedure. 
Include it to be able to differentiate between multiple overloaded procedures 
with the same name
+                       "cast(\"functions\".\"id\" as varchar(10)) AS 
\"SPECIFIC_NAME\" " +
+               "FROM \"sys\".\"functions\" JOIN \"sys\".\"schemas\" ON 
(\"functions\".\"schema_id\" = \"schemas\".\"id\") " +
                // include procedures only (type = 2). Others will be returned 
via getFunctions()
                "WHERE \"functions\".\"type\" = 2");
 
@@ -1737,10 +1730,10 @@ public class MonetDatabaseMetaData exten
         * Get a description of a catalog's stored procedure parameters
         * and result columns.
         *
-        * <p>Only descriptions matching the schema, procedure and parameter
-        * name criteria are returned. They are ordered by PROCEDURE_SCHEM
-        * and PROCEDURE_NAME. Within this, the return value, if any, is
-        * first. Next are the parameter descriptions in call order. The
+        * <p>Only descriptions matching the schema, procedure and parameter 
name
+        * criteria are returned. They are ordered by PROCEDURE_SCHEM, 
PROCEDURE_NAME
+        * and SPECIFIC_NAME. Within this, the return value, if any, is first.
+        * Next are the parameter descriptions in call order. The
         * column descriptions follow in column number order.
         *
         * <p>Each row in the ResultSet is a parameter description or column
@@ -1773,23 +1766,29 @@ public class MonetDatabaseMetaData exten
         * <li><b>COLUMN_DEF</b> String => default value for the column, which 
should be interpreted as a string when the value is enclosed in single quotes 
(may be null)
         *         The string NULL (not enclosed in quotes) - if NULL was 
specified as the default value
         *         TRUNCATE (not enclosed in quotes) - if the specified default 
value cannot be represented without truncation
-        *         NULL - if a default value was not specified 
+        *         NULL - if a default value was not specified
         * <li><b>SQL_DATA_TYPE</b> int => reserved for future use
         * <li><b>SQL_DATETIME_SUB</b> int => reserved for future use
         * <li><b>CHAR_OCTET_LENGTH</b> int => the maximum length of binary and 
character based columns. For any other datatype the returned value is a NULL
-        * <li><b>ORDINAL_POSITION</b> int => the ordinal position, starting 
from 1, for the input and output parameters for a procedure. A value of 0 is 
returned if this row describes the procedure's return value. For result set 
columns, it is the ordinal position of the column in the result set starting 
from 1. If there are multiple result sets, the column ordinal positions are 
implementation defined.
+        * <li><b>ORDINAL_POSITION</b> int => the ordinal position, starting 
from 1, for the input and output parameters for a procedure.
+        *      A value of 0 is returned if this row describes the procedure's 
return value. For result set columns, it is the ordinal position of the
+        *      column in the result set starting from 1. If there are multiple 
result sets, the column ordinal positions are implementation defined.
         * <li><b>IS_NULLABLE</b> String => ISO rules are used to determine the 
nullability for a column.
         * <ul><li>YES --- if the parameter can include NULLs
         * <li>NO --- if the parameter cannot include NULLs
-        * <li>empty string --- if the nullability for the parameter is unknown 
+        * <li>empty string --- if the nullability for the parameter is unknown
         * </ul>
-        * <li><b>SPECIFIC_NAME</b> String => the name which uniquely 
identifies this procedure within its schema. 
+        * <li><b>SPECIFIC_NAME</b> String => the name which uniquely 
identifies this procedure within its schema.
         * </ol>
-        * @param catalog   not used
-        * @param schemaPattern not used
-        * @param procedureNamePattern a procedure name pattern
-        * @param columnNamePattern a column name pattern
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to