Changeset: 4face9f42efc for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=4face9f42efc
Added Files:
        src/main/java/nl/cwi/monetdb/jdbc/MonetCallableStatement.java
        tests/Test_CallableStmt.java
Modified Files:
        ChangeLog
        SQLSTATEs
        build.xml
        example/MJDBCTest.java
        example/PreparedExample.java
        example/SQLImport.java
        release.txt
        src/main/java/nl/cwi/monetdb/client/JMonetDB.java
        src/main/java/nl/cwi/monetdb/client/JdbcClient.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetBlob.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetClob.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDataSource.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
        src/main/java/nl/cwi/monetdb/jdbc/MonetINET.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetSavepoint.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetStatement.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetURL.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetWrapper.java
        src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java
        src/main/java/nl/cwi/monetdb/mcl/connection/IMonetDBLanguage.java
        src/main/java/nl/cwi/monetdb/mcl/connection/MCLException.java
        src/main/java/nl/cwi/monetdb/mcl/connection/SenderThread.java
        
src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
        src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
        
src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
        src/main/java/nl/cwi/monetdb/mcl/connection/helpers/TimestampHelper.java
        src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
        src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
        src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
        src/main/java/nl/cwi/monetdb/mcl/connection/mapi/OldMapiSocket.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/ProtocolException.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiDataBlockResponse.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiServerResponseParser.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiStartOfHeaderParser.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTableHeaderParser.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java
        
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParserHelper.java
        
src/main/java/nl/cwi/monetdb/mcl/responses/AbstractDataBlockResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/AutoCommitResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/IIncompleteResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/IResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/ResultSetResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/SchemaResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/UpdateResponse.java
        src/main/java/nl/cwi/monetdb/merovingian/Control.java
        src/main/java/nl/cwi/monetdb/merovingian/MerovingianException.java
        src/main/java/nl/cwi/monetdb/merovingian/SabaothDB.java
        src/main/java/nl/cwi/monetdb/util/CmdLineOpts.java
        src/main/java/nl/cwi/monetdb/util/Exporter.java
        src/main/java/nl/cwi/monetdb/util/Extract.java
        src/main/java/nl/cwi/monetdb/util/OptionsException.java
        src/main/java/nl/cwi/monetdb/util/SQLExporter.java
        src/main/java/nl/cwi/monetdb/util/SQLRestore.java
        src/main/java/nl/cwi/monetdb/util/XMLExporter.java
        tests/BugConcurrent_clients_SF_1504657.java
        tests/BugConcurrent_sequences.java
        tests/BugDatabaseMetaData_Bug_3356.java
        tests/BugDecimalRound_Bug_3561.java
        tests/BugExecuteUpdate_Bug_3350.java
        tests/BugResultSetMetaData_Bug_6183.java
        tests/BugSetQueryTimeout_Bug_3357.java
        tests/Bug_Connect_as_voc_getMetaData_Failure_Bug_6388.java
        tests/Bug_PrepStmtSetObject_CLOB_6349.java
        tests/Bug_PrepStmtSetString_6382.java
        tests/SQLcopyinto.java
        tests/Test_Cautocommit.java
        tests/Test_Cforkbomb.java
        tests/Test_CisValid.java
        tests/Test_Clargequery.java
        tests/Test_Cmanycon.java
        tests/Test_Creplysize.java
        tests/Test_Csavepoints.java
        tests/Test_Csendthread.java
        tests/Test_Ctransaction.java
        tests/Test_Dobjects.java
        tests/Test_FetchSize.java
        tests/Test_Int128.java
        tests/Test_PSgeneratedkeys.java
        tests/Test_PSgetObject.java
        tests/Test_PSlargeamount.java
        tests/Test_PSlargebatchval.java
        tests/Test_PSlargeresponse.java
        tests/Test_PSmanycon.java
        tests/Test_PSmetadata.java
        tests/Test_PSsomeamount.java
        tests/Test_PSsqldata.java
        tests/Test_PStimedate.java
        tests/Test_PStimezone.java
        tests/Test_PStypes.java
        tests/Test_Rbooleans.java
        tests/Test_Rmetadata.java
        tests/Test_Rpositioning.java
        tests/Test_Rsqldata.java
        tests/Test_Rtimedate.java
        tests/Test_Sbatching.java
        tests/Test_Smoreresults.java
        tests/Test_Wrapper.java
        tests/build.xml
        tests/drop.sql
        version.sh
