annotate src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 102:08bc9009d190 embedded

Merged with default
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Fri, 13 Jan 2017 18:16:30 +0100 (2017-01-13)
parents 551093abca52 b9b35ca2eec2
children a00241382675
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1 package nl.cwi.monetdb.jdbc;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
3 import nl.cwi.monetdb.mcl.connection.*;
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
4 import nl.cwi.monetdb.mcl.connection.SenderThread;
73
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
5 import nl.cwi.monetdb.mcl.connection.mapi.MapiLanguage;
68
86967be24645 Ready to start testing the old mapi connection. After passing the tests. The embedded integration will be very straightforward.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 67
diff changeset
6 import nl.cwi.monetdb.mcl.protocol.ProtocolException;
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
7 import nl.cwi.monetdb.mcl.protocol.AbstractProtocol;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
8 import nl.cwi.monetdb.mcl.protocol.ServerResponses;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
9 import nl.cwi.monetdb.mcl.protocol.StarterHeaders;
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
10 import nl.cwi.monetdb.mcl.responses.*;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
11 import nl.cwi.monetdb.mcl.responses.DataBlockResponse;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
12 import nl.cwi.monetdb.mcl.responses.ResultSetResponse;
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
13
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
14 import java.io.*;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
15 import java.net.SocketTimeoutException;
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
16 import java.sql.*;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
17 import java.util.*;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
18 import java.util.concurrent.Executor;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
19
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
20 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
21 * A {@link Connection} suitable for the MonetDB database.
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
22 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
23 * This connection represents a connection (session) to a MonetDB
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
24 * database. SQL statements are executed and results are returned within
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
25 * the context of a connection. This Connection object holds a physical
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
26 * connection to the MonetDB database.
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
27 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
28 * A Connection object's database should able to provide information
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
29 * describing its tables, its supported SQL grammar, its stored
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
30 * procedures, the capabilities of this connection, and so on. This
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
31 * information is obtained with the getMetaData method.
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
32 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
33 * Note: By default a Connection object is in auto-commit mode, which
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
34 * means that it automatically commits changes after executing each
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
35 * statement. If auto-commit mode has been disabled, the method commit
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
36 * must be called explicitly in order to commit changes; otherwise,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
37 * database changes will not be saved.
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
38 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
39 * The current state of this connection is that it nearly implements the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
40 * whole Connection interface.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
41 *
101
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
42 * @author Fabian Groffen, Martin van Dinther, Pedro Ferreira
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
43 * @version 1.3
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
44 */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
45 public abstract class MonetConnection extends MonetWrapper implements Connection {
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
46
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
47 /** The sequence counter */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
48 private static int SeqCounter = 0;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
49
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
50 public static int GetSeqCounter() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
51 return SeqCounter;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
52 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
53
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
54 /** The successful processed input properties */
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
55 protected final Properties conn_props;
63
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
56 /** The language to connect with */
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
57 protected IMonetDBLanguage language;
63
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
58 /** Authentication hash method */
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
59 protected final String hash;
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
60 /** An optional thread that is used for sending large queries */
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
61 private SenderThread senderThread;
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
62 /** Whether this Connection is closed (and cannot be used anymore) */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
63 private boolean closed;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
64 /** Whether this Connection is in autocommit mode */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
65 private boolean autoCommit = true;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
66 /** The stack of warnings for this Connection object */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
67 private SQLWarning warnings;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
68 /** The Connection specific mapping of user defined types to Java types */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
69 private Map<String,Class<?>> typeMap = new HashMap<String,Class<?>>() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
70 private static final long serialVersionUID = 1L; {
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
71 put("inet", MonetINET.class);
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
72 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
73 };
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
74
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
75 // See javadoc for documentation about WeakHashMap if you don't know what it does !!!NOW!!!
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
76 // (only when you deal with it of course)
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
77 /** A Map containing all (active) Statements created from this Connection */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
78 private Map<Statement,?> statements = new WeakHashMap<Statement, Object>();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
79 /** The number of results we receive from the server at once */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
80 private int curReplySize = -1; // the server by default uses -1 (all)
93
eeb71f7d36bf Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 91
diff changeset
81 /** Whether or not BLOB is mapped to LONGVARBINARY within the driver */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
82 private final boolean blobIsBinary;
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
83 /** Whether or not CLOB is mapped to LONGVARCHAR within the driver */
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
84 private final boolean clobIsLongChar;
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
85 /** The underlying proticol provided by the connection (MAPI or embedded) */
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
86 protected AbstractProtocol protocol;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
87
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
88 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
89 * Constructor of a Connection for MonetDB. At this moment the current implementation limits itself to storing the
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
90 * given host, database, username and password for later use by the createStatement() call. This constructor is
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
91 * only accessible to classes from the jdbc package.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
92 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
93 * @throws IOException if an error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
94 */
93
eeb71f7d36bf Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 91
diff changeset
95 public MonetConnection(Properties props, String hash, IMonetDBLanguage language, boolean blobIsBinary,
eeb71f7d36bf Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 91
diff changeset
96 boolean clobIsLongChar) throws IOException {
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
97 this.conn_props = props;
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
98 this.hash = hash;
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
99 this.language = language;
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
100 this.blobIsBinary = blobIsBinary;
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
101 this.clobIsLongChar = clobIsLongChar;
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
102 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
103
101
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
104 /**
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
105 * Gets the connection's language data.
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
106 *
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
107 * @return The connection's language data
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
108 */
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
109 public IMonetDBLanguage getLanguage() {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
110 return language;
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
111 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
112
101
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
113 /**
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
114 * Gets the connection's protocol.
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
115 *
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
116 * @return The connection's protocol
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
117 */
83
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
118 public AbstractProtocol getProtocol() {
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
119 return this.protocol;
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
120 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
121
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
122 /**
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
123 * Connects to the server, authenticating the user.
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
124 *
101
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
125 * @param user The user name to authenticate
551093abca52 More documentation and fixed some tests.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 100
diff changeset
126 * @param pass The user's password
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
127 * @return A List with informational (warning) messages. If this list is empty; then there are no warnings.
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
128 * @throws IOException if an I/O error occurs when creating the socket
68
86967be24645 Ready to start testing the old mapi connection. After passing the tests. The embedded integration will be very straightforward.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 67
diff changeset
129 * @throws ProtocolException if bogus data is received
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
130 * @throws MCLException if an MCL related error occurs
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
131 */
68
86967be24645 Ready to start testing the old mapi connection. After passing the tests. The embedded integration will be very straightforward.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 67
diff changeset
132 public abstract List<String> connect(String user, String pass) throws IOException, ProtocolException, MCLException;
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
133
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
134 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
135 * Gets the underlying connection block size length.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
136 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
137 * @return The block size length
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
138 */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
139 public abstract int getBlockSize();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
140
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
141 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
142 * Gets the underlying connection default fetch size for DataBlock responses.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
143 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
144 * @return The default fetch size
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
145 */
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
146 public abstract int getDefFetchsize();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
147
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
148 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
149 * Gets the underlying connection socket timeout.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
150 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
151 * @return The underlying connection socket timeout
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
152 */
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
153 public abstract int getSoTimeout();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
154
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
155 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
156 * Sets the underlying connection socket timeout.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
157 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
158 * @param timeout The specified timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
159 */
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
160 public abstract void setSoTimeout(int timeout);
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
161
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
162 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
163 * Closes the underlying connection implementation.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
164 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
165 * @throws IOException if an I/O error occurs while closing the connection
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
166 */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
167 public abstract void closeUnderlyingConnection() throws IOException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
168
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
169 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
170 * Gets the underlying connection JDBC String URL.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
171 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
172 * @return The underlying connection JDBC String URL
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
173 */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
174 public abstract String getJDBCURL();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
175
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
176 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
177 * Sends a control command to the server.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
178 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
179 * @param commandID the command identifier according to {@link ControlCommands} listing
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
180 * @param data The integer to send according to the control command
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
181 * @throws SQLException if an IO exception or a database error occurs
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
182 */
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
183 public abstract void sendControlCommand(int commandID, int data) throws SQLException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
184
99
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
185 /**
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
186 * Creates a ResponseList.
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
187 *
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
188 * @param fetchSize the nubmer of rows per block in the response list
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
189 * @param maxRows maximum number of rows to allow in the set
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
190 * @param resultSetType the type of result sets to produce
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
191 * @param resultSetConcurrency the concurrency of result sets to produce
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
192 * @return A ResponseList instance
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
193 * @throws SQLException if an IO exception or a database error occurs
1dcb51573c89 Added the remaining documentation.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 98
diff changeset
194 */
83
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
195 public abstract ResponseList createResponseList(int fetchSize, int maxRows, int resultSetType,
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
196 int resultSetConcurrency) throws SQLException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
197
63
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
198 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
199 * Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
200 * automatically released. All Statements created from this Connection will be closed when this method is called.
63
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
201 *
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
202 * Calling the method close on a Connection object that is already closed is a no-op.
63
6325594f01af Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 62
diff changeset
203 */
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
204 @Override
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
205 public void close() {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
206 for (Statement st : statements.keySet()) {
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
207 try {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
208 st.close();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
209 } catch (SQLException e) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
210 // better luck next time!
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
211 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
212 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
213 // close the socket or the embedded server
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
214 try {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
215 this.closeUnderlyingConnection();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
216 } catch (IOException e) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
217 // ignore it
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
218 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
219 // close active SendThread if any
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
220 if (senderThread != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
221 senderThread.shutdown();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
222 senderThread = null;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
223 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
224 // report ourselves as closed
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
225 closed = true;
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
226 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
227
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
228 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
229 * Destructor called by garbage collector before destroying this object tries to disconnect the MonetDB connection
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
230 * if it has not been disconnected already.
61
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
231 */
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
232 @Override
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
233 protected void finalize() throws Throwable {
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
234 this.close();
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
235 super.finalize();
f1de7262d8d9 First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff changeset
236 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
237
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
238 //== methods of interface Connection
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
239
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
240 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
241 * Clears all warnings reported for this Connection object. After a call to this method, the method getWarnings
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
242 * returns null until a new warning is reported for this Connection object.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
243 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
244 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
245 public void clearWarnings() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
246 warnings = null;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
247 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
248
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
249 private void createResponseList(String query) throws SQLException {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
250 // create a container for the result
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
251 ResponseList l = new ResponseList(0, 0, ResultSet.FETCH_FORWARD, ResultSet.CONCUR_READ_ONLY);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
252 // send commit to the server
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
253 try {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
254 l.processQuery(query);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
255 } finally {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
256 l.close();
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
257 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
258 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
259
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
260 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
261 * Makes all changes made since the previous commit/rollback permanent and releases any database locks currently
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
262 * held by this Connection object. This method should be used only when auto-commit mode has been disabled.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
263 *
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
264 * @throws SQLException if a database access error occurs or this Connection object is in auto-commit mode
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
265 * @see #setAutoCommit(boolean)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
266 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
267 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
268 public void commit() throws SQLException {
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
269 // note: can't use sendIndependentCommand here because we need to process the auto_commit state the server gives
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
270 this.createResponseList("COMMIT");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
271 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
272
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
273 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
274 * Creates a Statement object for sending SQL statements to the database. SQL statements without parameters are
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
275 * normally executed using Statement objects. If the same SQL statement is executed many times, it may be more
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
276 * efficient to use a PreparedStatement object.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
277 *
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
278 * Result sets created using the returned Statement object will by default be type TYPE_FORWARD_ONLY and have a
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
279 * concurrency level of CONCUR_READ_ONLY.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
280 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
281 * @return a new default Statement object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
282 * @throws SQLException if a database access error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
283 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
284 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
285 public Statement createStatement() throws SQLException {
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
286 return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
287 ResultSet.HOLD_CURSORS_OVER_COMMIT);
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
288 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
289
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
290 /**
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
291 * Creates a Statement object that will generate ResultSet objects with the given type and concurrency. This method
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
292 * is the same as the createStatement method above, but it allows the default result set type and concurrency to be
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
293 * overridden.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
294 *
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
295 * @param resultSetType a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
296 * or ResultSet.TYPE_SCROLL_SENSITIVE
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
297 * @param resultSetConcurrency a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
298 * @return a new Statement object that will generate ResultSet objects with the given type and concurrency
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
299 * @throws SQLException if a database access error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
300 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
301 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
302 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
303 return createStatement(resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
304 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
305
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
306 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
307 * Creates a Statement object that will generate ResultSet objects
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
308 * with the given type, concurrency, and holdability. This method
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
309 * is the same as the createStatement method above, but it allows
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
310 * the default result set type, concurrency, and holdability to be
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
311 * overridden.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
312 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
313 * @param resultSetType one of the following ResultSet constants:
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
314 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
315 * or ResultSet.TYPE_SCROLL_SENSITIVE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
316 * @param resultSetConcurrency one of the following ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
317 * constants: ResultSet.CONCUR_READ_ONLY or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
318 * ResultSet.CONCUR_UPDATABLE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
319 * @param resultSetHoldability one of the following ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
320 * constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
321 * ResultSet.CLOSE_CURSORS_AT_COMMIT
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
322 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
323 * @return a new Statement object that will generate ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
324 * objects with the given type, concurrency, and holdability
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
325 * @throws SQLException if a database access error occurs or the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
326 * given parameters are not ResultSet constants indicating type,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
327 * concurrency, and holdability
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
328 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
329 @Override
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
330 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
331 throws SQLException {
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
332 try {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
333 Statement ret = new MonetStatement(this, resultSetType, resultSetConcurrency, resultSetHoldability);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
334 // store it in the map for when we close...
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
335 statements.put(ret, null);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
336 return ret;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
337 } catch (IllegalArgumentException e) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
338 throw new SQLException(e.toString(), "M0M03");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
339 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
340 // we don't have to catch SQLException because that is declared to
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
341 // be thrown
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
342 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
343
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
344 /**
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
345 * Retrieves the current auto-commit mode for this Connection object.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
346 *
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
347 * @return the current state of this Connection object's auto-commit mode
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
348 * @see #setAutoCommit(boolean)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
349 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
350 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
351 public boolean getAutoCommit() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
352 return autoCommit;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
353 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
354
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
355 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
356 * Retrieves this Connection object's current catalog name.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
357 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
358 * @return the current catalog name or null if there is none
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
359 * @throws SQLException if a database access error occurs or the current language is not SQL
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
360 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
361 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
362 public String getCatalog() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
363 // MonetDB does NOT support catalogs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
364 return null;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
365 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
366
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
367 /**
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
368 * Retrieves the current holdability of ResultSet objects created using this Connection object.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
369 *
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
370 * @return the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
371 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
372 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
373 public int getHoldability() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
374 // TODO: perhaps it is better to have the server implement
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
375 // CLOSE_CURSORS_AT_COMMIT
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
376 return ResultSet.HOLD_CURSORS_OVER_COMMIT;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
377 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
378
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
379 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
380 * Retrieves a DatabaseMetaData object that contains metadata about
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
381 * the database to which this Connection object represents a
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
382 * connection. The metadata includes information about the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
383 * database's tables, its supported SQL grammar, its stored
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
384 * procedures, the capabilities of this connection, and so on.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
385 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
386 * @throws SQLException if the current language is not SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
387 * @return a DatabaseMetaData object for this Connection object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
388 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
389 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
390 public DatabaseMetaData getMetaData() throws SQLException {
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
391 if (this.language != MapiLanguage.LANG_SQL) {
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
392 throw new SQLException("This method is only supported in SQL mode", "M0M04");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
393 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
394 return new MonetDatabaseMetaData(this);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
395 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
396
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
397 /**
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
398 * Retrieves this Connection object's current transaction isolation level.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
399 *
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
400 * @return the current transaction isolation level, which will be Connection.TRANSACTION_SERIALIZABLE
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
401 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
402 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
403 public int getTransactionIsolation() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
404 return TRANSACTION_SERIALIZABLE;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
405 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
406
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
407 /**
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
408 * Retrieves the Map object associated with this Connection object. Unless the application has added an entry,
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
409 * the type map returned will be empty.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
410 *
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
411 * @return the java.util.Map object associated with this Connection object
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
412 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
413 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
414 public Map<String,Class<?>> getTypeMap() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
415 return typeMap;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
416 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
417
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
418 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
419 * Retrieves the first warning reported by calls on this Connection
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
420 * object. If there is more than one warning, subsequent warnings
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
421 * will be chained to the first one and can be retrieved by calling
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
422 * the method SQLWarning.getNextWarning on the warning that was
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
423 * retrieved previously.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
424 *
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
425 * This method may not be called on a closed connection; doing so will cause an SQLException to be thrown.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
426 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
427 * Note: Subsequent warnings will be chained to this SQLWarning.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
428 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
429 * @return the first SQLWarning object or null if there are none
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
430 * @throws SQLException if a database access error occurs or this method is called on a closed connection
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
431 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
432 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
433 public SQLWarning getWarnings() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
434 if (closed) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
435 throw new SQLException("Cannot call on closed Connection", "M1M20");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
436 }
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
437 // if there are no warnings, this will be null, which fits with the specification.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
438 return warnings;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
439 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
440
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
441 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
442 * Retrieves whether this Connection object has been closed. A
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
443 * connection is closed if the method close has been called on it or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
444 * if certain fatal errors have occurred. This method is guaranteed
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
445 * to return true only when it is called after the method
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
446 * Connection.close has been called.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
447 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
448 * This method generally cannot be called to determine whether a
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
449 * connection to a database is valid or invalid. A typical client
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
450 * can determine that a connection is invalid by catching any
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
451 * exceptions that might be thrown when an operation is attempted.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
452 *
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
453 * @return true if this Connection object is closed; false if it is still open
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
454 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
455 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
456 public boolean isClosed() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
457 return closed;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
458 }
77
83aee4f60649 Added private method sendTransactionCommand(String); to reduce duplicate code in 6 methods.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 47
diff changeset
459
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
460 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
461 * Retrieves whether this Connection object is in read-only mode.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
462 * MonetDB currently doesn't support updateable result sets, but
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
463 * updates are possible. Hence the Connection object is never in
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
464 * read-only mode.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
465 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
466 * @return true if this Connection object is read-only; false otherwise
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
467 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
468 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
469 public boolean isReadOnly() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
470 return false;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
471 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
472
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
473 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
474 public String nativeSQL(String sql) {return sql;}
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
475
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
476 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
477 public CallableStatement prepareCall(String sql) {return null;}
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
478
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
479 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
480 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) {return null;}
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
481
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
482 @Override
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
483 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
484 int resultSetHoldability) {return null;}
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
485
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
486 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
487 * Creates a PreparedStatement object for sending parameterized SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
488 * statements to the database.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
489 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
490 * A SQL statement with or without IN parameters can be pre-compiled
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
491 * and stored in a PreparedStatement object. This object can then be
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
492 * used to efficiently execute this statement multiple times.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
493 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
494 * Note: This method is optimized for handling parametric SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
495 * statements that benefit from precompilation. If the driver
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
496 * supports precompilation, the method prepareStatement will send
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
497 * the statement to the database for precompilation. Some drivers
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
498 * may not support precompilation. In this case, the statement may
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
499 * not be sent to the database until the PreparedStatement object is
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
500 * executed. This has no direct effect on users; however, it does
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
501 * affect which methods throw certain SQLException objects.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
502 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
503 * Result sets created using the returned PreparedStatement object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
504 * will by default be type TYPE_FORWARD_ONLY and have a concurrency
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
505 * level of CONCUR_READ_ONLY.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
506 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
507 * @param sql an SQL statement that may contain one or more '?' IN
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
508 * parameter placeholders
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
509 * @return a new default PreparedStatement object containing the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
510 * pre-compiled SQL statement
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
511 * @throws SQLException if a database access error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
512 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
513 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
514 public PreparedStatement prepareStatement(String sql) throws SQLException {
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
515 return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
516 ResultSet.HOLD_CURSORS_OVER_COMMIT);
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
517 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
518
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
519 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
520 * Creates a PreparedStatement object that will generate ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
521 * objects with the given type and concurrency. This method is the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
522 * same as the prepareStatement method above, but it allows the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
523 * default result set type and concurrency to be overridden.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
524 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
525 * @param sql a String object that is the SQL statement to be sent to the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
526 * database; may contain one or more ? IN parameters
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
527 * @param resultSetType a result set type; one of
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
528 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
529 * or ResultSet.TYPE_SCROLL_SENSITIVE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
530 * @param resultSetConcurrency a concurrency type; one of
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
531 * ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
532 * @return a new PreparedStatement object containing the pre-compiled SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
533 * statement that will produce ResultSet objects with the given
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
534 * type and concurrency
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
535 * @throws SQLException if a database access error occurs or the given
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
536 * parameters are not ResultSet constants indicating
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
537 * type and concurrency
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
538 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
539 @Override
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
540 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
541 throws SQLException {
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
542 return prepareStatement(sql, resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
543 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
544
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
545 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
546 * Creates a PreparedStatement object that will generate ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
547 * objects with the given type, concurrency, and holdability.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
548 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
549 * This method is the same as the prepareStatement method above, but
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
550 * it allows the default result set type, concurrency, and
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
551 * holdability to be overridden.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
552 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
553 * @param sql a String object that is the SQL statement to be sent
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
554 * to the database; may contain one or more ? IN parameters
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
555 * @param resultSetType one of the following ResultSet constants:
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
556 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
557 * or ResultSet.TYPE_SCROLL_SENSITIVE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
558 * @param resultSetConcurrency one of the following ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
559 * constants: ResultSet.CONCUR_READ_ONLY or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
560 * ResultSet.CONCUR_UPDATABLE
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
561 * @param resultSetHoldability one of the following ResultSet
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
562 * constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
563 * ResultSet.CLOSE_CURSORS_AT_COMMIT
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
564 * @return a new PreparedStatement object, containing the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
565 * pre-compiled SQL statement, that will generate ResultSet objects
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
566 * with the given type, concurrency, and holdability
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
567 * @throws SQLException if a database access error occurs or the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
568 * given parameters are not ResultSet constants indicating type,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
569 * concurrency, and holdability
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
570 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
571 @Override
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
572 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
573 int resultSetHoldability) throws SQLException {
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
574 try {
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
575 PreparedStatement ret = new MonetPreparedStatement(this, resultSetType, resultSetConcurrency,
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
576 resultSetHoldability, sql);
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
577 // store it in the map for when we close...
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
578 statements.put(ret, null);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
579 return ret;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
580 } catch (IllegalArgumentException e) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
581 throw new SQLException(e.toString(), "M0M03");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
582 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
583 // we don't have to catch SQLException because that is declared to
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
584 // be thrown
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
585 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
586
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
587 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
588 * Creates a default PreparedStatement object that has the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
589 * capability to retrieve auto-generated keys. The given constant
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
590 * tells the driver whether it should make auto-generated keys
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
591 * available for retrieval. This parameter is ignored if the SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
592 * statement is not an INSERT statement.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
593 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
594 * Note: This method is optimized for handling parametric SQL
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
595 * statements that benefit from precompilation. If the driver
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
596 * supports precompilation, the method prepareStatement will send
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
597 * the statement to the database for precompilation. Some drivers
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
598 * may not support precompilation. In this case, the statement may
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
599 * not be sent to the database until the PreparedStatement object is
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
600 * executed. This has no direct effect on users; however, it does
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
601 * affect which methods throw certain SQLExceptions.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
602 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
603 * Result sets created using the returned PreparedStatement object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
604 * will by default be type TYPE_FORWARD_ONLY and have a concurrency
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
605 * level of CONCUR_READ_ONLY.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
606 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
607 * @param sql an SQL statement that may contain one or more '?' IN
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
608 * parameter placeholders
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
609 * @param autoGeneratedKeys a flag indicating whether auto-generated
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
610 * keys should be returned; one of
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
611 * Statement.RETURN_GENERATED_KEYS or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
612 * Statement.NO_GENERATED_KEYS
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
613 * @return a new PreparedStatement object, containing the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
614 * pre-compiled SQL statement, that will have the capability
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
615 * of returning auto-generated keys
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
616 * @throws SQLException - if a database access error occurs or the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
617 * given parameter is not a Statement constant indicating
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
618 * whether auto-generated keys should be returned
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
619 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
620 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
621 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
622 if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS && autoGeneratedKeys != Statement.NO_GENERATED_KEYS) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
623 throw new SQLException("Invalid argument, expected RETURN_GENERATED_KEYS or NO_GENERATED_KEYS", "M1M05");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
624 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
625 /* MonetDB has no way to disable this, so just do the normal thing ;) */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
626 return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
627 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
628
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
629 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
630 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) {return null;}
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
631
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
632 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
633 public PreparedStatement prepareStatement(String sql, String[] columnNames) {return null;}
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
634
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
635 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
636 * Removes the given Savepoint object from the current transaction.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
637 * Any reference to the savepoint after it have been removed will
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
638 * cause an SQLException to be thrown.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
639 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
640 * @param savepoint the Savepoint object to be removed
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
641 * @throws SQLException if a database access error occurs or the given
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
642 * Savepoint object is not a valid savepoint in the current
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
643 * transaction
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
644 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
645 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
646 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
647 if (!(savepoint instanceof MonetSavepoint)) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
648 throw new SQLException("This driver can only handle savepoints it created itself", "M0M06");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
649 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
650 MonetSavepoint sp = (MonetSavepoint) savepoint;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
651 // note: can't use sendIndependentCommand here because we need
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
652 // to process the auto_commit state the server gives
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
653 // create a container for the result
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
654 this.createResponseList("RELEASE SAVEPOINT " + sp.getName());
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
655 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
656
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
657 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
658 * Undoes all changes made in the current transaction and releases
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
659 * any database locks currently held by this Connection object. This
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
660 * method should be used only when auto-commit mode has been
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
661 * disabled.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
662 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
663 * @throws SQLException if a database access error occurs or this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
664 * Connection object is in auto-commit mode
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
665 * @see #setAutoCommit(boolean)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
666 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
667 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
668 public void rollback() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
669 // note: can't use sendIndependentCommand here because we need
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
670 // to process the auto_commit state the server gives
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
671 // create a container for the result
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
672 this.createResponseList("ROLLBACK");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
673 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
674
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
675 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
676 * Undoes all changes made after the given Savepoint object was set.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
677 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
678 * This method should be used only when auto-commit has been
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
679 * disabled.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
680 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
681 * @param savepoint the Savepoint object to roll back to
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
682 * @throws SQLException if a database access error occurs, the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
683 * Savepoint object is no longer valid, or this Connection
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
684 * object is currently in auto-commit mode
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
685 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
686 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
687 public void rollback(Savepoint savepoint) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
688 if (!(savepoint instanceof MonetSavepoint)) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
689 throw new SQLException("This driver can only handle savepoints it created itself", "M0M06");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
690 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
691
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
692 MonetSavepoint sp = (MonetSavepoint)savepoint;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
693 // note: can't use sendIndependentCommand here because we need
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
694 // to process the auto_commit state the server gives
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
695 // create a container for the result
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
696 this.createResponseList("ROLLBACK TO SAVEPOINT " + sp.getName());
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
697 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
698
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
699 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
700 * Sets this connection's auto-commit mode to the given state. If a
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
701 * connection is in auto-commit mode, then all its SQL statements
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
702 * will be executed and committed as individual transactions.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
703 * Otherwise, its SQL statements are grouped into transactions that
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
704 * are terminated by a call to either the method commit or the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
705 * method rollback. By default, new connections are in auto-commit
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
706 * mode.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
707 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
708 * The commit occurs when the statement completes or the next
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
709 * execute occurs, whichever comes first. In the case of statements
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
710 * returning a ResultSet object, the statement completes when the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
711 * last row of the ResultSet object has been retrieved or the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
712 * ResultSet object has been closed. In advanced cases, a single
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
713 * statement may return multiple results as well as output parameter
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
714 * values. In these cases, the commit occurs when all results and
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
715 * output parameter values have been retrieved.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
716 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
717 * NOTE: If this method is called during a transaction, the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
718 * transaction is committed.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
719 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
720 * @param autoCommit true to enable auto-commit mode; false to disable it
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
721 * @throws SQLException if a database access error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
722 * @see #getAutoCommit()
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
723 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
724 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
725 public void setAutoCommit(boolean autoCommit) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
726 if (this.autoCommit != autoCommit) {
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
727 this.sendControlCommand(ControlCommands.AUTO_COMMIT, (autoCommit ? 1 : 0));
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
728 this.autoCommit = autoCommit;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
729 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
730 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
731
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
732 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
733 * Sets the given catalog name in order to select a subspace of this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
734 * Connection object's database in which to work. If the driver
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
735 * does not support catalogs, it will silently ignore this request.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
736 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
737 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
738 public void setCatalog(String catalog) throws SQLException {
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
739 throw new SQLFeatureNotSupportedException("setCatalog(String catalog) not supported", "0A000");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
740 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
741
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
742 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
743 * Changes the default holdability of ResultSet objects created using this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
744 * Connection object to the given holdability. The default holdability of
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
745 * ResultSet objects can be be determined by invoking DatabaseMetaData.getResultSetHoldability().
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
746 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
747 * @param holdability - a ResultSet holdability constant; one of
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
748 * ResultSet.HOLD_CURSORS_OVER_COMMIT or
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
749 * ResultSet.CLOSE_CURSORS_AT_COMMIT
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
750 * @see #getHoldability()
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
751 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
752 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
753 public void setHoldability(int holdability) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
754 // we only support ResultSet.HOLD_CURSORS_OVER_COMMIT
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
755 if (holdability != ResultSet.HOLD_CURSORS_OVER_COMMIT)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
756 throw new SQLFeatureNotSupportedException("setHoldability(CLOSE_CURSORS_AT_COMMIT) not supported", "0A000");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
757 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
758
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
759 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
760 * Puts this connection in read-only mode as a hint to the driver to
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
761 * enable database optimizations. MonetDB doesn't support any mode
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
762 * here, hence an SQLWarning is generated if attempted to set
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
763 * to true here.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
764 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
765 * @param readOnly true enables read-only mode; false disables it
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
766 * @throws SQLException if a database access error occurs or this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
767 * method is called during a transaction.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
768 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
769 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
770 public void setReadOnly(boolean readOnly) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
771 if (readOnly) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
772 addWarning("cannot setReadOnly(true): read-only Connection mode not supported", "01M08");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
773 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
774 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
775
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
776 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
777 * Creates an unnamed savepoint in the current transaction and
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
778 * returns the new Savepoint object that represents it.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
779 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
780 * @return the new Savepoint object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
781 * @throws SQLException if a database access error occurs or this Connection
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
782 * object is currently in auto-commit mode
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
783 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
784 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
785 public Savepoint setSavepoint() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
786 // create a new Savepoint object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
787 MonetSavepoint sp = new MonetSavepoint();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
788 // note: can't use sendIndependentCommand here because we need
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
789 // to process the auto_commit state the server gives
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
790 // create a container for the result
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
791 this.createResponseList("SAVEPOINT " + sp.getName());
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
792 return sp;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
793 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
794
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
795 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
796 * Creates a savepoint with the given name in the current
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
797 * transaction and returns the new Savepoint object that represents
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
798 * it.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
799 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
800 * @param name a String containing the name of the savepoint
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
801 * @return the new Savepoint object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
802 * @throws SQLException if a database access error occurs or this Connection
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
803 * object is currently in auto-commit mode
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
804 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
805 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
806 public Savepoint setSavepoint(String name) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
807 // create a new Savepoint object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
808 MonetSavepoint sp;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
809 try {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
810 sp = new MonetSavepoint(name);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
811 } catch (IllegalArgumentException e) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
812 throw new SQLException(e.getMessage(), "M0M03");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
813 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
814 // note: can't use sendIndependentCommand here because we need
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
815 // to process the auto_commit state the server gives
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
816 // create a container for the result
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
817 this.createResponseList("SAVEPOINT " + sp.getName());
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
818 return sp;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
819 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
820
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
821 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
822 * Attempts to change the transaction isolation level for this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
823 * Connection object to the one given. The constants defined in the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
824 * interface Connection are the possible transaction isolation
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
825 * levels.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
826 *
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
827 * @param level one of the following Connection constants: Connection.TRANSACTION_READ_UNCOMMITTED,
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
828 * Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
829 * Connection.TRANSACTION_SERIALIZABLE.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
830 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
831 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
832 public void setTransactionIsolation(int level) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
833 if (level != TRANSACTION_SERIALIZABLE) {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
834 addWarning("MonetDB only supports fully serializable " +
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
835 "transactions, continuing with transaction level raised to TRANSACTION_SERIALIZABLE", "01M09");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
836 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
837 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
838
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
839 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
840 * Installs the given TypeMap object as the type map for this
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
841 * Connection object. The type map will be used for the custom
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
842 * mapping of SQL structured types and distinct types.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
843 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
844 * @param map the java.util.Map object to install as the replacement for
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
845 * this Connection object's default type map
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
846 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
847 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
848 public void setTypeMap(Map<String, Class<?>> map) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
849 typeMap = map;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
850 }
45
c2bf983dc79b Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
851
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
852 /**
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
853 * Returns a string identifying this Connection to the MonetDB server.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
854 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
855 * @return a String representing this Object
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
856 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
857 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
858 public String toString() {
93
eeb71f7d36bf Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 91
diff changeset
859 return "MonetDB Connection (" + this.getJDBCURL() + ") " + (closed ? "disconnected" : "connected");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
860 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
861
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
862 //== Java 1.6 methods (JDBC 4.0)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
863
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
864 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
865 * Factory method for creating Array objects.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
866 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
867 * Note: When createArrayOf is used to create an array object that
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
868 * maps to a primitive data type, then it is implementation-defined
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
869 * whether the Array object is an array of that primitive data type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
870 * or an array of Object.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
871 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
872 * Note: The JDBC driver is responsible for mapping the elements
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
873 * Object array to the default JDBC SQL type defined in
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
874 * java.sql.Types for the given class of Object. The default mapping
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
875 * is specified in Appendix B of the JDBC specification. If the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
876 * resulting JDBC type is not the appropriate type for the given
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
877 * typeName then it is implementation defined whether an
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
878 * SQLException is thrown or the driver supports the resulting conversion.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
879 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
880 * @param typeName the SQL name of the type the elements of the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
881 * array map to. The typeName is a database-specific name
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
882 * which may be the name of a built-in type, a user-defined
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
883 * type or a standard SQL type supported by this database.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
884 * This is the value returned by Array.getBaseTypeName
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
885 * @return an Array object whose elements map to the specified SQL type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
886 * @throws SQLException if a database error occurs, the JDBC type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
887 * is not appropriate for the typeName and the conversion is
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
888 * not supported, the typeName is null or this method is
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
889 * called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
890 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
891 * not support this data type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
892 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
893 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
894 @Override
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
895 public java.sql.Array createArrayOf(String typeName, Object[] elements) throws SQLException {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
896 throw new SQLFeatureNotSupportedException("createArrayOf() not supported", "0A000");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
897 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
898
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
899 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
900 * Constructs an object that implements the Clob interface. The
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
901 * object returned initially contains no data. The setAsciiStream,
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
902 * setCharacterStream and setString methods of the Clob interface
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
903 * may be used to add data to the Clob.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
904 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
905 * @return a MonetClob instance
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
906 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
907 * not support MonetClob objects that can be filled in
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
908 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
909 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
910 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
911 public java.sql.Clob createClob() throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
912 return new MonetClob("");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
913 }
77
83aee4f60649 Added private method sendTransactionCommand(String); to reduce duplicate code in 6 methods.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 47
diff changeset
914
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
915 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
916 * Constructs an object that implements the Blob interface. The
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
917 * object returned initially contains no data. The setBinaryStream
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
918 * and setBytes methods of the Blob interface may be used to add
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
919 * data to the Blob.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
920 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
921 * @return a MonetBlob instance
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
922 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
923 * not support MonetBlob objects that can be filled in
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
924 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
925 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
926 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
927 public java.sql.Blob createBlob() throws SQLException {
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
928 return new MonetBlob(new byte[1]);
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
929 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
930
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
931 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
932 * Constructs an object that implements the NClob interface. The
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
933 * object returned initially contains no data. The setAsciiStream,
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
934 * setCharacterStream and setString methods of the NClob interface
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
935 * may be used to add data to the NClob.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
936 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
937 * @return an NClob instance
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
938 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
939 * not support MonetNClob objects that can be filled in
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
940 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
941 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
942 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
943 public java.sql.NClob createNClob() throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
944 throw new SQLFeatureNotSupportedException("createNClob() not supported", "0A000");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
945 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
946
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
947 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
948 * Factory method for creating Struct objects.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
949 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
950 * @param typeName the SQL type name of the SQL structured type that
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
951 * this Struct object maps to. The typeName is the name of a
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
952 * user-defined type that has been defined for this database.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
953 * It is the value returned by Struct.getSQLTypeName.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
954 * @param attributes the attributes that populate the returned object
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
955 * @return a Struct object that maps to the given SQL type and is
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
956 * populated with the given attributes
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
957 * @throws SQLException if a database error occurs, the typeName
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
958 * is null or this method is called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
959 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
960 * not support this data type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
961 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
962 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
963 @Override
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
964 public java.sql.Struct createStruct(String typeName, Object[] attributes) throws SQLException {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
965 throw new SQLFeatureNotSupportedException("createStruct() not supported", "0A000");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
966 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
967
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
968 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
969 * Constructs an object that implements the SQLXML interface. The
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
970 * object returned initially contains no data. The
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
971 * createXmlStreamWriter object and setString method of the SQLXML
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
972 * interface may be used to add data to the SQLXML object.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
973 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
974 * @return An object that implements the SQLXML interface
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
975 * @throws SQLFeatureNotSupportedException the JDBC driver does
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
976 * not support this data type
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
977 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
978 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
979 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
980 public java.sql.SQLXML createSQLXML() throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
981 throw new SQLFeatureNotSupportedException("createSQLXML() not supported", "0A000");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
982 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
983
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
984 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
985 * Returns true if the connection has not been closed and is still
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
986 * valid. The driver shall submit a query on the connection or use
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
987 * some other mechanism that positively verifies the connection is
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
988 * still valid when this method is called.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
989 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
990 * The query submitted by the driver to validate the connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
991 * shall be executed in the context of the current transaction.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
992 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
993 * @param timeout The time in seconds to wait for the database
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
994 * operation used to validate the connection to complete. If
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
995 * the timeout period expires before the operation completes,
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
996 * this method returns false. A value of 0 indicates a
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
997 * timeout is not applied to the database operation.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
998 * @return true if the connection is valid, false otherwise
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
999 * @throws SQLException if the value supplied for timeout is less than 0
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1000 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1001 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1002 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1003 public boolean isValid(int timeout) throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1004 if (timeout < 0)
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1005 throw new SQLException("timeout is less than 0", "M1M05");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1006 if (closed)
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1007 return false;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1008
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1009 // ping db using query: select 1;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1010 Statement stmt = null;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1011 ResultSet rs = null;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1012 try {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1013 stmt = createStatement();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1014 stmt.setQueryTimeout(timeout);
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1015 rs = stmt.executeQuery("SELECT 1");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1016 rs.close();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1017 rs = null;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1018 stmt.close();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1019 return true;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1020 } catch (Exception e) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1021 if (rs != null) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1022 try {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1023 rs.close();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1024 } catch (Exception e2) {}
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1025 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1026 if (stmt != null) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1027 try {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1028 stmt.close();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1029 } catch (Exception e2) {}
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1030 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1031 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1032 return false;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1033 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1034
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1035 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1036 * Returns the value of the client info property specified by name.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1037 * This method may return null if the specified client info property
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1038 * has not been set and does not have a default value.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1039 * This method will also return null if the specified client info
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1040 * property name is not supported by the driver.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1041 * Applications may use the DatabaseMetaData.getClientInfoProperties method
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1042 * to determine the client info properties supported by the driver.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1043 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1044 * @param name - The name of the client info property to retrieve
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1045 * @return The value of the client info property specified or null
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1046 * @throws SQLException - if the database server returns an error
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1047 * when fetching the client info value from the database
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1048 * or this method is called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1049 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1050 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1051 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1052 public String getClientInfo(String name) throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1053 if (name == null || name.isEmpty())
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1054 return null;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1055 return conn_props.getProperty(name);
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1056 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1057
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1058 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1059 * Returns a list containing the name and current value of each client info
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1060 * property supported by the driver. The value of a client info property may
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1061 * be null if the property has not been set and does not have a default value.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1062 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1063 * @return A Properties object that contains the name and current value
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1064 * of each of the client info properties supported by the driver.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1065 * @throws SQLException - if the database server returns an error
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1066 * when fetching the client info value from the database
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1067 * or this method is called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1068 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1069 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1070 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1071 public Properties getClientInfo() throws SQLException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1072 // return a clone of the connection properties object
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1073 return new Properties(conn_props);
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1074 }
77
83aee4f60649 Added private method sendTransactionCommand(String); to reduce duplicate code in 6 methods.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 47
diff changeset
1075
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1076 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1077 * Sets the value of the client info property specified by name to the value specified by value.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1078 * Applications may use the DatabaseMetaData.getClientInfoProperties method to determine
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1079 * the client info properties supported by the driver and the maximum length that may be specified
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1080 * for each property.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1081 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1082 * The driver stores the value specified in a suitable location in the database. For example
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1083 * in a special register, session parameter, or system table column. For efficiency the driver
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1084 * may defer setting the value in the database until the next time a statement is executed
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1085 * or prepared. Other than storing the client information in the appropriate place in the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1086 * database, these methods shall not alter the behavior of the connection in anyway.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1087 * The values supplied to these methods are used for accounting, diagnostics and debugging purposes only.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1088 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1089 * The driver shall generate a warning if the client info name specified is not recognized by the driver.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1090 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1091 * If the value specified to this method is greater than the maximum length for the property
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1092 * the driver may either truncate the value and generate a warning or generate a SQLClientInfoException.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1093 * If the driver generates a SQLClientInfoException, the value specified was not set on the connection.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1094 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1095 * The following are standard client info properties. Drivers are not required to support these
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1096 * properties however if the driver supports a client info property that can be described by one
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1097 * of the standard properties, the standard property name should be used.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1098 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1099 * ApplicationName - The name of the application currently utilizing the connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1100 * ClientUser - The name of the user that the application using the connection is performing work for.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1101 * This may not be the same as the user name that was used in establishing the connection.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1102 * ClientHostname - The hostname of the computer the application using the connection is running on.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1103 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1104 * @param name - The name of the client info property to set
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1105 * @param value - The value to set the client info property to. If the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1106 * value is null, the current value of the specified property is cleared.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1107 * @throws SQLClientInfoException - if the database server returns an error
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1108 * while setting the clientInfo values on the database server
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1109 * or this method is called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1110 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1111 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1112 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1113 public void setClientInfo(String name, String value) throws java.sql.SQLClientInfoException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1114 if (name == null || name.isEmpty()) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1115 addWarning("setClientInfo: missing property name", "01M07");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1116 return;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1117 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1118 // If the value is null, the current value of the specified property is cleared.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1119 if (value == null) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1120 if (conn_props.containsKey(name))
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1121 conn_props.remove(name);
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1122 return;
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1123 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1124 // only set value for supported property names
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1125 if (name.equals("host") || name.equals("port") || name.equals("user") || name.equals("password") ||
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1126 name.equals("database") || name.equals("language") || name.equals("so_timeout") ||
93
eeb71f7d36bf Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 91
diff changeset
1127 name.equals("hash") || name.equals("treat_blob_as_binary") || name.equals("follow_redirects") ||
100
64530632dc2a Added the directory property for the embedded connection again.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 99
diff changeset
1128 name.equals("treat_clob_as_longvarchar") || name.equals("embedded") || name.equals("directory")) {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1129 conn_props.setProperty(name, value);
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1130 } else {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1131 addWarning("setClientInfo: " + name + "is not a recognised property", "01M07");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1132 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1133 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1134
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1135 /**
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1136 * Sets the value of the connection's client info properties.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1137 * The Properties object contains the names and values of the client info
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1138 * properties to be set. The set of client info properties contained in the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1139 * properties list replaces the current set of client info properties on the connection.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1140 * If a property that is currently set on the connection is not present in the
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1141 * properties list, that property is cleared. Specifying an empty properties list
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1142 * will clear all of the properties on the connection.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1143 * See setClientInfo (String, String) for more information.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1144 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1145 * If an error occurs in setting any of the client info properties, a
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1146 * SQLClientInfoException is thrown. The SQLClientInfoException contains information
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1147 * indicating which client info properties were not set. The state of the client
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1148 * information is unknown because some databases do not allow multiple client info
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1149 * properties to be set atomically. For those databases, one or more properties may
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1150 * have been set before the error occurred.
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1151 *
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1152 * @param props - The list of client info properties to set
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1153 * @throws SQLClientInfoException - if the database server returns an error
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1154 * while setting the clientInfo values on the database server
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1155 * or this method is called on a closed connection
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1156 * @since 1.6
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1157 */
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1158 @Override
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1159 public void setClientInfo(Properties props) throws java.sql.SQLClientInfoException {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1160 if (props != null) {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1161 for (Map.Entry<Object, Object> entry : props.entrySet()) {
88
1bba35253aaf Finished the mappings in the JDBC embedded connection. Now what is left to do is testing (the JDBC embedded connection needs extensive testing), compile for other OS than Linux, merge with the Dec16 branch (headless) and some possible optimizations.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 87
diff changeset
1162 setClientInfo(entry.getKey().toString(), entry.getValue().toString());
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1163 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1164 }
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1165 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1166
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1167 //== Java 1.7 methods (JDBC 4.1)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1168
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1169 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1170 * Sets the given schema name to access.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1171 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1172 * @param schema the name of a schema in which to work
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1173 * @throws SQLException if a database access error occurs or this method is called on a closed connection
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1174 * @since 1.7
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1175 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1176 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1177 public void setSchema(String schema) throws SQLException {
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1178 if (closed)
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1179 throw new SQLException("Cannot call on closed Connection", "M1M20");
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1180 if (schema == null)
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1181 throw new SQLException("Missing schema name", "M1M05");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1182
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1183 Statement st = createStatement();
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1184 try {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1185 st.execute("SET SCHEMA \"" + schema + "\"");
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1186 } finally {
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1187 st.close();
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1188 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1189 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1190
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1191 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1192 * Retrieves this Connection object's current schema name.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1193 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1194 * @return the current schema name or null if there is none
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1195 * @throws SQLException if a database access error occurs or this method is called on a closed connection
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1196 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1197 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1198 public String getSchema() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1199 if (closed) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1200 throw new SQLException("Cannot call on closed Connection", "M1M20");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1201 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1202 String cur_schema;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1203 Statement st = createStatement();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1204 ResultSet rs = null;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1205 try {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1206 rs = st.executeQuery("SELECT CURRENT_SCHEMA");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1207 if (!rs.next())
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1208 throw new SQLException("Row expected", "02000");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1209 cur_schema = rs.getString(1);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1210 } finally {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1211 if (rs != null)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1212 rs.close();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1213 st.close();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1214 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1215 return cur_schema;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1216 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1217
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1218 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1219 * Terminates an open connection. Calling abort results in:
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1220 * * The connection marked as closed
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1221 * * Closes any physical connection to the database
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1222 * * Releases resources used by the connection
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1223 * * Insures that any thread that is currently accessing the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1224 * connection will either progress to completion or throw an
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1225 * SQLException.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1226 * Calling abort marks the connection closed and releases any
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1227 * resources. Calling abort on a closed connection is a no-op.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1228 *
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1229 * @param executor The Executor implementation which will be used by abort
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1230 * @throws SQLException if a database access error occurs or the executor is null
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1231 * @throws SecurityException if a security manager exists and its checkPermission method denies calling abort
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1232 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1233 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1234 public void abort(Executor executor) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1235 if (closed)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1236 return;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1237 if (executor == null)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1238 throw new SQLException("executor is null", "M1M05");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1239 // this is really the simplest thing to do, it destroys
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1240 // everything (in particular the server connection)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1241 close();
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1242 }
77
83aee4f60649 Added private method sendTransactionCommand(String); to reduce duplicate code in 6 methods.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 47
diff changeset
1243
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1244 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1245 * Sets the maximum period a Connection or objects created from the
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1246 * Connection will wait for the database to reply to any one
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1247 * request. If any request remains unanswered, the waiting method
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1248 * will return with a SQLException, and the Connection or objects
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1249 * created from the Connection will be marked as closed. Any
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1250 * subsequent use of the objects, with the exception of the close,
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1251 * isClosed or Connection.isValid methods, will result in a
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1252 * SQLException.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1253 *
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1254 * @param executor The Executor implementation which will be used by setNetworkTimeout
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1255 * @param millis The time in milliseconds to wait for the database operation to complete
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1256 * @throws SQLException if a database access error occurs, this method is called on a closed connection, the
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1257 * executor is null, or the value specified for seconds is less than 0.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1258 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1259 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1260 public void setNetworkTimeout(Executor executor, int millis) throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1261 if (closed) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1262 throw new SQLException("Cannot call on closed Connection", "M1M20");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1263 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1264 if (executor == null)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1265 throw new SQLException("executor is null", "M1M05");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1266 if (millis < 0)
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1267 throw new SQLException("milliseconds is less than zero", "M1M05");
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1268 this.setSoTimeout(millis);
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1269 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1270
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1271 /**
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1272 * Retrieves the number of milliseconds the driver will wait for a database request to complete. If the limit is
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1273 * exceeded, a SQLException is thrown.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1274 *
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1275 * @return the current timeout limit in milliseconds; zero means there is no limit
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1276 * @throws SQLException if a database access error occurs or this method is called on a closed Connection
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1277 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1278 @Override
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1279 public int getNetworkTimeout() throws SQLException {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1280 if (closed) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1281 throw new SQLException("Cannot call on closed Connection", "M1M20");
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1282 }
65
e605cdd6373f More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 64 47
diff changeset
1283 return this.getSoTimeout();
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1284 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1285
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1286 //== end methods of interface Connection
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1287
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1288 /**
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1289 * Returns whether the BLOB type should be mapped to BINARY type.
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1290 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1291 public boolean getBlobAsBinary() {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1292 return blobIsBinary;
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1293 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1294
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1295 /**
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1296 * Returns whether the CLOB type should be mapped to LONGVARCHAR type.
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1297 */
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1298 public boolean getClobAsLongChar() {
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1299 return clobIsLongChar;
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1300 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1301
87
2b5e32efb1a4 Made all the mappings for the MAPI connection, now it needs to be added on the Embedded connection. Changed the compilation target to 1.8 because of the timezones. Implemented some JDBC methods as well.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 85
diff changeset
1302 /**
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1303 * Sends the given string to MonetDB as regular statement, making sure there is a prompt after the command is sent.
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1304 * All possible returned information is discarded. Encountered errors are reported.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1305 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1306 * @param command the exact string to send to MonetDB
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1307 * @throws SQLException if an IO exception or a database error occurs
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1308 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1309 public void sendIndependentCommand(String command) throws SQLException {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1310 try {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1311 protocol.writeNextQuery(language.getQueryTemplateIndex(0), command, language.getQueryTemplateIndex(1));
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1312 protocol.waitUntilPrompt();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1313 int csrh = protocol.getCurrentServerResponse();
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1314 if (csrh == ServerResponses.ERROR) {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1315 String error = protocol.getRemainingStringLine(0);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1316 throw new SQLException(error.substring(6), error.substring(0, 5));
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1317 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1318 } catch (SocketTimeoutException e) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1319 close(); // JDBC 4.1 semantics: abort()
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1320 throw new SQLException("connection timed out", "08M33");
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1321 } catch (IOException e) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1322 throw new SQLException(e.getMessage(), "08000");
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1323 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1324 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1325
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1326 /**
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1327 * Adds a warning to the pile of warnings this Connection object has. If there were no warnings (or clearWarnings
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1328 * was called) this warning will be the first, otherwise this warning will get appended to the current warning.
64
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1329 *
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1330 * @param reason the warning message
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1331 */
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1332 public void addWarning(String reason, String sqlstate) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1333 if (warnings == null) {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1334 warnings = new SQLWarning(reason, sqlstate);
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1335 } else {
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1336 warnings.setNextWarning(new SQLWarning(reason, sqlstate));
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1337 }
bb0d66ad7dc6 More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 63
diff changeset
1338 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1339
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1340 /**
73
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
1341 * A list of Response objects. Responses are added to this list. Methods of this class are not synchronized. This is
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
1342 * left as responsibility to the caller to prevent concurrent access.
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1343 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1344 public class ResponseList {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1345
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1346 /** The cache size (number of rows in a DataBlockResponse object) */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1347 private final int cachesize;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1348 /** The maximum number of results for this query */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1349 private final int maxrows;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1350 /** The ResultSet type to produce */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1351 private final int rstype;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1352 /** The ResultSet concurrency to produce */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1353 private final int rsconcur;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1354 /** The sequence number of this ResponseList */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1355 private final int seqnr;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1356 /** A list of the Responses associated with the query, in the right order */
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1357 private final List<IResponse> responses = new ArrayList<>();
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1358 /** A map of ResultSetResponses, used for additional DataBlockResponse mapping */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1359 private Map<Integer, ResultSetResponse> rsresponses;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1360 /** The current header returned by getNextResponse() */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1361 private int curResponse = -1;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1362
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1363 /**
73
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
1364 * Main constructor. The query argument can either be a String or List. An SQLException is thrown if another
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
1365 * object instance is supplied.
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1366 *
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1367 * @param cachesize overall cachesize to use
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1368 * @param maxrows maximum number of rows to allow in the set
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1369 * @param rstype the type of result sets to produce
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1370 * @param rsconcur the concurrency of result sets to produce
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1371 */
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1372 public ResponseList(int cachesize, int maxrows, int rstype, int rsconcur) throws SQLException {
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1373 this.cachesize = cachesize;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1374 this.maxrows = maxrows;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1375 this.rstype = rstype;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1376 this.rsconcur = rsconcur;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1377 this.seqnr = SeqCounter++;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1378 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1379
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1380 public int getCachesize() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1381 return cachesize;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1382 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1383
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1384 public int getRstype() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1385 return rstype;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1386 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1387
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1388 public int getRsconcur() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1389 return rsconcur;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1390 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1391
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1392 public int getMaxrows() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1393 return maxrows;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1394 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1395
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1396 /**
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1397 * Retrieves the next available response, or null if there are no more responses.
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1398 *
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1399 * @return the next Response available or null
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1400 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1401 IResponse getNextResponse() throws SQLException {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1402 if (rstype == ResultSet.TYPE_FORWARD_ONLY) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1403 // free resources if we're running forward only
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1404 if (curResponse >= 0 && curResponse < responses.size()) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1405 IResponse tmp = responses.get(curResponse);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1406 if (tmp != null) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1407 tmp.close();
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1408 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1409 responses.set(curResponse, null);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1410 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1411 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1412 curResponse++;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1413 if (curResponse >= responses.size()) {
73
953422c41194 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.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 72
diff changeset
1414 // ResponseList is obviously completed so, there are no more responses
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1415 return null;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1416 } else {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1417 // return this response
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1418 return responses.get(curResponse);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1419 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1420 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1421
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1422 /**
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1423 * Closes the Response at index i, if not null.
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1424 *
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1425 * @param i the index position of the header to close
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1426 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1427 void closeResponse(int i) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1428 if (i < 0 || i >= responses.size()) return;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1429 IResponse tmp = responses.set(i, null);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1430 if (tmp != null)
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1431 tmp.close();
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1432 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1433
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1434 /**
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1435 * Closes the current response.
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1436 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1437 void closeCurrentResponse() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1438 closeResponse(curResponse);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1439 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1440
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1441 /**
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1442 * Closes the current and previous responses.
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1443 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1444 void closeCurOldResponses() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1445 for (int i = curResponse; i >= 0; i--) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1446 closeResponse(i);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1447 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1448 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1449
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1450 /**
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1451 * Closes this ResponseList by closing all the Responses in this ResponseList.
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1452 */
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1453 public void close() {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1454 for (int i = 0; i < responses.size(); i++) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1455 closeResponse(i);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1456 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1457 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1458
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1459 /**
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1460 * Returns whether this ResponseList has still unclosed Responses.
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1461 */
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1462 boolean hasUnclosedResponses() {
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1463 for (IResponse r : responses) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1464 if (r != null)
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1465 return true;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1466 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1467 return false;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1468 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1469
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1470 /**
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1471 * Executes the query contained in this ResponseList, and stores the Responses resulting from this query in this
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1472 * ResponseList.
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1473 *
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1474 * @throws SQLException if a database error occurs
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1475 */
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1476 void processQuery(String query) throws SQLException {
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1477 this.executeQuery(language.getQueryTemplates(), query);
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1478 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1479
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1480 /**
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1481 * Internal executor of queries.
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1482 *
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1483 * @param templ the template to fill in
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1484 * @param query the query to execute
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1485 * @throws SQLException if a database error occurs
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1486 */
67
87ba760038b6 More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 66
diff changeset
1487 @SuppressWarnings("fallthrough")
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1488 public void executeQuery(String[] templ, String query) throws SQLException {
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1489 String error = null;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1490
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1491 try {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1492 // make sure we're ready to send query; read data till we have the prompt it is possible (and most
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1493 // likely) that we already have the prompt and do not have to skip any lines. Ignore errors from
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1494 // previous result sets.
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1495 protocol.waitUntilPrompt();
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1496
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1497 // {{{ set reply size
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1498 /**
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1499 * Change the reply size of the server. If the given value is the same as the current value known
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1500 * to use, then ignore this call. If it is set to 0 we get a prompt after the server sent it's
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1501 * header.
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1502 */
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1503 int size = cachesize == 0 ? MonetConnection.this.getDefFetchsize() : cachesize;
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1504 size = maxrows != 0 ? Math.min(maxrows, size) : size;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1505 // don't do work if it's not needed
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1506 if (language == MapiLanguage.LANG_SQL && size != curReplySize &&
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1507 !Arrays.deepEquals(templ, language.getCommandTemplates())) {
83
724a0061db63 Only some rare data types mapping is missing on the JDBC embedded connection. I will now be testing extensively, then adding these mappings to finish the JDBC embedded connection.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 81
diff changeset
1508 sendControlCommand(ControlCommands.REPLY_SIZE, size);
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1509 // store the reply size after a successful change
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1510 curReplySize = size;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1511 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1512 // }}} set reply size
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1513
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1514 // If the query is larger than the TCP buffer size, use a special send thread to avoid deadlock with
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1515 // the server due to blocking behaviour when the buffer is full. Because the server will be writing
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1516 // back results to us, it will eventually block as well when its TCP buffer gets full, as we are
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1517 // blocking an not consuming from it. The result is a state where both client and server want to
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1518 // write, but block.
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1519 if (query.length() > getBlockSize()) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1520 // get a reference to the send thread
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1521 if (senderThread == null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1522 senderThread = new SenderThread(protocol);
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1523 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1524 // tell it to do some work!
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1525 senderThread.runQuery(templ, query);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1526 } else {
81
a3c686217ca1 Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 80
diff changeset
1527 // this is a simple call, which is a lot cheaper and will always succeed for small queries.
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1528 protocol.writeNextQuery((templ[0] == null) ? "" : templ[0], query,
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1529 (templ[1] == null) ? "" : templ[1]);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1530 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1531
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1532 // go for new results
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1533 protocol.fetchNextResponseData();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1534 int nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1535 IResponse res = null;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1536 while (nextResponse != ServerResponses.PROMPT) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1537 // each response should start with a start of header (or error)
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1538 switch (nextResponse) {
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1539 case ServerResponses.SOHEADER:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1540 // make the response object, and fill it
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1541 int nextStartHeader = protocol.getNextStarterHeader();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1542 try {
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1543 switch (nextStartHeader) {
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1544 case StarterHeaders.Q_PARSE:
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1545 throw new ProtocolException("Q_PARSE header not allowed here");
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1546 case StarterHeaders.Q_TABLE:
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1547 case StarterHeaders.Q_PREPARE: {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1548 res = protocol.getNextResultSetResponse(MonetConnection.this,
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1549 ResponseList.this, this.seqnr);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1550 ResultSetResponse rsreponse = (ResultSetResponse) res;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1551 // only add this resultset to the hashmap if it can possibly
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1552 // have an additional datablock
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1553 if (rsreponse.getRowcount() < rsreponse.getTuplecount()) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1554 if (rsresponses == null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1555 rsresponses = new HashMap<>();
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1556 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1557 rsresponses.put(rsreponse.getId(), rsreponse);
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1558 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1559 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1560 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1561 case StarterHeaders.Q_UPDATE:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1562 res = protocol.getNextUpdateResponse();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1563 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1564 case StarterHeaders.Q_SCHEMA:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1565 res = protocol.getNextSchemaResponse();
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1566 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1567 case StarterHeaders.Q_TRANS:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1568 res = protocol.getNextAutoCommitResponse();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1569 boolean isAutoCommit = ((AutoCommitResponse) res).isAutocommit();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1570
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1571 if (MonetConnection.this.getAutoCommit() && isAutoCommit) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1572 MonetConnection.this.addWarning("Server enabled auto commit mode " +
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1573 "while local state already was auto commit.", "01M11");
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1574 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1575 MonetConnection.this.autoCommit = isAutoCommit;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1576 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1577 case StarterHeaders.Q_BLOCK: {
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1578 DataBlockResponse next = protocol.getNextDatablockResponse(rsresponses);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1579 if (next == null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1580 error = "M0M12!No ResultSetResponse for a DataBlock found";
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1581 break;
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1582 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1583 res = next;
71
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1584 }
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1585 break;
4e2a2a81cc6a Some parsing successful on the old mapi. About to start testing table result sets.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 68
diff changeset
1586 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1587 } catch (ProtocolException e) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1588 error = "M0M10!error while parsing start of header:\n" + e.getMessage() + " found: '"
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1589 + protocol.getRemainingStringLine(0).charAt(e.getErrorOffset()) + "'" +
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1590 " in: \"" + protocol.getRemainingStringLine(0) + "\"" + " at pos: "
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1591 + e.getErrorOffset();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1592 // flush all the rest
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1593 protocol.waitUntilPrompt();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1594 nextResponse = protocol.getCurrentServerResponse();
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1595 break;
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1596 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1597
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1598 // immediately handle errors after parsing the header (res may be null)
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1599 if (error != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1600 protocol.waitUntilPrompt();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1601 nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1602 break;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1603 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1604
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1605 // here we have a res object, which we can start filling
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1606 if (res instanceof IIncompleteResponse) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1607 IIncompleteResponse iter = (IIncompleteResponse) res;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1608 while (iter.wantsMore()) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1609 try {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1610 protocol.fetchNextResponseData();
80
0ae34196c54e Started the embedded connection on the JDBC part. Mostly done by now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 74
diff changeset
1611 iter.addLines(protocol);
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1612 } catch (ProtocolException ex) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1613 // right, some protocol violation, skip the rest of the result
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1614 error = "M0M10!" + ex.getMessage();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1615 protocol.waitUntilPrompt();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1616 nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1617 break;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1618 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1619 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1620 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1621
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1622 if (error != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1623 break;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1624 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1625
80
0ae34196c54e Started the embedded connection on the JDBC part. Mostly done by now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 74
diff changeset
1626 // it is of no use to store DataBlockResponses, you never want to retrieve them directly
0ae34196c54e Started the embedded connection on the JDBC part. Mostly done by now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 74
diff changeset
1627 // anyway
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1628 if (!(res instanceof DataBlockResponse)) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1629 responses.add(res);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1630 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1631 // read the next line (can be prompt, new result, error, etc.) before we start the loop over
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1632 protocol.fetchNextResponseData();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1633 nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1634 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1635 case ServerResponses.INFO:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1636 addWarning(protocol.getRemainingStringLine(0), "01000");
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1637 // read the next line (can be prompt, new result, error, etc.) before we start the loop over
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1638 protocol.fetchNextResponseData();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1639 nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1640 break;
96
4a93f75c72c9 Java enums are compiled into objects, so changing the server responses parameters into integers gives an extra performance.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 93
diff changeset
1641 case ServerResponses.ERROR:
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1642 // read everything till the prompt (should be error) we don't know if we ignore some
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1643 // garbage here... but the log should reveal that
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1644 error = protocol.getRemainingStringLine(0);
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1645 protocol.waitUntilPrompt();
98
c0ce1ea5075f Some documentation added.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 96
diff changeset
1646 nextResponse = protocol.getCurrentServerResponse();
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1647 break;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1648 default:
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1649 throw new SQLException("Protocol violation, unexpected line!", "M0M10");
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1650 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1651 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1652
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1653 // if we used the senderThread, make sure it has finished
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1654 if (senderThread != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1655 String tmp = senderThread.getErrors();
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1656 if (tmp != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1657 if (error == null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1658 error = "08000!" + tmp;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1659 } else {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1660 error += "\n08000!" + tmp;
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1661 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1662 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1663 }
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1664 if (error != null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1665 SQLException ret = null;
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1666 String[] errors = error.split("\n");
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1667 for (String error1 : errors) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1668 if (ret == null) {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1669 ret = new SQLException(error1.substring(6), error1.substring(0, 5));
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1670 } else {
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1671 ret.setNextException(new SQLException(error1.substring(6), error1.substring(0, 5)));
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1672 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1673 }
74
17365ed26611 In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 73
diff changeset
1674 throw ret;
66
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1675 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1676 } catch (SocketTimeoutException e) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1677 this.close(); // JDBC 4.1 semantics, abort()
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1678 throw new SQLException("connection timed out", "08M33");
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1679 } catch (IOException e) {
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1680 closed = true;
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1681 throw new SQLException(e.getMessage() + " (mserver still alive?)", "08000");
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1682 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1683 }
7307caacc2d5 Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents: 65
diff changeset
1684 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1685 }