Changeset: 953422c41194 for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=953422c41194
Added Files:
        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
Removed Files:
        src/main/java/nl/cwi/monetdb/mcl/connection/socket/AbstractSocket.java
        src/main/java/nl/cwi/monetdb/mcl/connection/socket/MapiConnection.java
        src/main/java/nl/cwi/monetdb/mcl/connection/socket/MapiLanguage.java
        src/main/java/nl/cwi/monetdb/mcl/connection/socket/OldMapiSocket.java
Modified Files:
        src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
        src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.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/MonetDBConnectionFactory.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/embedded/EmbeddedProtocol.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/newmapi/NewMapiProtocol.java
        src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.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/responses/DataBlockResponse.java
        src/main/java/nl/cwi/monetdb/mcl/responses/ResultSetResponse.java
Branch: embedded
Log Message:

The data retrieval in ResultSets is now Column wise. Ready to start the 
embedded integrate, but it has to perform extra tests for the more rare types.


diffs (truncated from 1788 to 300 lines):

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
@@ -3,7 +3,7 @@ package nl.cwi.monetdb.jdbc;
 import nl.cwi.monetdb.jdbc.types.INET;
 import nl.cwi.monetdb.jdbc.types.URL;
 import nl.cwi.monetdb.mcl.connection.*;
-import nl.cwi.monetdb.mcl.connection.socket.MapiLanguage;
+import nl.cwi.monetdb.mcl.connection.mapi.MapiLanguage;
 import nl.cwi.monetdb.mcl.protocol.ProtocolException;
 import nl.cwi.monetdb.mcl.protocol.AbstractProtocol;
 import nl.cwi.monetdb.mcl.protocol.ServerResponses;
