Changeset: e605cdd6373f for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=e605cdd6373f
Added Files:
        src/main/java/nl/cwi/monetdb/mcl/connection/EmbeddedConnection.java
        src/main/java/nl/cwi/monetdb/mcl/connection/SendThread.java
        src/main/java/nl/cwi/monetdb/mcl/io/JDBCEmbeddedConnection.java
Removed Files:
        src/main/java/nl/cwi/monetdb/embedded/env/IEmbeddedConnection.java
        src/main/java/nl/cwi/monetdb/mcl/connection/EmbeddedMonetDB.java
        src/main/java/nl/cwi/monetdb/mcl/io/EmbeddedMCLReader.java
        src/main/java/nl/cwi/monetdb/mcl/io/EmbeddedMCLWriter.java
        src/main/java/nl/cwi/monetdb/mcl/io/InternalConnection.java
        
src/main/java/nl/cwi/monetdb/mcl/parser/embedded/EmbeddedHeaderLineParser.java
        
src/main/java/nl/cwi/monetdb/mcl/parser/embedded/EmbeddedStartOfHeaderParser.java
        
src/main/java/nl/cwi/monetdb/mcl/parser/embedded/EmbeddedTupleLineParser.java
        src/main/java/nl/cwi/monetdb/responses/SendThread.java
Modified Files:
        ChangeLog
        release.txt
        src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
        src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.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/MonetStatement.java
        src/main/java/nl/cwi/monetdb/mcl/connection/MapiConnection.java
        
src/main/java/nl/cwi/monetdb/mcl/connection/MonetDBConnectionFactory.java
        src/main/java/nl/cwi/monetdb/mcl/io/BufferedMCLReader.java
        src/main/java/nl/cwi/monetdb/mcl/io/BufferedMCLWriter.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/embedded/EmbeddedProtocol.java
        src/main/java/nl/cwi/monetdb/responses/AutoCommitResponse.java
        src/main/java/nl/cwi/monetdb/responses/ResponseList.java
        src/main/java/nl/cwi/monetdb/responses/ResultSetResponse.java
Branch: embedded
Log Message:

More cleaning. Created the responses layer. The JDBC embedded connection will 
be compatible with the standard embedded API.


