Changeset: e91f52dc0a4f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e91f52dc0a4f
Modified Files:
        java/ChangeLog.Jun2016
        java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
Branch: Jun2016
Log Message:

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 in the JDBC 
API.


diffs (54 lines):

diff --git a/java/ChangeLog.Jun2016 b/java/ChangeLog.Jun2016
--- a/java/ChangeLog.Jun2016
+++ b/java/ChangeLog.Jun2016
@@ -1,3 +1,10 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Thu Jul  7 2016 Martin van Dinther <[email protected]>
+- 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 in the JDBC 
API.
+
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
@@ -1701,12 +1701,11 @@ public class MonetDatabaseMetaData exten
                        "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\", " +
+                       // in MonetDB procedures have no return value by design.
+                       
"CAST(").append(DatabaseMetaData.procedureNoResult).append(" 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) " +
+               "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");
 
@@ -1771,7 +1770,9 @@ public class MonetDatabaseMetaData exten
         * <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
@@ -1815,7 +1816,8 @@ public class MonetDatabaseMetaData exten
                        "CAST(0 as int) AS \"SQL_DATA_TYPE\", " +
                        "CAST(0 as int) AS \"SQL_DATETIME_SUB\", " +
                        "CAST(CASE WHEN \"args\".\"type\" IN 
('char','varchar','clob') THEN \"args\".\"type_digits\" ELSE NULL END as int) 
AS \"CHAR_OCTET_LENGTH\", " +
-                       "CAST(\"args\".\"number\" as int) AS 
\"ORDINAL_POSITION\", " +
+                       // in MonetDB procedures have no return value by 
design. The arguments in sys.args are numbered from 0 so we must add 1 to 
comply with the API specification.
+                       "CAST(\"args\".\"number\" + 1 as int) AS 
\"ORDINAL_POSITION\", " +
                        "CAST('' as varchar(3)) AS \"IS_NULLABLE\", " +
                        "CAST(null as char(1)) AS \"SPECIFIC_NAME\" " +
                "FROM \"sys\".\"args\", \"sys\".\"functions\", 
\"sys\".\"schemas\" " +
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to