Branch: embedded
Log Message:

Merge with default.


diffs (truncated from 3612 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,26 @@
 # ChangeLog file for monetdb-java
 # This file is updated with Maddlog
 
+* Thu Mar 21 2019 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Added implementation of java.sql.CallableStatement interface. Some standard
+  Java applications require this JDBC interface for executing SQL stored 
procedures.
+  This implementation resolves request: 
https://www.monetdb.org/bugzilla/show_bug.cgi?id=6402
+
+* Thu Mar  7 2019 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Improved MonetDatabaseMetaData methods:
+  - getNumericFunctions(): it now includes functions: degrees, fuse, ms_round, 
ms_str, ms_trunc and radians.
+  - getStringFunctions(): it now includes function: position.
+  - supportsIntegrityEnhancementFacility() now returns false, as we do not 
enforce CHECK constraints yet.
+
+* Thu Feb  7 2019 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Improved MonetDatabaseMetaData methods:
+  - getNumericFunctions(): it no longer lists aggregate functions: avg, prod 
and sum
+  - getSystemFunctions(): it no longer lists timedate function: extract
+  - getTimeDateFunctions(): it now also lists functions: date_trunc, epoch
+- Corrected MonetDatabaseMetaData method getTypeInfo() for result column
+  SEARCHABLE. It now returns DatabaseMetaData.typeSearchable for all
+  string data types including 'inet','json','url','uuid' and 'blob'.
+
 * Thu Sep 20 2018 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
 - Improved example program SQLcopyinto.java and moved it to tests directory
   for automatic testing.
diff --git a/SQLSTATEs b/SQLSTATEs
--- a/SQLSTATEs
+++ b/SQLSTATEs
@@ -67,5 +67,5 @@ JDBC 4.1 defines the following SQLExcept
    null SQLTimeoutException
 
 See also: http://docs.oracle.com/javase/7/docs/api/java/sql/SQLException.html
-See also: https://en.wikibooks.org/wiki/Structured_Query_Language/SQLSTATE
+See also: https://en.wikipedia.org/wiki/SQLSTATE
 
diff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
@@ -5,7 +5,7 @@ This Source Code Form is subject to the 
 License, v. 2.0.  If a copy of the MPL was not distributed with this
 file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
 -->
 
 <!--
diff --git a/example/MJDBCTest.java b/example/MJDBCTest.java
--- a/example/MJDBCTest.java
+++ b/example/MJDBCTest.java
@@ -3,7 +3,7 @@
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  */
 
 import java.sql.*;
@@ -18,7 +18,7 @@ import java.sql.*;
 public class MJDBCTest {
        public static void main(String[] args) throws Exception {
                String MonetDB_JDBC_URL = 
"jdbc:monetdb://localhost:50000/demo";        // change host, port and 
databasename
-               Connection con;
+               Connection con = null;
                try {
                        con = DriverManager.getConnection(MonetDB_JDBC_URL, 
"monetdb", "monetdb");
                } catch (SQLException e) {
diff --git a/example/PreparedExample.java b/example/PreparedExample.java
--- a/example/PreparedExample.java
+++ b/example/PreparedExample.java
@@ -3,7 +3,7 @@
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  */
 
 import java.sql.*;
diff --git a/example/SQLImport.java b/example/SQLImport.java
--- a/example/SQLImport.java
+++ b/example/SQLImport.java
@@ -3,7 +3,7 @@
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  */
 
 import java.sql.*;
@@ -14,7 +14,7 @@ import java.io.*;
  * it's simpleness it only supports SQL queries which entirely are on one line.
  *
  * This program reads a file line by line, and feeds the line into a running
- * Mserver on the localhost. Upon error, the error is reported and the program
+ * Mserver5 on the localhost. Upon error, the error is reported and the program
  * continues reading and executing lines.
  * A very lousy way of implementing options is used to somewhat configure the
  * behaviour of the program in order to be a bit more verbose or commit after
@@ -37,11 +37,11 @@ public class SQLImport {
                // open the file
                BufferedReader fr = new BufferedReader(new FileReader(args[0]));
 
-               // request a connection suitable for Monet from the driver 
manager
+               // request a connection suitable for MonetDB from the driver 
manager
                // note that the database specifier is currently not 
implemented, for
-               // Monet itself can't access multiple databases.
+               // MonetDB itself can't access multiple databases.
                // turn on debugging
-               Connection con = 
DriverManager.getConnection("jdbc:monetdb://localhost/database?debug=true", 
"monetdb", "monetdb");
+               Connection con = 
DriverManager.getConnection("jdbc:monetdb://localhost/demo?debug=true", 
"monetdb", "monetdb");
 
                boolean beVerbose = false;
                if (args.length == 3) {
@@ -58,13 +58,15 @@ public class SQLImport {
 
                String query;
                for (int i = 1; (query = fr.readLine()) != null; i++) {
-                       if (beVerbose) System.out.println(query);
+                       if (beVerbose)
+                               System.out.println(query);
                        try {
                                // execute the query, no matter what it is
                                stmt.execute(query);
                        } catch (SQLException e) {
                                System.out.println("Error on line " + i + ": " 
+ e.getMessage());
-                               if (!beVerbose) System.out.println(query);
+                               if (!beVerbose)
+                                       System.out.println(query);
                        }
                }
 
diff --git a/release.txt b/release.txt
--- a/release.txt
+++ b/release.txt
@@ -55,11 +55,9 @@ Currently implemented JDBC 4.1 interface
   * java.sql.Driver
 
   * java.sql.Connection
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - createArrayOf, createNClob, createStruct, createSQLXML
     - createStatement with result set holdability
-    - prepareCall (CallableStatement is not supported)
-       see also: https://www.monetdb.org/bugzilla/show_bug.cgi?id=6402
     - prepareStatement with array of column indices or column names
     - setHoldability (close/hold cursors over commit is not configurable)
 
@@ -70,7 +68,7 @@ Currently implemented JDBC 4.1 interface
   * java.sql.DatabaseMetaData
 
   * java.sql.Statement
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - cancel (query execution cannot be terminated, once started)
        see also: https://www.monetdb.org/bugzilla/show_bug.cgi?id=6222
     - execute with column indices or names
@@ -80,7 +78,7 @@ Currently implemented JDBC 4.1 interface
     - setEscapeProcessing on
 
   * java.sql.PreparedStatement
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - setArray
     - setAsciiStream, setBinaryStream, setUnicodeStream
     - setBlob
@@ -89,8 +87,17 @@ Currently implemented JDBC 4.1 interface
 
   * java.sql.ParameterMetaData
 
+  * java.sql.CallableStatement
+    The next methods are NOT useable/supported:
+    - all getXyz(parameterIndex/parameterName, ...) methods because
+      output parameters in stored procedures are not supported by MonetDB
+    - all registerOutParameter(parameterIndex/parameterName, int sqlType, ...) 
methods
+      because output parameters in stored procedures are not supported by 
MonetDB
+    - wasNull() method because output parameters in stored procedures are
+      not supported by MonetDB
+
   * java.sql.ResultSet
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - getArray
     - getAsciiStream, getUnicodeStream
     - getNClob
@@ -105,12 +112,12 @@ Currently implemented JDBC 4.1 interface
 
   * java.sql.Blob
     A simple implementation using a byte[] to store the whole BLOB
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - setBinaryStream
 
   * java.sql.Clob
     A simple implementation using a StringBuilder to store the whole CLOB
-    The next features/methods are NOT implemented:
+    The next features/methods are NOT useable/supported:
     - getAsciiStream
     - setAsciiStream
     - setCharacterStream
@@ -124,8 +131,6 @@ Currently implemented JDBC 4.1 interface
 
 The next java.sql.* interfaces are NOT implemented:
   * java.sql.Array
-  * java.sql.CallableStatement  (use Statement or PreparedStatement instead)
-     see also: https://www.monetdb.org/bugzilla/show_bug.cgi?id=6402
   * java.sql.NClob
   * java.sql.Ref
   * java.sql.Rowid
diff --git a/src/main/java/nl/cwi/monetdb/client/JMonetDB.java 
b/src/main/java/nl/cwi/monetdb/client/JMonetDB.java
--- a/src/main/java/nl/cwi/monetdb/client/JMonetDB.java
+++ b/src/main/java/nl/cwi/monetdb/client/JMonetDB.java
@@ -3,7 +3,7 @@
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  */
 
 package nl.cwi.monetdb.client;
diff --git a/src/main/java/nl/cwi/monetdb/client/JdbcClient.java 
b/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
--- a/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
+++ b/src/main/java/nl/cwi/monetdb/client/JdbcClient.java
@@ -3,7 +3,7 @@
  * License, v. 2.0.  If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
+ * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
  */
 
 package nl.cwi.monetdb.client;
@@ -444,7 +444,7 @@ public final class JdbcClient {
                                                        " v" + 
dbmd.getDriverVersion());
                                        }
                                        out.println("Current Schema: " + 
con.getSchema());
-                                       out.println("Type \\q to quit, \\h for 
a list of available commands");
+                                       out.println("Type \\q to quit (you can 
also use: quit or exit), \\? or \\h for a list of available commands");
                                        out.flush();
                                }
                                processInteractive(false, doEcho, scolonterm, 
user);
@@ -605,76 +605,85 @@ public final class JdbcClient {
                                doProcess = true;
                                if (wasComplete) {
                                        doProcess = false;
-                                       // check for commands only when the 
previous row was
-                                       // complete
-                                       if (command.equals("\\q")) {
+                                       // check for commands only when the 
previous row was complete
+                                       if (command.equals("\\q") || 
command.equals("quit") || command.equals("exit")) {
                                                // quit
                                                break;
-                                       } else if (command.startsWith("\\h")) {
+                                       } else if (command.equals("\\?") || 
command.equals("\\h")) {
                                                out.println("Available 
commands:");
-                                               out.println("\\q      quits 
this program");
-                                               out.println("\\h      this help 
screen");
-                                               if (dbmd != null)
-                                                       out.println("\\d      
list available tables and views in current schema");
-                                               out.println("\\d<obj> describes 
the given table or view");
-                                               out.println("\\l<uri> executes 
the contents of the given file or URL");
-                                               out.println("\\i<uri> batch 
executes the inserts from the given file or URL");
+                                               out.println("\\q       quits 
this program (you can also use: quit or exit)");
+                                               if (dbmd != null) {
+                                                       out.println("\\d       
list available tables and views in current schema");
+                                                       out.println("\\dS      
list available system tables and views in sys schema");
+                                                       out.println("\\d <obj> 
describes the given table or view");
+                                               }
+                                               out.println("\\l<uri>  executes 
the contents of the given file or URL");
+                                               out.println("\\i<uri>  batch 
executes the inserts from the given file or URL");
+                                               out.println("\\? or \\h this 
help screen");
                                        } else if (dbmd != null && 
command.startsWith("\\d")) {
                                                ResultSet tbl = null;
                                                try {
-                                                       String object = 
command.substring(2).trim();
-                                                       if (scolonterm && 
object.endsWith(";"))
-                                                               object = 
object.substring(0, object.length() - 1);
-                                                       if (object.isEmpty()) {
-                                                               // list 
available tables and views in current schema
-                                                               String 
current_schema = con.getSchema();
-                                                               tbl = 
dbmd.getTables(null, current_schema, null, null);
+                                                       if 
(command.equals("\\dS")) {
+                                                               // list 
available system tables and views in sys schema
+                                                               tbl = 
dbmd.getTables(null, "sys", null, null);
 
                                                                // give us a 
list of all non-system tables and views (including temp ones)
                                                                while 
(tbl.next()) {
                                                                        String 
tableType = tbl.getString(4);    // 4 = "TABLE_TYPE"
-                                                                       if 
(tableType != null && !tableType.startsWith("SYSTEM "))
+                                                                       if 
(tableType != null && tableType.startsWith("SYSTEM "))
                                                                                
out.println(tableType + "\t" +
                                                                                
        tbl.getString(2) + "." +        // 2 = "TABLE_SCHEM"
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to