Mercurial > hg > monetdb-java
annotate src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @ 93:eeb71f7d36bf embedded
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().
author | Pedro Ferreira <pedro.ferreira@monetdbsolutions.com> |
---|---|
date | Fri, 06 Jan 2017 12:36:33 +0000 (2017-01-06) |
parents | 6f74e01c57da |
children | 4a93f75c72c9 |
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; |
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
|
9 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
|
10 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
|
11 import nl.cwi.monetdb.mcl.responses.ResultSetResponse; |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
12 |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
13 import java.io.*; |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
14 import java.net.SocketTimeoutException; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
15 import java.sql.*; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
16 import java.util.*; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
17 import java.util.concurrent.Executor; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
18 |
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 * 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
|
21 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
22 * 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
|
23 * 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
|
24 * 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
|
25 * 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
|
26 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
27 * 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
|
28 * 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
|
29 * 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
|
30 * 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
|
31 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
32 * 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
|
33 * 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
|
34 * 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
|
35 * 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
|
36 * 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
|
37 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
38 * 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
|
39 * whole Connection interface. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
40 * |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
41 * @author Martin van Dinther |
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
42 * @version 1.3 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
43 */ |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
44 public abstract class MonetConnection extends MonetWrapper implements Connection { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
45 |
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
|
46 /** 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
|
47 private static int SeqCounter = 0; |
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 |
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
|
49 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
|
50 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
|
51 } |
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 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
53 /** 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>
diff
changeset
|
54 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
|
55 /** 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
|
56 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
|
57 /** Authentication hash method */ |
6325594f01af
Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
62
diff
changeset
|
58 protected final String hash; |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
59 /** 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
|
60 private SenderThread senderThread; |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
61 /** Whether this Connection is closed (and cannot be used anymore) */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
62 private boolean closed; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
63 /** Whether this Connection is in autocommit mode */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
64 private boolean autoCommit = true; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
65 /** The stack of warnings for this Connection object */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
66 private SQLWarning warnings; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
67 /** The Connection specific mapping of user defined types to Java types */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
68 private Map<String,Class<?>> typeMap = new HashMap<String,Class<?>>() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
69 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
|
70 put("inet", MonetINET.class); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
71 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
72 }; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
73 |
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
|
74 // 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
|
75 // (only when you deal with it of course) |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
76 /** A Map containing all (active) Statements created from this Connection */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
77 private Map<Statement,?> statements = new WeakHashMap<Statement, Object>(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
78 /** The number of results we receive from the server at once */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
79 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
|
80 /** 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
|
81 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
|
82 /** 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
|
83 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
|
84 /** 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
|
85 protected AbstractProtocol 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
|
86 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
87 /** |
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
|
88 * 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
|
89 * 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
|
90 * only accessible to classes from the jdbc package. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
91 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
92 * @throws IOException if an error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
93 */ |
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
|
94 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
|
95 boolean clobIsLongChar) throws IOException { |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
96 this.conn_props = props; |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
97 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
|
98 this.language = language; |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
99 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
|
100 this.clobIsLongChar = clobIsLongChar; |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
101 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
102 |
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
|
103 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>
diff
changeset
|
104 return language; |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
105 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
106 |
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
|
107 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
|
108 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
|
109 } |
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
|
110 |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
111 /** |
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
|
112 * Connects to the given host and port, logging in as the given user. If followRedirect is false, 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
|
113 * RedirectionException is thrown when a redirect is encountered. |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
114 * |
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
|
115 * @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
|
116 * @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
|
117 * @throws ProtocolException if bogus data is received |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
118 * @throws MCLException if an MCL related error occurs |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
119 */ |
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
|
120 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
|
121 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
122 public abstract int getBlockSize(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
123 |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
124 public abstract int getDefFetchsize(); |
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
125 |
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>
diff
changeset
|
126 public abstract int getSoTimeout(); |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
127 |
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>
diff
changeset
|
128 public abstract void setSoTimeout(int s); |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
129 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
130 public abstract void closeUnderlyingConnection() throws IOException; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
131 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
132 public abstract String getJDBCURL(); |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
133 |
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
|
134 public abstract void sendControlCommand(ControlCommands con, int data) throws SQLException; |
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
|
135 |
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
|
136 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
|
137 int resultSetConcurrency) throws SQLException; |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
138 |
63
6325594f01af
Lots of cleaning, but still a long way to go.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
62
diff
changeset
|
139 /** |
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
|
140 * 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
|
141 * 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
|
142 * |
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
|
143 * 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
|
144 */ |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
145 @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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 } 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
|
151 // 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
|
152 } |
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
|
153 } |
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
|
154 // 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
|
155 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
|
156 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
|
157 } 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
|
158 // 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
|
159 } |
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
|
160 // 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
|
161 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
|
162 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
|
163 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
|
164 } |
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
|
165 // 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
|
166 closed = true; |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
167 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
168 |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
169 /** |
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
|
170 * 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
|
171 * if it has not been disconnected already. |
61
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
172 */ |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
173 @Override |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
174 protected void finalize() throws Throwable { |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
175 this.close(); |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
176 super.finalize(); |
f1de7262d8d9
First changes to the JDBC driver.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
177 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
178 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
179 //== methods of interface Connection |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
180 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
181 /** |
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
|
182 * 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
|
183 * 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
|
184 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
185 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
186 public void clearWarnings() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
187 warnings = null; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
188 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
189 |
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
|
190 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
|
191 // 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
|
192 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
|
193 // 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
|
194 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
|
195 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
|
196 } 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
|
197 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
|
198 } |
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
|
199 } |
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
|
200 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
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 * 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
|
203 * 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
|
204 * |
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
|
205 * @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
|
206 * @see #setAutoCommit(boolean) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
207 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
208 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
209 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
|
210 // 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
|
211 this.createResponseList("COMMIT"); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
212 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
213 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
214 /** |
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
|
215 * 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
|
216 * 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
|
217 * efficient to use a PreparedStatement object. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
218 * |
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
|
219 * 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
|
220 * concurrency level of CONCUR_READ_ONLY. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
221 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
222 * @return a new default Statement object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
223 * @throws SQLException if a database access error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
224 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
225 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
226 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
|
227 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
|
228 ResultSet.HOLD_CURSORS_OVER_COMMIT); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
229 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
230 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
231 /** |
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
|
232 * 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
|
233 * 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
|
234 * overridden. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
235 * |
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
|
236 * @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
|
237 * 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
|
238 * @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
|
239 * @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
|
240 * @throws SQLException if a database access error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
241 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
242 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
243 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
244 return createStatement(resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
245 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
246 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
247 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
248 * Creates a Statement object that will generate ResultSet objects |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
249 * with the given type, concurrency, and holdability. This method |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
250 * is the same as the createStatement method above, but it allows |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
251 * the default result set type, concurrency, and holdability to be |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
252 * overridden. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
253 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
254 * @param resultSetType one of the following ResultSet constants: |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
255 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
256 * or ResultSet.TYPE_SCROLL_SENSITIVE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
257 * @param resultSetConcurrency one of the following ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
258 * constants: ResultSet.CONCUR_READ_ONLY or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
259 * ResultSet.CONCUR_UPDATABLE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
260 * @param resultSetHoldability one of the following ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
261 * constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
262 * ResultSet.CLOSE_CURSORS_AT_COMMIT |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
263 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
264 * @return a new Statement object that will generate ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
265 * objects with the given type, concurrency, and holdability |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
266 * @throws SQLException if a database access error occurs or the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
267 * given parameters are not ResultSet constants indicating type, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
268 * concurrency, and holdability |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
269 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
270 @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
|
271 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
|
272 throws SQLException { |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
273 try { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
274 Statement ret = new MonetStatement(this, resultSetType, resultSetConcurrency, resultSetHoldability); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
275 // store it in the map for when we close... |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
276 statements.put(ret, null); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
277 return ret; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
278 } catch (IllegalArgumentException e) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
279 throw new SQLException(e.toString(), "M0M03"); |
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 // 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
|
282 // be thrown |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
283 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
284 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
285 /** |
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
|
286 * Retrieves the current auto-commit mode for this Connection object. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
287 * |
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
|
288 * @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
|
289 * @see #setAutoCommit(boolean) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
290 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
291 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
292 public boolean getAutoCommit() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
293 return autoCommit; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
294 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
295 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
296 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
297 * Retrieves this Connection object's current catalog name. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
298 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
299 * @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
|
300 * @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
|
301 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
302 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
303 public String getCatalog() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
304 // MonetDB does NOT support catalogs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
305 return null; |
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 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
308 /** |
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
|
309 * 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
|
310 * |
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
|
311 * @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
|
312 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
313 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
314 public int getHoldability() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
315 // TODO: perhaps it is better to have the server implement |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
316 // CLOSE_CURSORS_AT_COMMIT |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
317 return ResultSet.HOLD_CURSORS_OVER_COMMIT; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
318 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
319 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
320 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
321 * Retrieves a DatabaseMetaData object that contains metadata about |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
322 * the database to which this Connection object represents a |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
323 * connection. The metadata includes information about the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
324 * database's tables, its supported SQL grammar, its stored |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
325 * procedures, the capabilities of this connection, and so on. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
326 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
327 * @throws SQLException if the current language is not SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
328 * @return a DatabaseMetaData object for this Connection object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
329 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
330 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
331 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
|
332 if (this.language != MapiLanguage.LANG_SQL) { |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
333 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
|
334 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
335 return new MonetDatabaseMetaData(this); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
336 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
337 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
338 /** |
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
|
339 * Retrieves this Connection object's current transaction isolation level. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
340 * |
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
|
341 * @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
|
342 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
343 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
344 public int getTransactionIsolation() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
345 return TRANSACTION_SERIALIZABLE; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
346 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
347 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
348 /** |
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
|
349 * 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
|
350 * the type map returned will be empty. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
351 * |
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
|
352 * @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
|
353 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
354 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
355 public Map<String,Class<?>> getTypeMap() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
356 return typeMap; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
357 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
358 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
359 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
360 * Retrieves the first warning reported by calls on this Connection |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
361 * object. If there is more than one warning, subsequent warnings |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
362 * 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
|
363 * the method SQLWarning.getNextWarning on the warning that was |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
364 * retrieved previously. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
365 * |
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
|
366 * 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
|
367 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
368 * Note: Subsequent warnings will be chained to this SQLWarning. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
369 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
370 * @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
|
371 * @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
|
372 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
373 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
374 public SQLWarning getWarnings() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
375 if (closed) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
376 throw new SQLException("Cannot call on closed Connection", "M1M20"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
377 } |
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
|
378 // 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
|
379 return warnings; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
380 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
381 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
382 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
383 * Retrieves whether this Connection object has been closed. A |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
384 * 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
|
385 * if certain fatal errors have occurred. This method is guaranteed |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
386 * to return true only when it is called after the method |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
387 * Connection.close has been called. |
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 * This method generally cannot be called to determine whether a |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
390 * connection to a database is valid or invalid. A typical client |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
391 * can determine that a connection is invalid by catching any |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
392 * exceptions that might be thrown when an operation is attempted. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
393 * |
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
|
394 * @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
|
395 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
396 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
397 public boolean isClosed() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
398 return closed; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
399 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
400 |
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 * Retrieves whether this Connection object is in read-only mode. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
403 * MonetDB currently doesn't support updateable result sets, but |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
404 * updates are possible. Hence the Connection object is never in |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
405 * read-only mode. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
406 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
407 * @return true if this Connection object is read-only; false otherwise |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
408 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
409 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
410 public boolean isReadOnly() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
411 return false; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
412 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
413 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
414 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
415 public String nativeSQL(String sql) {return sql;} |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
416 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
417 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
418 public CallableStatement prepareCall(String sql) {return null;} |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
419 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
420 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
421 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) {return null;} |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
422 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
423 @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
|
424 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
|
425 int resultSetHoldability) {return null;} |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
426 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
427 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
428 * Creates a PreparedStatement object for sending parameterized SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
429 * statements to the database. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
430 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
431 * 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
|
432 * and stored in a PreparedStatement object. This object can then be |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
433 * used to efficiently execute this statement multiple times. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
434 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
435 * Note: This method is optimized for handling parametric SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
436 * statements that benefit from precompilation. If the driver |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
437 * supports precompilation, the method prepareStatement will send |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
438 * the statement to the database for precompilation. Some drivers |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
439 * may not support precompilation. In this case, the statement may |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
440 * not be sent to the database until the PreparedStatement object is |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
441 * executed. This has no direct effect on users; however, it does |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
442 * affect which methods throw certain SQLException objects. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
443 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
444 * Result sets created using the returned PreparedStatement object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
445 * 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
|
446 * level of CONCUR_READ_ONLY. |
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 * @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
|
449 * parameter placeholders |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
450 * @return a new default PreparedStatement object containing the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
451 * pre-compiled SQL statement |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
452 * @throws SQLException if a database access error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
453 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
454 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
455 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
|
456 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
|
457 ResultSet.HOLD_CURSORS_OVER_COMMIT); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
458 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
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 * Creates a PreparedStatement object that will generate ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
462 * objects with the given type and concurrency. This method is the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
463 * same as the prepareStatement method above, but it allows the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
464 * default result set type and concurrency to be overridden. |
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 * @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
|
467 * database; may contain one or more ? IN parameters |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
468 * @param resultSetType a result set type; one of |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
469 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
470 * or ResultSet.TYPE_SCROLL_SENSITIVE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
471 * @param resultSetConcurrency a concurrency type; one of |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
472 * ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
473 * @return a new PreparedStatement object containing the pre-compiled SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
474 * statement that will produce ResultSet objects with the given |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
475 * type and concurrency |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
476 * @throws SQLException if a database access error occurs or the given |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
477 * parameters are not ResultSet constants indicating |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
478 * type and concurrency |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
479 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
480 @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
|
481 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
|
482 throws SQLException { |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
483 return prepareStatement(sql, resultSetType, resultSetConcurrency, ResultSet.HOLD_CURSORS_OVER_COMMIT); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
484 } |
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 that will generate ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
488 * objects with the given type, concurrency, and holdability. |
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 * This method is the same as the prepareStatement method above, but |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
491 * it allows the default result set type, concurrency, and |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
492 * holdability to be overridden. |
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 * @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
|
495 * to the database; may contain one or more ? IN parameters |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
496 * @param resultSetType one of the following ResultSet constants: |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
497 * ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
498 * or ResultSet.TYPE_SCROLL_SENSITIVE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
499 * @param resultSetConcurrency one of the following ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
500 * constants: ResultSet.CONCUR_READ_ONLY or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
501 * ResultSet.CONCUR_UPDATABLE |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
502 * @param resultSetHoldability one of the following ResultSet |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
503 * constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
504 * ResultSet.CLOSE_CURSORS_AT_COMMIT |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
505 * @return a new PreparedStatement object, containing the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
506 * pre-compiled SQL statement, that will generate ResultSet objects |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
507 * with the given type, concurrency, and holdability |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
508 * @throws SQLException if a database access error occurs or the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
509 * given parameters are not ResultSet constants indicating type, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
510 * concurrency, and holdability |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
511 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
512 @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
|
513 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
|
514 int resultSetHoldability) throws SQLException { |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
515 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
|
516 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
|
517 resultSetHoldability, sql); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
518 // store it in the map for when we close... |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
519 statements.put(ret, null); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
520 return ret; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
521 } catch (IllegalArgumentException e) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
522 throw new SQLException(e.toString(), "M0M03"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
523 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
524 // 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
|
525 // be thrown |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
526 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
527 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
528 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
529 * Creates a default PreparedStatement object that has the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
530 * capability to retrieve auto-generated keys. The given constant |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
531 * tells the driver whether it should make auto-generated keys |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
532 * available for retrieval. This parameter is ignored if the SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
533 * statement is not an INSERT statement. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
534 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
535 * Note: This method is optimized for handling parametric SQL |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
536 * statements that benefit from precompilation. If the driver |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
537 * supports precompilation, the method prepareStatement will send |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
538 * the statement to the database for precompilation. Some drivers |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
539 * may not support precompilation. In this case, the statement may |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
540 * not be sent to the database until the PreparedStatement object is |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
541 * executed. This has no direct effect on users; however, it does |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
542 * affect which methods throw certain SQLExceptions. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
543 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
544 * Result sets created using the returned PreparedStatement object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
545 * 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
|
546 * level of CONCUR_READ_ONLY. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
547 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
548 * @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
|
549 * parameter placeholders |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
550 * @param autoGeneratedKeys a flag indicating whether auto-generated |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
551 * keys should be returned; one of |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
552 * Statement.RETURN_GENERATED_KEYS or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
553 * Statement.NO_GENERATED_KEYS |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
554 * @return a new PreparedStatement object, containing the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
555 * pre-compiled SQL statement, that will have the capability |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
556 * of returning auto-generated keys |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
557 * @throws SQLException - if a database access error occurs or the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
558 * given parameter is not a Statement constant indicating |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
559 * whether auto-generated keys should be returned |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
560 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
561 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
562 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
563 if (autoGeneratedKeys != Statement.RETURN_GENERATED_KEYS && autoGeneratedKeys != Statement.NO_GENERATED_KEYS) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
564 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
|
565 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
566 /* 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
|
567 return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
568 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
569 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
570 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
571 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) {return null;} |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
572 |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
573 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
574 public PreparedStatement prepareStatement(String sql, String[] columnNames) {return null;} |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
575 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
576 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
577 * Removes the given Savepoint object from the current transaction. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
578 * Any reference to the savepoint after it have been removed will |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
579 * cause an SQLException to be thrown. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
580 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
581 * @param savepoint the Savepoint object to be removed |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
582 * @throws SQLException if a database access error occurs or the given |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
583 * Savepoint object is not a valid savepoint in the current |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
584 * transaction |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
585 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
586 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
587 public void releaseSavepoint(Savepoint savepoint) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
588 if (!(savepoint instanceof MonetSavepoint)) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
589 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
|
590 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
591 MonetSavepoint sp = (MonetSavepoint) savepoint; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
592 // note: can't use sendIndependentCommand here because we need |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
593 // to process the auto_commit state the server gives |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
594 // 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
|
595 this.createResponseList("RELEASE SAVEPOINT " + sp.getName()); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
596 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
597 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
598 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
599 * Undoes all changes made in the current transaction and releases |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
600 * any database locks currently held by this Connection object. This |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
601 * method should be used only when auto-commit mode has been |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
602 * disabled. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
603 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
604 * @throws SQLException if a database access error occurs or this |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
605 * Connection object is in auto-commit mode |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
606 * @see #setAutoCommit(boolean) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
607 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
608 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
609 public void rollback() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
610 // note: can't use sendIndependentCommand here because we need |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
611 // to process the auto_commit state the server gives |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
612 // 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
|
613 this.createResponseList("ROLLBACK"); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
614 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
615 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
616 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
617 * Undoes all changes made after the given Savepoint object was set. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
618 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
619 * This method should be used only when auto-commit has been |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
620 * disabled. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
621 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
622 * @param savepoint the Savepoint object to roll back to |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
623 * @throws SQLException if a database access error occurs, the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
624 * Savepoint object is no longer valid, or this Connection |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
625 * object is currently in auto-commit mode |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
626 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
627 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
628 public void rollback(Savepoint savepoint) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
629 if (!(savepoint instanceof MonetSavepoint)) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
630 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
|
631 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
632 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
633 MonetSavepoint sp = (MonetSavepoint)savepoint; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
634 // note: can't use sendIndependentCommand here because we need |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
635 // to process the auto_commit state the server gives |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
636 // 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
|
637 this.createResponseList("ROLLBACK TO SAVEPOINT " + sp.getName()); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
638 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
639 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
640 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
641 * 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
|
642 * connection is in auto-commit mode, then all its SQL statements |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
643 * will be executed and committed as individual transactions. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
644 * Otherwise, its SQL statements are grouped into transactions that |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
645 * 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
|
646 * method rollback. By default, new connections are in auto-commit |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
647 * mode. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
648 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
649 * The commit occurs when the statement completes or the next |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
650 * execute occurs, whichever comes first. In the case of statements |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
651 * returning a ResultSet object, the statement completes when the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
652 * last row of the ResultSet object has been retrieved or the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
653 * ResultSet object has been closed. In advanced cases, a single |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
654 * statement may return multiple results as well as output parameter |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
655 * values. In these cases, the commit occurs when all results and |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
656 * output parameter values have been retrieved. |
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 * NOTE: If this method is called during a transaction, the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
659 * transaction is committed. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
660 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
661 * @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
|
662 * @throws SQLException if a database access error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
663 * @see #getAutoCommit() |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
664 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
665 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
666 public void setAutoCommit(boolean autoCommit) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
667 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
|
668 this.sendControlCommand(ControlCommands.AUTO_COMMIT, (autoCommit ? 1 : 0)); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
669 this.autoCommit = autoCommit; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
670 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
671 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
672 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
673 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
674 * 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
|
675 * Connection object's database in which to work. If the driver |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
676 * does not support catalogs, it will silently ignore this request. |
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 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
679 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
|
680 throw new SQLFeatureNotSupportedException("setCatalog(String catalog) not supported", "0A000"); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
681 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
682 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
683 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
684 * Changes the default holdability of ResultSet objects created using this |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
685 * Connection object to the given holdability. The default holdability of |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
686 * ResultSet objects can be be determined by invoking DatabaseMetaData.getResultSetHoldability(). |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
687 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
688 * @param holdability - a ResultSet holdability constant; one of |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
689 * ResultSet.HOLD_CURSORS_OVER_COMMIT or |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
690 * ResultSet.CLOSE_CURSORS_AT_COMMIT |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
691 * @see #getHoldability() |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
692 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
693 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
694 public void setHoldability(int holdability) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
695 // we only support ResultSet.HOLD_CURSORS_OVER_COMMIT |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
696 if (holdability != ResultSet.HOLD_CURSORS_OVER_COMMIT) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
697 throw new SQLFeatureNotSupportedException("setHoldability(CLOSE_CURSORS_AT_COMMIT) not supported", "0A000"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
698 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
699 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
700 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
701 * 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
|
702 * enable database optimizations. MonetDB doesn't support any mode |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
703 * here, hence an SQLWarning is generated if attempted to set |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
704 * to true here. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
705 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
706 * @param readOnly true enables read-only mode; false disables it |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
707 * @throws SQLException if a database access error occurs or this |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
708 * method is called during a transaction. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
709 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
710 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
711 public void setReadOnly(boolean readOnly) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
712 if (readOnly) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
713 addWarning("cannot setReadOnly(true): read-only Connection mode not supported", "01M08"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
714 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
715 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
716 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
717 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
718 * Creates an unnamed savepoint in the current transaction and |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
719 * returns the new Savepoint object that represents it. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
720 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
721 * @return the new Savepoint object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
722 * @throws SQLException if a database access error occurs or this Connection |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
723 * object is currently in auto-commit mode |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
724 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
725 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
726 public Savepoint setSavepoint() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
727 // create a new Savepoint object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
728 MonetSavepoint sp = new MonetSavepoint(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
729 // note: can't use sendIndependentCommand here because we need |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
730 // to process the auto_commit state the server gives |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
731 // 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
|
732 this.createResponseList("SAVEPOINT " + sp.getName()); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
733 return sp; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
734 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
735 |
64
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 * Creates a savepoint with the given name in the current |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
738 * transaction and returns the new Savepoint object that represents |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
739 * it. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
740 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
741 * @param name a String containing the name of the savepoint |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
742 * @return the new Savepoint object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
743 * @throws SQLException if a database access error occurs or this Connection |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
744 * object is currently in auto-commit mode |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
745 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
746 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
747 public Savepoint setSavepoint(String name) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
748 // create a new Savepoint object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
749 MonetSavepoint sp; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
750 try { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
751 sp = new MonetSavepoint(name); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
752 } catch (IllegalArgumentException e) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
753 throw new SQLException(e.getMessage(), "M0M03"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
754 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
755 // note: can't use sendIndependentCommand here because we need |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
756 // to process the auto_commit state the server gives |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
757 // 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
|
758 this.createResponseList("SAVEPOINT " + sp.getName()); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
759 return sp; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
760 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
761 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
762 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
763 * Attempts to change the transaction isolation level for this |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
764 * Connection object to the one given. The constants defined in the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
765 * interface Connection are the possible transaction isolation |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
766 * levels. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
767 * |
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
|
768 * @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
|
769 * Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
770 * Connection.TRANSACTION_SERIALIZABLE. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
771 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
772 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
773 public void setTransactionIsolation(int level) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
774 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>
diff
changeset
|
775 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
|
776 "transactions, continuing with transaction level raised to TRANSACTION_SERIALIZABLE", "01M09"); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
777 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
778 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
779 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
780 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
781 * Installs the given TypeMap object as the type map for this |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
782 * Connection object. The type map will be used for the custom |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
783 * mapping of SQL structured types and distinct types. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
784 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
785 * @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
|
786 * this Connection object's default type map |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
787 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
788 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
789 public void setTypeMap(Map<String, Class<?>> map) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
790 typeMap = map; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
791 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
792 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
793 /** |
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>
diff
changeset
|
794 * Returns a string identifying this Connection to the MonetDB server. |
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 * @return a String representing this Object |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
797 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
798 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
799 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
|
800 return "MonetDB Connection (" + this.getJDBCURL() + ") " + (closed ? "disconnected" : "connected"); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
801 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
802 |
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>
diff
changeset
|
803 //== Java 1.6 methods (JDBC 4.0) |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
804 |
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>
diff
changeset
|
805 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
806 * 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>
diff
changeset
|
807 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
808 * 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>
diff
changeset
|
809 * 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>
diff
changeset
|
810 * 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>
diff
changeset
|
811 * 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>
diff
changeset
|
812 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
813 * 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>
diff
changeset
|
814 * 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>
diff
changeset
|
815 * 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>
diff
changeset
|
816 * 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>
diff
changeset
|
817 * 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>
diff
changeset
|
818 * 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>
diff
changeset
|
819 * 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>
diff
changeset
|
820 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
821 * @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>
diff
changeset
|
822 * 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>
diff
changeset
|
823 * 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>
diff
changeset
|
824 * 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>
diff
changeset
|
825 * 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>
diff
changeset
|
826 * @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>
diff
changeset
|
827 * @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>
diff
changeset
|
828 * 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>
diff
changeset
|
829 * 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>
diff
changeset
|
830 * 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>
diff
changeset
|
831 * @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>
diff
changeset
|
832 * 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>
diff
changeset
|
833 * @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>
diff
changeset
|
834 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
835 @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
|
836 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>
diff
changeset
|
837 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>
diff
changeset
|
838 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
839 |
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>
diff
changeset
|
840 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
841 * 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>
diff
changeset
|
842 * 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>
diff
changeset
|
843 * 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>
diff
changeset
|
844 * 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>
diff
changeset
|
845 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
846 * @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>
diff
changeset
|
847 * @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>
diff
changeset
|
848 * 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>
diff
changeset
|
849 * @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>
diff
changeset
|
850 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
851 @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>
diff
changeset
|
852 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>
diff
changeset
|
853 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>
diff
changeset
|
854 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
855 |
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>
diff
changeset
|
856 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
857 * 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>
diff
changeset
|
858 * 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>
diff
changeset
|
859 * 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>
diff
changeset
|
860 * 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>
diff
changeset
|
861 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
862 * @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>
diff
changeset
|
863 * @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>
diff
changeset
|
864 * 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>
diff
changeset
|
865 * @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>
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>
diff
changeset
|
867 @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>
diff
changeset
|
868 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
|
869 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>
diff
changeset
|
870 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
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>
diff
changeset
|
872 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
873 * 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>
diff
changeset
|
874 * 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>
diff
changeset
|
875 * 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>
diff
changeset
|
876 * 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>
diff
changeset
|
877 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
878 * @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>
diff
changeset
|
879 * @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>
diff
changeset
|
880 * 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>
diff
changeset
|
881 * @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>
diff
changeset
|
882 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
883 @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>
diff
changeset
|
884 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>
diff
changeset
|
885 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>
diff
changeset
|
886 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
887 |
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>
diff
changeset
|
888 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
889 * 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>
diff
changeset
|
890 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
891 * @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>
diff
changeset
|
892 * 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>
diff
changeset
|
893 * 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>
diff
changeset
|
894 * 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>
diff
changeset
|
895 * @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>
diff
changeset
|
896 * @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>
diff
changeset
|
897 * 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>
diff
changeset
|
898 * @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>
diff
changeset
|
899 * 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>
diff
changeset
|
900 * @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>
diff
changeset
|
901 * 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>
diff
changeset
|
902 * @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>
diff
changeset
|
903 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
904 @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
|
905 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>
diff
changeset
|
906 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>
diff
changeset
|
907 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
908 |
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>
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>
diff
changeset
|
910 * 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>
diff
changeset
|
911 * 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>
diff
changeset
|
912 * 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>
diff
changeset
|
913 * 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>
diff
changeset
|
914 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
915 * @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>
diff
changeset
|
916 * @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>
diff
changeset
|
917 * 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>
diff
changeset
|
918 * @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>
diff
changeset
|
919 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
920 @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>
diff
changeset
|
921 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>
diff
changeset
|
922 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>
diff
changeset
|
923 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
924 |
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>
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>
diff
changeset
|
926 * 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>
diff
changeset
|
927 * 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>
diff
changeset
|
928 * 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>
diff
changeset
|
929 * 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>
diff
changeset
|
930 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
931 * 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>
diff
changeset
|
932 * 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>
diff
changeset
|
933 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
934 * @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>
diff
changeset
|
935 * 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>
diff
changeset
|
936 * 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>
diff
changeset
|
937 * 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>
diff
changeset
|
938 * 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>
diff
changeset
|
939 * @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>
diff
changeset
|
940 * @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>
diff
changeset
|
941 * @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>
diff
changeset
|
942 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
943 @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>
diff
changeset
|
944 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>
diff
changeset
|
945 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>
diff
changeset
|
946 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>
diff
changeset
|
947 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>
diff
changeset
|
948 return false; |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
949 |
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>
diff
changeset
|
950 // 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>
diff
changeset
|
951 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>
diff
changeset
|
952 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>
diff
changeset
|
953 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>
diff
changeset
|
954 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>
diff
changeset
|
955 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>
diff
changeset
|
956 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>
diff
changeset
|
957 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>
diff
changeset
|
958 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>
diff
changeset
|
959 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>
diff
changeset
|
960 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>
diff
changeset
|
961 } 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>
diff
changeset
|
962 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>
diff
changeset
|
963 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>
diff
changeset
|
964 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>
diff
changeset
|
965 } 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>
diff
changeset
|
966 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
967 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>
diff
changeset
|
968 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>
diff
changeset
|
969 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>
diff
changeset
|
970 } 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>
diff
changeset
|
971 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
972 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
973 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>
diff
changeset
|
974 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
975 |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
976 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
977 * 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>
diff
changeset
|
978 * 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>
diff
changeset
|
979 * 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>
diff
changeset
|
980 * 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>
diff
changeset
|
981 * 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>
diff
changeset
|
982 * 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>
diff
changeset
|
983 * 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>
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>
diff
changeset
|
985 * @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>
diff
changeset
|
986 * @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>
diff
changeset
|
987 * @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>
diff
changeset
|
988 * 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>
diff
changeset
|
989 * 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>
diff
changeset
|
990 * @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>
diff
changeset
|
991 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
992 @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>
diff
changeset
|
993 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>
diff
changeset
|
994 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>
diff
changeset
|
995 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>
diff
changeset
|
996 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>
diff
changeset
|
997 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
998 |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
999 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1000 * 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>
diff
changeset
|
1001 * 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>
diff
changeset
|
1002 * 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>
diff
changeset
|
1003 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1004 * @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>
diff
changeset
|
1005 * 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>
diff
changeset
|
1006 * @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>
diff
changeset
|
1007 * 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>
diff
changeset
|
1008 * 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>
diff
changeset
|
1009 * @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>
diff
changeset
|
1010 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1011 @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>
diff
changeset
|
1012 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>
diff
changeset
|
1013 // 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>
diff
changeset
|
1014 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>
diff
changeset
|
1015 } |
45
c2bf983dc79b
Implemented Connection methods: getClientInfo(name) and getClientInfo().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
25
diff
changeset
|
1016 |
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>
diff
changeset
|
1017 /** |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1018 * 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>
diff
changeset
|
1019 * 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>
diff
changeset
|
1020 * 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>
diff
changeset
|
1021 * 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>
diff
changeset
|
1022 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1023 * 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>
diff
changeset
|
1024 * 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>
diff
changeset
|
1025 * 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>
diff
changeset
|
1026 * 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>
diff
changeset
|
1027 * 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>
diff
changeset
|
1028 * 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>
diff
changeset
|
1029 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1030 * 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>
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>
diff
changeset
|
1032 * 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>
diff
changeset
|
1033 * 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>
diff
changeset
|
1034 * 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>
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>
diff
changeset
|
1036 * 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>
diff
changeset
|
1037 * 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>
diff
changeset
|
1038 * 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>
diff
changeset
|
1039 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1040 * 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>
diff
changeset
|
1041 * 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>
diff
changeset
|
1042 * 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>
diff
changeset
|
1043 * 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>
diff
changeset
|
1044 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1045 * @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>
diff
changeset
|
1046 * @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>
diff
changeset
|
1047 * 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>
diff
changeset
|
1048 * @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>
diff
changeset
|
1049 * 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>
diff
changeset
|
1050 * 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>
diff
changeset
|
1051 * @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>
diff
changeset
|
1052 */ |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1053 @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>
diff
changeset
|
1054 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>
diff
changeset
|
1055 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>
diff
changeset
|
1056 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>
diff
changeset
|
1057 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>
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>
diff
changeset
|
1059 // 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>
diff
changeset
|
1060 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>
diff
changeset
|
1061 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>
diff
changeset
|
1062 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>
diff
changeset
|
1063 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>
diff
changeset
|
1064 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1065 // 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
|
1066 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
|
1067 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
|
1068 name.equals("hash") || name.equals("treat_blob_as_binary") || name.equals("follow_redirects") || |
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
|
1069 name.equals("treat_clob_as_longvarchar") || name.equals("embedded")) { |
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>
diff
changeset
|
1070 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>
diff
changeset
|
1071 } 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>
diff
changeset
|
1072 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>
diff
changeset
|
1073 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1074 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
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>
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>
diff
changeset
|
1077 * 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>
diff
changeset
|
1078 * 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>
diff
changeset
|
1079 * 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>
diff
changeset
|
1080 * 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>
diff
changeset
|
1081 * 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>
diff
changeset
|
1082 * 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>
diff
changeset
|
1083 * 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>
diff
changeset
|
1084 * 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>
diff
changeset
|
1085 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1086 * 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>
diff
changeset
|
1087 * 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>
diff
changeset
|
1088 * 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>
diff
changeset
|
1089 * 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>
diff
changeset
|
1090 * 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>
diff
changeset
|
1091 * 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>
diff
changeset
|
1092 * |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1093 * @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>
diff
changeset
|
1094 * @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>
diff
changeset
|
1095 * 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>
diff
changeset
|
1096 * 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>
diff
changeset
|
1097 * @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>
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>
diff
changeset
|
1099 @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>
diff
changeset
|
1100 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>
diff
changeset
|
1101 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>
diff
changeset
|
1102 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
|
1103 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>
diff
changeset
|
1104 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1105 } |
e605cdd6373f
More cleaning. Created the responses layer. The JDBC embedded connection will be compatible with the standard embedded API.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
diff
changeset
|
1106 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1107 |
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>
diff
changeset
|
1108 //== Java 1.7 methods (JDBC 4.1) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1109 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1110 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1111 * Sets the given schema name to access. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1112 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1113 * @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
|
1114 * @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>
diff
changeset
|
1115 * @since 1.7 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1116 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1117 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1118 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>
diff
changeset
|
1119 if (closed) |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1120 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>
diff
changeset
|
1121 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>
diff
changeset
|
1122 throw new SQLException("Missing schema name", "M1M05"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1123 |
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>
diff
changeset
|
1124 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>
diff
changeset
|
1125 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>
diff
changeset
|
1126 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>
diff
changeset
|
1127 } 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>
diff
changeset
|
1128 st.close(); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1129 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1130 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1131 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1132 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1133 * Retrieves this Connection object's current schema name. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1134 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1135 * @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
|
1136 * @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
|
1137 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1138 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1139 public String getSchema() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1140 if (closed) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1141 throw new SQLException("Cannot call on closed Connection", "M1M20"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1142 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1143 String cur_schema; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1144 Statement st = createStatement(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1145 ResultSet rs = null; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1146 try { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1147 rs = st.executeQuery("SELECT CURRENT_SCHEMA"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1148 if (!rs.next()) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1149 throw new SQLException("Row expected", "02000"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1150 cur_schema = rs.getString(1); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1151 } finally { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1152 if (rs != null) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1153 rs.close(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1154 st.close(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1155 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1156 return cur_schema; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1157 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1158 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1159 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1160 * Terminates an open connection. Calling abort results in: |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1161 * * The connection marked as closed |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1162 * * Closes any physical connection to the database |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1163 * * Releases resources used by the connection |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1164 * * Insures that any thread that is currently accessing the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1165 * connection will either progress to completion or throw an |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1166 * SQLException. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1167 * Calling abort marks the connection closed and releases any |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1168 * resources. Calling abort on a closed connection is a no-op. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1169 * |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1170 * @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
|
1171 * @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
|
1172 * @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
|
1173 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1174 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1175 public void abort(Executor executor) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1176 if (closed) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1177 return; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1178 if (executor == null) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1179 throw new SQLException("executor is null", "M1M05"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1180 // this is really the simplest thing to do, it destroys |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1181 // everything (in particular the server connection) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1182 close(); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1183 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1184 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1185 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1186 * Sets the maximum period a Connection or objects created from the |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1187 * Connection will wait for the database to reply to any one |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1188 * request. If any request remains unanswered, the waiting method |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1189 * will return with a SQLException, and the Connection or objects |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1190 * created from the Connection will be marked as closed. Any |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1191 * subsequent use of the objects, with the exception of the close, |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1192 * isClosed or Connection.isValid methods, will result in a |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1193 * SQLException. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1194 * |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1195 * @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
|
1196 * @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
|
1197 * @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
|
1198 * 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
|
1199 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1200 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1201 public void setNetworkTimeout(Executor executor, int millis) throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1202 if (closed) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1203 throw new SQLException("Cannot call on closed Connection", "M1M20"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1204 } |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1205 if (executor == null) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1206 throw new SQLException("executor is null", "M1M05"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1207 if (millis < 0) |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1208 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>
diff
changeset
|
1209 this.setSoTimeout(millis); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1210 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1211 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1212 /** |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1213 * 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
|
1214 * exceeded, a SQLException is thrown. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1215 * |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1216 * @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
|
1217 * @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
|
1218 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1219 @Override |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1220 public int getNetworkTimeout() throws SQLException { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1221 if (closed) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1222 throw new SQLException("Cannot call on closed Connection", "M1M20"); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1223 } |
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>
diff
changeset
|
1224 return this.getSoTimeout(); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1225 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1226 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1227 //== end methods of interface Connection |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1228 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1229 /** |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1230 * Returns whether the BLOB type should be mapped to BINARY type. |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1231 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1232 public boolean getBlobAsBinary() { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1233 return blobIsBinary; |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1234 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1235 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1236 /** |
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
|
1237 * 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
|
1238 */ |
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
|
1239 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
|
1240 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
|
1241 } |
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
|
1242 |
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
|
1243 /** |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1244 * 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
|
1245 * All possible returned information is discarded. Encountered errors are reported. |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1246 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1247 * @param command the exact string to send to MonetDB |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1248 * @throws SQLException if an IO exception or a database error occurs |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1249 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1250 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
|
1251 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
|
1252 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
|
1253 protocol.waitUntilPrompt(); |
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
|
1254 if (protocol.getCurrentServerResponseHeader() == ServerResponses.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
|
1255 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
|
1256 throw new SQLException(error.substring(6), error.substring(0, 5)); |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1257 } |
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
|
1258 } 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
|
1259 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
|
1260 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
|
1261 } 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
|
1262 throw new SQLException(e.getMessage(), "08000"); |
64
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 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1265 |
64
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1266 /** |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1267 * 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
|
1268 * 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
|
1269 * |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1270 * @param reason the warning message |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1271 */ |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1272 public void addWarning(String reason, String sqlstate) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1273 if (warnings == null) { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1274 warnings = new SQLWarning(reason, sqlstate); |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1275 } else { |
bb0d66ad7dc6
More done
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
63
diff
changeset
|
1276 warnings.setNextWarning(new SQLWarning(reason, sqlstate)); |
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 } |
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
|
1279 |
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
|
1280 /** |
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
|
1281 * 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
|
1282 * 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
|
1283 */ |
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
|
1284 public class 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
|
1285 |
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
|
1286 /** 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
|
1287 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
|
1288 /** 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
|
1289 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
|
1290 /** 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
|
1291 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
|
1292 /** 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
|
1293 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
|
1294 /** 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
|
1295 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
|
1296 /** 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
|
1297 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
|
1298 /** 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
|
1299 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
|
1300 /** 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
|
1301 private int curResponse = -1; |
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
|
1302 |
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
|
1303 /** |
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
|
1304 * 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
|
1305 * 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
|
1306 * |
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
|
1307 * @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
|
1308 * @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
|
1309 * @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
|
1310 * @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
|
1311 */ |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1312 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
|
1313 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
|
1314 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
|
1315 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
|
1316 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
|
1317 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
|
1318 } |
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
|
1319 |
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
|
1320 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
|
1321 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
|
1322 } |
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
|
1323 |
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
|
1324 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
|
1325 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
|
1326 } |
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
|
1327 |
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
|
1328 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
|
1329 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
|
1330 } |
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
|
1331 |
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
|
1332 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
|
1333 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
|
1334 } |
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
|
1335 |
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
|
1336 /** |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1337 * 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
|
1338 * |
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
|
1339 * @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
|
1340 */ |
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
|
1341 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
|
1342 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
|
1343 // 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
|
1344 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
|
1345 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
|
1346 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
|
1347 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
|
1348 } |
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 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
|
1350 } |
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 } |
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 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
|
1353 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
|
1354 // 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
|
1355 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
|
1356 } 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
|
1357 // 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
|
1358 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
|
1359 } |
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 } |
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 |
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
|
1362 /** |
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 * 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
|
1364 * |
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
|
1365 * @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
|
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 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
|
1368 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
|
1369 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
|
1370 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
|
1371 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
|
1372 } |
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 |
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 /** |
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 * 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
|
1376 */ |
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 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
|
1378 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
|
1379 } |
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 |
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 /** |
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 * 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
|
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 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
|
1385 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
|
1386 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
|
1387 } |
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 } |
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 |
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 /** |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1391 * 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
|
1392 */ |
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 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
|
1394 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
|
1395 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
|
1396 } |
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
|
1397 } |
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 /** |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1400 * 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
|
1401 */ |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1402 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
|
1403 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
|
1404 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
|
1405 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
|
1406 } |
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 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
|
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 |
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 /** |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1411 * 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
|
1412 * 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
|
1413 * |
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
|
1414 * @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
|
1415 */ |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1416 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
|
1417 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
|
1418 } |
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 /** |
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
|
1421 * 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
|
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 * @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
|
1424 * @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
|
1425 * @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
|
1426 */ |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
1427 @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
|
1428 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
|
1429 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
|
1430 |
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 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
|
1432 // 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
|
1433 // 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
|
1434 // 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
|
1435 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
|
1436 |
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
|
1437 // {{{ 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
|
1438 /** |
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
|
1439 * 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
|
1440 * 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
|
1441 * 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
|
1442 */ |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1443 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
|
1444 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
|
1445 // 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
|
1446 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
|
1447 !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
|
1448 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
|
1449 // 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
|
1450 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
|
1451 } |
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
|
1452 // }}} set reply size |
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
|
1453 |
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
|
1454 // 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
|
1455 // 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
|
1456 // 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
|
1457 // 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
|
1458 // 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
|
1459 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
|
1460 // 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
|
1461 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
|
1462 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
|
1463 } |
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
|
1464 // 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
|
1465 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
|
1466 } else { |
81
a3c686217ca1
Made many fixes for the embedded connection
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
80
diff
changeset
|
1467 // 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
|
1468 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
|
1469 (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
|
1470 } |
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
|
1471 |
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
|
1472 // 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
|
1473 protocol.fetchNextResponseData(); |
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
|
1474 ServerResponses nextResponse = protocol.getCurrentServerResponseHeader(); |
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
|
1475 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
|
1476 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
|
1477 // 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
|
1478 switch (nextResponse) { |
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
|
1479 case SOHEADER: |
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
|
1480 // make the response object, and fill 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
|
1481 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
|
1482 switch (protocol.getNextStarterHeader()) { |
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
|
1483 case Q_PARSE: |
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
|
1484 throw new ProtocolException("Q_PARSE header not allowed here", 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
|
1485 case Q_TABLE: |
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
|
1486 case Q_PREPARE: { |
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
|
1487 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
|
1488 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
|
1489 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
|
1490 // 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
|
1491 // 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
|
1492 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
|
1493 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
|
1494 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
|
1495 } |
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
|
1496 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
|
1497 } |
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
|
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 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
|
1500 case Q_UPDATE: |
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 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
|
1502 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
|
1503 case Q_SCHEMA: |
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 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
|
1505 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
|
1506 case Q_TRANS: |
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 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
|
1508 boolean isAutoCommit = ((AutoCommitResponse) res).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
|
1509 |
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 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
|
1511 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
|
1512 "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
|
1513 } |
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 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
|
1515 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
|
1516 case Q_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
|
1517 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
|
1518 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
|
1519 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
|
1520 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
|
1521 } |
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
|
1522 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
|
1523 } |
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
|
1524 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
|
1525 } |
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
|
1526 } 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
|
1527 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
|
1528 + 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
|
1529 " 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
|
1530 + 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
|
1531 // 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
|
1532 protocol.waitUntilPrompt(); |
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
|
1533 nextResponse = protocol.getCurrentServerResponseHeader(); |
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
|
1534 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
|
1535 } |
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 |
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 // 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
|
1538 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
|
1539 protocol.waitUntilPrompt(); |
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 nextResponse = protocol.getCurrentServerResponseHeader(); |
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
|
1541 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
|
1542 } |
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
|
1543 |
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
|
1544 // 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
|
1545 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
|
1546 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
|
1547 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
|
1548 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
|
1549 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
|
1550 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
|
1551 } 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
|
1552 // 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
|
1553 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
|
1554 protocol.waitUntilPrompt(); |
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 nextResponse = protocol.getCurrentServerResponseHeader(); |
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
|
1556 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
|
1557 } |
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
|
1558 } |
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 |
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
|
1561 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
|
1562 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
|
1563 } |
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
|
1564 |
80
0ae34196c54e
Started the embedded connection on the JDBC part. Mostly done by now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
74
diff
changeset
|
1565 // 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
|
1566 // 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
|
1567 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
|
1568 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
|
1569 } |
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
|
1570 // 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
|
1571 protocol.fetchNextResponseData(); |
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 nextResponse = protocol.getCurrentServerResponseHeader(); |
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 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
|
1574 case INFO: |
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 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
|
1576 // 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
|
1577 protocol.fetchNextResponseData(); |
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 nextResponse = protocol.getCurrentServerResponseHeader(); |
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 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
|
1580 case 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
|
1581 // 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
|
1582 // 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
|
1583 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
|
1584 protocol.waitUntilPrompt(); |
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
|
1585 nextResponse = protocol.getCurrentServerResponseHeader(); |
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
|
1586 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
|
1587 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
|
1588 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
|
1589 } |
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 } |
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 |
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 // 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
|
1593 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
|
1594 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
|
1595 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
|
1596 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
|
1597 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
|
1598 } 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
|
1599 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
|
1600 } |
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
|
1601 } |
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 } |
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 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
|
1604 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
|
1605 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
|
1606 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
|
1607 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
|
1608 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
|
1609 } 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
|
1610 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
|
1611 } |
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
|
1612 } |
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
|
1613 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
|
1614 } |
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
|
1615 } 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
|
1616 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
|
1617 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
|
1618 } 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
|
1619 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
|
1620 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
|
1621 } |
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
|
1622 } |
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
|
1623 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1624 } |