changeset 84:d82bf33bf8a6 embedded

Why I have to deal with Ant now :( No one uses it anymore :(
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Thu, 29 Dec 2016 17:35:23 +0000 (2016-12-29)
parents 724a0061db63
children 073ee535234b
files example/SQLcopyinto.java src/main/java/nl/cwi/monetdb/embedded/env/JDBCEmbeddedConnection.java src/main/java/nl/cwi/monetdb/embedded/env/MonetDBEmbeddedDatabase.java src/main/java/nl/cwi/monetdb/mcl/connection/MonetDBConnectionFactory.java src/main/java/nl/cwi/monetdb/mcl/connection/embedded/JDBCEmbeddedConnection.java src/main/java/nl/cwi/monetdb/mcl/protocol/embedded/EmbeddedProtocol.java
diffstat 6 files changed, 110 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/example/SQLcopyinto.java
+++ b/example/SQLcopyinto.java
@@ -10,10 +10,6 @@ import java.sql.*;
 import java.io.*;
 import java.util.*;
 
-import nl.cwi.monetdb.mcl.connection.DeleteMe;
-import nl.cwi.monetdb.mcl.io.AbstractMCLReader;
-import nl.cwi.monetdb.mcl.io.AbstractMCLWriter;
-
 /**
  * This example demonstrates how the MonetDB JDBC driver can facilitate
  * in performing COPY INTO sequences.  This is mainly meant to show how
@@ -47,7 +43,7 @@ public class SQLcopyinto {
 		// of course also be done simultaneously with the JDBC
 		// connection being kept connected
 
-		DeleteMe server = new DeleteMe("localhost", 50000, "monetdb", "monetdb", false, "sql", "SHA256");
+		/*DeleteMe server = new DeleteMe("localhost", 50000, "monetdb", "monetdb", false, "sql", "SHA256");
 
 		server.setDatabase("database");
 		server.setLanguage("sql");
@@ -107,7 +103,7 @@ public class SQLcopyinto {
 		// free resources, close the statement
 		stmt.close();
 		// close the connection with the database
-		con.close();
+		con.close();*/
 
 	}
 }
rename from src/main/java/nl/cwi/monetdb/mcl/connection/embedded/JDBCEmbeddedConnection.java
rename to src/main/java/nl/cwi/monetdb/embedded/env/JDBCEmbeddedConnection.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/embedded/JDBCEmbeddedConnection.java
+++ b/src/main/java/nl/cwi/monetdb/embedded/env/JDBCEmbeddedConnection.java
@@ -1,6 +1,5 @@
-package nl.cwi.monetdb.mcl.connection.embedded;
+package nl.cwi.monetdb.embedded.env;
 
-import nl.cwi.monetdb.embedded.env.MonetDBEmbeddedConnection;
 import nl.cwi.monetdb.mcl.protocol.ServerResponses;
 import nl.cwi.monetdb.mcl.protocol.StarterHeaders;
 import nl.cwi.monetdb.mcl.protocol.TableResultHeaders;
@@ -67,19 +66,19 @@ public class JDBCEmbeddedConnection exte
         this.sendQueryInternal(this.connectionPointer, query, true);
     }
 
-    void sendAutocommitCommand(int flag) { //1 or 0
+    public void sendAutocommitCommand(int flag) { //1 or 0
         this.sendAutocommitCommandInternal(this.connectionPointer, flag);
     }
 
-    void sendReleaseCommand(int commandId) {
+    public void sendReleaseCommand(int commandId) {
         this.sendReleaseCommandInternal(this.connectionPointer, commandId);
     }
 
-    void sendCloseCommand(int commandId) {
+    public void sendCloseCommand(int commandId) {
         this.sendCloseCommandInternal(this.connectionPointer, commandId);
     }
 
-    void sendReplySizeCommand(int size) {
+    public void sendReplySizeCommand(int size) {
         this.sendReplySizeCommandInternal(this.connectionPointer, size);
     }
 
--- 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,6 @@
 
 package nl.cwi.monetdb.embedded.env;
 
-import nl.cwi.monetdb.mcl.connection.embedded.JDBCEmbeddedConnection;
-
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/MonetDBConnectionFactory.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/MonetDBConnectionFactory.java
@@ -55,9 +55,7 @@ public final class MonetDBConnectionFact
             if (password == null || password.trim().isEmpty())
                 throw new IllegalArgumentException("password should not be null or empty");
 
-            String portout = props.getProperty("portout");
-            boolean negative1 = false;
-            boolean failedparse1 = false;
+            boolean negative1 = false, failedparse1 = false;
             int port = 0;
             try {
                 port = Integer.parseInt(props.getProperty("port"));
@@ -71,11 +69,10 @@ public final class MonetDBConnectionFact
                 props.setProperty("port", MonetDriver.getPORT());
             }
 
-            String timout = props.getProperty("so_timeout", "0");
-            boolean negative2 = false;
-            boolean failedparse2 = false;
+            String timeout = props.getProperty("so_timeout", "0");
+            boolean negative2 = false, failedparse2 = false;
             try {
-                sockTimeout = Integer.parseInt(timout);
+                sockTimeout = Integer.parseInt(timeout);
             } catch (NumberFormatException e) {
                 sockTimeout = 0;
                 failedparse2 = true;
@@ -92,13 +89,13 @@ public final class MonetDBConnectionFact
                 throw new SQLException(e);
             }
             if(failedparse1) {
-                res.addWarning("Unable to parse port number from: " + portout, "M1M05");
+                res.addWarning("Unable to parse port number from: " + port, "M1M05");
             }
             if(negative1) {
                 res.addWarning("Negative port not allowed. Value ignored", "M1M05");
             }
             if(failedparse2) {
-                res.addWarning("Unable to parse socket timeout number from: " + timout, "M1M05");
+                res.addWarning("Unable to parse socket timeout number from: " + timeout, "M1M05");
             }
             if(negative2) {
                 res.addWarning("Negative socket timeout not allowed. Value ignored", "M1M05");
@@ -131,8 +128,7 @@ public final class MonetDBConnectionFact
                     res.addWarning(warning, "01M02");
                 }
             }
-            // apply NetworkTimeout value from legacy (pre 4.1) driver
-            // so_timeout calls
+            // apply NetworkTimeout value from legacy (pre 4.1) driver so_timeout calls
             if(!isEmbedded) {
                 res.setSoTimeout(sockTimeout);
             }
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/embedded/EmbeddedProtocol.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/embedded/EmbeddedProtocol.java
@@ -1,7 +1,7 @@
 package nl.cwi.monetdb.mcl.protocol.embedded;
 
 import nl.cwi.monetdb.jdbc.MonetConnection;
-import nl.cwi.monetdb.mcl.connection.embedded.JDBCEmbeddedConnection;
+import nl.cwi.monetdb.embedded.env.JDBCEmbeddedConnection;
 import nl.cwi.monetdb.mcl.protocol.*;
 import nl.cwi.monetdb.mcl.responses.AutoCommitResponse;
 import nl.cwi.monetdb.mcl.responses.DataBlockResponse;