diffs (truncated from 2449 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,23 @@
 # ChangeLog file for java
 # This file is updated with Maddlog
 
+* Thu Nov 17 2016 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- The MapiSocket object now supports getting and setting the
+  socket timeout, even before the TCP socket is created.  To set
+  the socket timeout specify it in the JDBC URL, for example:
+    jdbc:monetdb://localhost:50000/demo?so_timeout=8000
+  This enables the timeout and sets it to 8000 milliseconds (= 8 seconds).
+  By default the timeout is not set, so wait infinitely.
+
+* Thu Nov 10 2016 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
+- Implemented Connection methods: getClientInfo(name) and getClientInfo().
+  They used to return null and empty Properties object.
+  Corrected implementation of Connection methods: setClientInfo(name, value)
+  and setClientInfo(properties). They are now processed as expected.
+  Corrected implementation of Connection.setHoldability(holdability). It now
+  throws an SQLFeatureNotSupportedException when holdability is not
+  ResultSet.HOLD_CURSORS_OVER_COMMIT (which is the only supported holdability).
+
 * Thu Oct 13 2016 Martin van Dinther <martin.van.dint...@monetdbsolutions.com>
 - Corrected implementation of java.sql.Wrapper methods isWrapperFor()
   and unwrap().  They now properly return expected results instead of
diff --git a/release.txt b/release.txt
--- a/release.txt
+++ b/release.txt
@@ -5,41 +5,39 @@ Release date: 2016-07-13
 This JDBC driver is designed for use with MonetDB, a main-memory
 database.  For more information see https://www.monetdb.org/.
 
+The JDBC driver complies to JDBC 4.1 definition, see
+ http://docs.oracle.com/javase/7/docs/technotes/guides/jdbc/index.html
+
+Note: as of Jul2015 release we compile all the java sources to target: Java 1.7
+so you need a JRE/JDK of version 1.7 or higher to use it.
+
 Within the current implementation not all functionalities of the JDBC
 interface are available.  It is believed, however, that this
 implementation is rich enough to be suitable for a majority of
 application settings.
-Note that this driver is JDBC4 compatible, and hence cannot be compiled
-with Java 1.5 and earlier.
-As of Jul2015 release we compile the java sources to target: Java 1.7.
 
-Below a list of supported features can be found.  Please read this list
-if you intend to use this driver.
+Below a list of (un)supported features can be found.
+Please read this list if you intend to use this driver.
 
 If you feel some features are missing or have encountered an issue/bug,
 please let us know at our bugtracker:
-  https://bugs.monetdb.org/Developers/ReportingABug
+  https://www.monetdb.org/bugzilla/
 
-Currently implemented JDBC interfaces:
+
+Currently implemented JDBC 4.1 interfaces include:
   * java.sql.Driver
 
-  * javax.sql.DataSource (not tested)
-
   * java.sql.Connection
     The next features/methods are NOT implemented:
-    - createStatement with result set holdability
-    - nativeSQL (there is no query parsing for JDBC escapes yet)
-    - prepareCall (CallableStatement not supported)
-    - prepareStatement with column indices or names
-    - setCatalog (there is no catalog)
-    - setHoldability (close/hold cursors over commit is not
-      configurable)
-    - isReadOnly/setReadOnly (updateable result sets are not supported at
-      all)
     - createArrayOf
     - createBlob, createClob, createNClob
     - createStruct
     - createSQLXML
+    - createStatement with result set holdability
+    - prepareCall (CallableStatement is not supported)
+    - prepareStatement with column indices or names
+    - setHoldability (close/hold cursors over commit is not
+      configurable)
   NOTE: be sure to check for warnings after setting concurrencies or
         isolation levels; MonetDB currently does not support anything
         else but "fully serializable" transactions.
@@ -48,19 +46,19 @@ Currently implemented JDBC interfaces:
 
   * java.sql.Statement
     The next features/methods are NOT implemented:
-    - cancel/getQueryTimeout/setQueryTimeout (query execution cannot be
-      terminated, once started)
+    - cancel (query execution cannot be terminated, once started)
     - execute with column indices or names
     - executeUpdate with column indices or names
-    - getMaxFieldSize/setMaxFieldSize
+    - setMaxFieldSize
     - setCursorName
-    - setEscapeProcessing
+    - setEscapeProcessing on
 
   * java.sql.PreparedStatement
     The next features/methods are NOT implemented:
     - setArray
     - setAsciiStream, setBinaryStream, setUnicodeStream
-    - setBlob, setNClob, setNString
+    - setBlob
+    - setNCharacterStream, setNClob, setNString
     - setRef, setRowId, setSQLXML, setURL
 
   * java.sql.ParameterMetaData
@@ -68,14 +66,17 @@ Currently implemented JDBC interfaces:
   * java.sql.ResultSet
     The next features/methods are NOT implemented:
     - getArray
-    - getAsciiStream, getBinaryStream, getUnicodeStream
-    - getRef, getURL
+    - getAsciiStream, getUnicodeStream
+    - getNCharacterStream, getNClob, getNString
+    - getRef, getRowId, getSQLXML
     - all methods related to updateable result sets
 
   * java.sql.ResultSetMetaData
 
   * java.sql.SavePoint
 
+  * java.sql.Wrapper
+
   * java.sql.Blob
     A simple implementation using a byte[] to store the whole BLOB
     The next features/methods are NOT implemented:
@@ -89,7 +90,18 @@ Currently implemented JDBC interfaces:
     - setAsciiStream
     - setCharacterStream
 
+  * javax.sql.DataSource (not tested)
 
-- Auto-commit behaviour is defined by the server which handles the
-  auto-commit.  This is in general in line with the JDBC standard.
 
+The next java.sql.* interfaces are NOT implemented:
+  * java.sql.Array
+  * java.sql.CallableStatement  (use Statement or PreparedStatement instead)
+  * java.sql.NClob
+  * java.sql.Ref
+  * java.sql.Rowid
+  * java.sql.SQLData
+  * java.sql.SQLInput
+  * java.sql.SQLOutput
+  * java.sql.SQLXML
+  * java.sql.Struct
+
diff --git a/src/main/java/nl/cwi/monetdb/embedded/env/IEmbeddedConnection.java 
b/src/main/java/nl/cwi/monetdb/embedded/env/IEmbeddedConnection.java
deleted file mode 100644
--- a/src/main/java/nl/cwi/monetdb/embedded/env/IEmbeddedConnection.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package nl.cwi.monetdb.embedded.env;
-
-/**
- * Created by ferreira on 11/24/16.
- */
-public interface IEmbeddedConnection {
-
-    long getConnectionPointer();
-
-    void closeConnectionImplementation();
-}
diff --git 
a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java 
b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
--- a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
+++ b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedConnection.java
@@ -22,9 +22,9 @@ import java.util.concurrent.ConcurrentHa
  *
  * @author <a href="mailto:pedro.ferre...@monetdbsolutions.com";>Pedro 
Ferreira</a>
  */
-public final class MonetDBEmbeddedConnection implements IEmbeddedConnection {
+public class MonetDBEmbeddedConnection {
 
-       private final long connectionPointer;
+       protected final long connectionPointer;
 
     private final ConcurrentHashMap<Long, AbstractConnectionResult> results = 
new ConcurrentHashMap<>();
 
diff --git 
a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java 
b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java
--- a/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java
+++ b/src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java
@@ -8,8 +8,7 @@
 
 package nl.cwi.monetdb.embedded.env;
 
-import nl.cwi.monetdb.mcl.connection.EmbeddedMonetDB;
-import nl.cwi.monetdb.mcl.io.InternalConnection;
+import nl.cwi.monetdb.mcl.io.JDBCEmbeddedConnection;
 
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -115,7 +114,7 @@ public final class MonetDBEmbeddedDataba
         if(MonetDBEmbeddedDatabase == null) {
             throw new MonetDBEmbeddedException("The database is not running!");
         } else {
-            for(IEmbeddedConnection mdbec : 
MonetDBEmbeddedDatabase.connections.values()) {
+            for(MonetDBEmbeddedConnection mdbec : 
MonetDBEmbeddedDatabase.connections.values()) {
                 mdbec.closeConnectionImplementation();
             }
             MonetDBEmbeddedDatabase.connections.clear();
@@ -139,7 +138,7 @@ public final class MonetDBEmbeddedDataba
 
     private final boolean sequentialFlag;
 
-    private final ConcurrentHashMap<Long, IEmbeddedConnection> connections = 
new ConcurrentHashMap<>();
+    private final ConcurrentHashMap<Long, MonetDBEmbeddedConnection> 
connections = new ConcurrentHashMap<>();
 
     private MonetDBEmbeddedDatabase(String dbDirectory, boolean silentFlag, 
boolean sequentialFlag) {
         this.databaseDirectory = dbDirectory;
@@ -163,23 +162,13 @@ public final class MonetDBEmbeddedDataba
         }
     }
 
-    /*
-     * Creates a connection on the database, set on the default schema 
asynchronously.
-     *
-     * @return A MonetDBEmbeddedConnection instance
-     * @throws MonetDBEmbeddedException If the database is not running or an 
error in the database occurred
-     */
-    /*public CompletableFuture<MonetDBEmbeddedConnection> 
createConnectionAsync() throws MonetDBEmbeddedException {
-        return CompletableFuture.supplyAsync(() -> 
this.createConnectionInternal());
-    }*/
-
-    public static InternalConnection AddJDBCEmbeddedConnection() throws 
MonetDBEmbeddedException {
+    public static JDBCEmbeddedConnection CreateJDBCEmbeddedConnection() throws 
MonetDBEmbeddedException {
         if(MonetDBEmbeddedDatabase == null) {
             throw new MonetDBEmbeddedException("The database is not running!");
         } else {
-            InternalConnection res = 
MonetDBEmbeddedDatabase.createJDBCConnectionInternal();
-            
MonetDBEmbeddedDatabase.connections.put(res.getConnectionPointer(), res);
-            return res;
+            JDBCEmbeddedConnection con = 
MonetDBEmbeddedDatabase.createJDBCEmbeddedConnectionInternal();
+            
MonetDBEmbeddedDatabase.connections.put(con.getConnectionPointer(), con);
+            return con;
         }
     }
 
@@ -210,5 +199,5 @@ public final class MonetDBEmbeddedDataba
     /**
      * Internal implementation to create a JDBC embeddded connection on this 
database.
      */
-    private native InternalConnection createJDBCConnectionInternal() throws 
MonetDBEmbeddedException;
+    private native JDBCEmbeddedConnection 
createJDBCEmbeddedConnectionInternal() throws MonetDBEmbeddedException;
 }
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -7,10 +7,9 @@ import nl.cwi.monetdb.mcl.connection.Deb
 import nl.cwi.monetdb.mcl.connection.MonetDBLanguage;
 import nl.cwi.monetdb.mcl.parser.MCLParseException;
 import nl.cwi.monetdb.responses.ResponseList;
-import nl.cwi.monetdb.responses.SendThread;
+import nl.cwi.monetdb.mcl.connection.SendThread;
 
 import java.io.*;
-import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.sql.*;
 import java.util.*;
@@ -38,16 +37,15 @@ import java.util.concurrent.Executor;
  * The current state of this connection is that it nearly implements the
  * whole Connection interface.
  *
- * @author Fabian Groffen
- * @version 1.2
+ * @author Martin van Dinther
+ * @version 1.3
  */
 public abstract class MonetConnection extends MonetWrapper implements 
Connection {
 
     /** the successful processed input properties */
-    private final Properties conn_props;
-
+    protected final Properties conn_props;
     /** The language to connect with */
-    protected MonetDBLanguage currentMonetDBLanguage = 
MonetDBLanguage.LANG_SQL;
+    protected MonetDBLanguage language;
     /** The database to connect to */
     protected String database;
     /** Authentication hash method */
@@ -96,17 +94,17 @@ public abstract class MonetConnection ex
         this.conn_props = props;
         this.database = database;
         this.hash = hash;
-        this.currentMonetDBLanguage = 
MonetDBLanguage.GetLanguageFromString(language);
+        this.language = MonetDBLanguage.GetLanguageFromString(language);
         this.blobIsBinary = blobIsBinary;
         this.isDebugging = isDebugging;
     }
 
-    public MonetDBLanguage getCurrentMonetDBLanguage() {
-        return currentMonetDBLanguage;
+    public MonetDBLanguage getLanguage() {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to