@@ -1344,9 +1344,8 @@ public abstract class MonetConnection ex
     }
 
     /**
-     * A list of Response objects.  Responses are added to this list.
-     * Methods of this class are not synchronized.  This is left as
-     * responsibility to the caller to prevent concurrent access.
+     * A list of Response objects. Responses are added to this list. Methods 
of this class are not synchronized. This is
+     * left as responsibility to the caller to prevent concurrent access.
      */
     public class ResponseList {
 
@@ -1368,9 +1367,8 @@ public abstract class MonetConnection ex
         private int curResponse = -1;
 
         /**
-         * Main constructor.  The query argument can either be a String
-         * or List.  An SQLException is thrown if another object
-         * instance is supplied.
+         * Main constructor. The query argument can either be a String or 
List.  An SQLException is thrown if another
+         * object instance is supplied.
          *
          * @param cachesize overall cachesize to use
          * @param maxrows maximum number of rows to allow in the set
@@ -1419,8 +1417,7 @@ public abstract class MonetConnection ex
             }
             curResponse++;
             if (curResponse >= responses.size()) {
-                // ResponseList is obviously completed so, there are no
-                // more responses
+                // ResponseList is obviously completed so, there are no more 
responses
                 return null;
             } else {
                 // return this response
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java
@@ -293,12 +293,12 @@ final public class MonetDriver implement
                typeMap.put("date", Types.DATE);
                typeMap.put("decimal", Types.DECIMAL);
                typeMap.put("double", Types.DOUBLE);
-               typeMap.put("geometry", Types.VARCHAR);
-               typeMap.put("geometrya", Types.VARCHAR);
+               typeMap.put("geometry", Types.OTHER);
+               typeMap.put("geometrya", Types.OTHER);
                typeMap.put("hugeint", Types.NUMERIC); //but we will convert to 
java.math.BigInteger
-               typeMap.put("inet", Types.VARCHAR);
+               typeMap.put("inet", Types.OTHER);
                typeMap.put("int", Types.INTEGER);
-               typeMap.put("json", Types.VARCHAR);
+               typeMap.put("json", Types.OTHER);
                // typeMap.put("mbr", Types.???);
                typeMap.put("month_interval", Types.INTEGER);
                // typeMap.put("oid", Types.BIGINT);
@@ -314,8 +314,8 @@ final public class MonetDriver implement
                typeMap.put("timetz", Types.TIME);
         // new in Java 8: Types.TIME_WITH_TIMEZONE (value 2013). Can't use it 
yet as we compile for java 7
                typeMap.put("tinyint", Types.TINYINT);
-               typeMap.put("url", Types.VARCHAR);
-               typeMap.put("uuid", Types.VARCHAR);
+               typeMap.put("url", Types.OTHER);
+               typeMap.put("uuid", Types.OTHER);
                typeMap.put("varchar", Types.VARCHAR);
                typeMap.put("wrd", Types.BIGINT);
        }
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -67,6 +67,20 @@ import java.util.Map;
  * @version 0.4
  */
 public class MonetPreparedStatement extends MonetStatement implements 
PreparedStatement {
+
+       /* only parse the date patterns once, use multiple times */
+       /** Format of a timestamp with RFC822 time zone */
+       private static final SimpleDateFormat MTimestampZ = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
+       /** Format of a timestamp */
+       private static final SimpleDateFormat MTimestamp = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+       /** Format of a time with RFC822 time zone */
+       private static final SimpleDateFormat MTimeZ = new 
SimpleDateFormat("HH:mm:ss.SSSZ");
+       /** Format of a time */
+       private static final SimpleDateFormat MTime = new 
SimpleDateFormat("HH:mm:ss.SSS");
+       /** Format of a date used by mserver */
+       private static final SimpleDateFormat MDate = new 
SimpleDateFormat("yyyy-MM-dd");
+
+       private final MonetConnection connection;
        private final String[] monetdbType;
        private final int[] javaType;
        private final int[] digits;
@@ -77,28 +91,11 @@ public class MonetPreparedStatement exte
        private final int id;
        private final int size;
        private final int rscolcnt;
-
        private final String[] values;
-       
-       private final MonetConnection connection;
-
-       /* only parse the date patterns once, use multiple times */
-       /** Format of a timestamp with RFC822 time zone */
-       private final SimpleDateFormat mTimestampZ = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
-       /** Format of a timestamp */
-       private final SimpleDateFormat mTimestamp = new 
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-       /** Format of a time with RFC822 time zone */
-       private final SimpleDateFormat mTimeZ = new 
SimpleDateFormat("HH:mm:ss.SSSZ");
-       /** Format of a time */
-       private final SimpleDateFormat mTime = new 
SimpleDateFormat("HH:mm:ss.SSS");
-       /** Format of a date used by mserver */
-       private final SimpleDateFormat mDate = new 
SimpleDateFormat("yyyy-MM-dd");
 
        /**
-        * MonetPreparedStatement constructor which checks the arguments for
-        * validity.  A MonetPreparedStatement is backed by a
-        * {@link MonetStatement}, which deals with most of the required stuff 
of
-        * this class.
+        * MonetPreparedStatement constructor which checks the arguments for 
validity. A MonetPreparedStatement is backed
+        * by a {@link MonetStatement}, which deals with most of the required 
stuff of this class.
         *
         * @param connection the connection that created this Statement
         * @param resultSetType type of {@link ResultSet} to produce
@@ -153,8 +150,7 @@ public class MonetPreparedStatement exte
        //== methods interface PreparedStatement
 
        /**
-        * Adds a set of parameters to this PreparedStatement object's batch
-        * of commands.
+        * Adds a set of parameters to this PreparedStatement object's batch of 
commands.
         *
         * @throws SQLException if a database access error occurs
         */
@@ -197,10 +193,9 @@ public class MonetPreparedStatement exte
         * getUpdateCount to retrieve the result; you must call
         * getMoreResults to move to any subsequent result(s).
         *
-        * @return true if the first result is a ResultSet object; false if the
-        *              first result is an update count or there is no result
-        * @throws SQLException if a database access error occurs or an argument
-        *                      is supplied to this method
+        * @return true if the first result is a ResultSet object; false if the 
first result is an update count or there is
+        * no result
+        * @throws SQLException if a database access error occurs or an 
argument is supplied to this method
         */
        @Override
        public boolean execute() throws SQLException {
@@ -214,13 +209,10 @@ public class MonetPreparedStatement exte
        }
 
        /**
-        * Executes the SQL query in this PreparedStatement object and returns 
the
-        * ResultSet object generated by the query.
+        * Executes the SQL query in this PreparedStatement object and returns 
the ResultSet object generated by the query.
         *
-        * @return a ResultSet object that contains the data produced by the 
query;
-        *         never null
-        * @throws SQLException if a database access error occurs or the SQL
-        *                      statement does not return a ResultSet object
+        * @return a ResultSet object that contains the data produced by the 
query never null
+        * @throws SQLException if a database access error occurs or the SQL 
statement does not return a ResultSet object
         */
        @Override
        public ResultSet executeQuery() throws SQLException {
@@ -243,8 +235,7 @@ public class MonetPreparedStatement exte
         *
         * @return either (1) the row count for INSERT, UPDATE, or DELETE
         *         statements or (2) 0 for SQL statements that return nothing
-        * @throws SQLException if a database access error occurs or the SQL
-        *                     statement returns a ResultSet object
+        * @throws SQLException if a database access error occurs or the SQL 
statement returns a ResultSet object
         */
        @Override
        public int executeUpdate() throws SQLException {
@@ -275,6 +266,7 @@ public class MonetPreparedStatement exte
                }
                throw new SQLException("No such column with index: " + colnr, 
"M1M05");
        }
+
        /**
         * Returns the index (0..size-1) in the backing arrays for the given
         * parameter number or an SQLException when not found
@@ -291,7 +283,6 @@ public class MonetPreparedStatement exte
                throw new SQLException("No such parameter with index: " + 
paramnr, "M1M05");
        }
 
-
        /* helper for the anonymous class inside getMetaData */
        private abstract class rsmdw extends MonetWrapper implements 
ResultSetMetaData {}
        /**
@@ -377,8 +368,7 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Indicates whether the designated column can be used 
in a
-                        * where clause.
+                        * Indicates whether the designated column can be used 
in a where clause.
                         *
                         * Returning true for all here, even for CLOB, BLOB.
                         *
@@ -391,11 +381,9 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Indicates whether the designated column is a cash 
value.
-                        * From the MonetDB database perspective it is by 
definition
-                        * unknown whether the value is a currency, because 
there are
-                        * no currency datatypes such as MONEY.  With this 
knowledge
-                        * we can always return false here.
+                        * Indicates whether the designated column is a cash 
value. From the MonetDB database perspective it is by
+                        * definition unknown whether the value is a currency, 
because there are no currency datatypes such as
+                        * MONEY. With this knowledge we can always return 
false here.
                         *
                         * @param column the first column is 1, the second is 
2, ...
                         * @return false
@@ -406,8 +394,7 @@ public class MonetPreparedStatement exte
                        }
                        
                        /**
-                        * Indicates whether values in the designated column 
are signed
-                        * numbers.
+                        * Indicates whether values in the designated column 
are signed numbers.
                         * Within MonetDB all numeric types (except oid and 
ptr) are signed.
                         *
                         * @param column the first column is 1, the second is 
2, ...
@@ -438,12 +425,10 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Indicates the designated column's normal maximum 
width in
-                        * characters.
+                        * Indicates the designated column's normal maximum 
width in characters.
                         *
                         * @param column the first column is 1, the second is 
2, ...
-                        * @return the normal maximum number of characters 
allowed as the
-                        *         width of the designated column
+                        * @return the normal maximum number of characters 
allowed as the width of the designated column
                         * @throws SQLException if there is no such column
                         */
                        @Override
@@ -487,10 +472,8 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Get the designated column's number of decimal digits.
-                        * This method is currently very expensive as it needs 
to
-                        * retrieve the information from the database using an 
SQL
-                        * query.
+                        * Get the designated column's number of decimal 
digits. This method is currently very expensive as it
+                        * needs to retrieve the information from the database 
using an SQL query.
                         *
                         * @param column the first column is 1, the second is 
2, ...
                         * @return precision
@@ -506,10 +489,8 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Gets the designated column's number of digits to 
right of
-                        * the decimal point.  This method is currently very
-                        * expensive as it needs to retrieve the information 
from
-                        * the database using an SQL query.
+                        * Gets the designated column's number of digits to 
right of the decimal point. This method is currently
+                        * very expensive as it needs to retrieve the 
information from the database using an SQL query.
                         *
                         * @param column the first column is 1, the second is 
2, ...
                         * @return scale
@@ -525,10 +506,8 @@ public class MonetPreparedStatement exte
                        }
 
                        /**
-                        * Indicates the nullability of values in the designated
-                        * column.  This method is currently very expensive as 
it
-                        * needs to retrieve the information from the database 
using
-                        * an SQL query.
+                        * Indicates the nullability of values in the 
designated column. This method is currently very expensive as
+                        * it needs to retrieve the information from the 
database using an SQL query.
                         *
                         * @param column the first column is 1, the second is 
2, ...
                         * @return nullability
@@ -544,8 +523,7 @@ public class MonetPreparedStatement exte
                         * MonetDB does not support the catalog naming concept 
as in: catalog.schema.table naming scheme
                         *
                         * @param column the first column is 1, the second is 
2, ...
-                        * @return the name of the catalog for the table in 
which the given
-                        *         column appears or "" if not applicable
+                        * @return the name of the catalog for the table in 
which the given column appears or "" if not applicable
                         */
                        @Override
                        public String getCatalogName(int column) throws 
SQLException {
@@ -553,9 +531,8 @@ public class MonetPreparedStatement exte
                        }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to