Mercurial > hg > monetdb-java
annotate src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiStartOfHeaderParser.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 | 4bb4e988164d |
rev | line source |
---|---|
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:
74
diff
changeset
|
1 /* |
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:
74
diff
changeset
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
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:
74
diff
changeset
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
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:
74
diff
changeset
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
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:
74
diff
changeset
|
5 * |
91
6f74e01c57da
Made fixings regarding the null values retrieval. The JDBC embedded connection is working!!! :) Some more testing, optimizations and compilations fixes are still required.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
87
diff
changeset
|
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2017 MonetDB B.V. |
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:
74
diff
changeset
|
7 */ |
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:
74
diff
changeset
|
8 |
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:
diff
changeset
|
9 package nl.cwi.monetdb.mcl.protocol.oldmapi; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
10 |
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
|
11 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:
diff
changeset
|
12 import nl.cwi.monetdb.mcl.protocol.StarterHeaders; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
13 |
67
87ba760038b6
More cleanup. About to start the tuple conversions.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
66
diff
changeset
|
14 final class OldMapiStartOfHeaderParser { |
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:
diff
changeset
|
15 |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
16 static StarterHeaders GetNextStartHeaderOnOldMapi(OldMapiProtocol protocol) { |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
17 StarterHeaders res; |
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:
71
diff
changeset
|
18 switch (protocol.lineBuffer.get()) { |
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:
diff
changeset
|
19 case '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:
diff
changeset
|
20 res = StarterHeaders.Q_PARSE; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
21 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
22 case '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:
diff
changeset
|
23 res = StarterHeaders.Q_TABLE; |
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
|
24 protocol.lineBuffer.get(); |
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:
diff
changeset
|
25 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
26 case '2': |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
27 res = StarterHeaders.Q_UPDATE; |
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
|
28 protocol.lineBuffer.get(); |
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:
diff
changeset
|
29 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
30 case '3': |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
31 res = StarterHeaders.Q_SCHEMA; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
32 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
33 case '4': |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
34 res = StarterHeaders.Q_TRANS; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
35 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
36 case '5': |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
37 res = StarterHeaders.Q_PREPARE; |
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
|
38 protocol.lineBuffer.get(); |
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:
diff
changeset
|
39 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
40 case '6': |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
41 res = StarterHeaders.Q_BLOCK; |
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
|
42 protocol.lineBuffer.get(); |
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:
diff
changeset
|
43 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
44 default: |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
45 res = StarterHeaders.Q_UNKNOWN; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
46 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
47 return res; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
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:
diff
changeset
|
49 |
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
|
50 static int GetNextResponseDataAsInt(OldMapiProtocol protocol) throws ProtocolException { |
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:
71
diff
changeset
|
51 int currentPointer = protocol.lineBuffer.position(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
52 int limit = protocol.lineBuffer.limit(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
53 char[] array = protocol.lineBuffer.array(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
54 |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
55 if (currentPointer >= limit) { |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
56 throw new ProtocolException("unexpected end of string", currentPointer - 1); |
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:
diff
changeset
|
57 } |
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
|
58 int tmp = 0, negative = 1;; |
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:
71
diff
changeset
|
59 char chr = array[currentPointer++]; |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
60 // note: don't use Character.isDigit() here, because we only want ISO-LATIN-1 digits |
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:
diff
changeset
|
61 if (chr >= '0' && chr <= '9') { |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
62 tmp = (int)chr - (int)'0'; |
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
|
63 } else if(chr == '-') { |
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
|
64 negative = -1; |
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:
diff
changeset
|
65 } else { |
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:
71
diff
changeset
|
66 throw new ProtocolException("expected a digit", currentPointer - 1); |
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:
diff
changeset
|
67 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
68 |
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:
71
diff
changeset
|
69 while (currentPointer < limit) { |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
70 chr = array[currentPointer++]; |
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:
diff
changeset
|
71 if(chr == ' ') { |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
72 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
73 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
74 tmp *= 10; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
75 if (chr >= '0' && chr <= '9') { |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
76 tmp += (int)chr - (int)'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:
diff
changeset
|
77 } else { |
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:
71
diff
changeset
|
78 throw new ProtocolException("expected a digit", currentPointer - 1); |
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:
diff
changeset
|
79 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
80 } |
93
eeb71f7d36bf
Fixed a bug on the JDBC MAPI connection from the old code! Fixed the connection properties for an JDBC Embedded connection. To start a JDBC Embedded connection, the user must start the embedded database beforehand with the method MonetDBEmbeddedDatabase.StartDatabase().
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
91
diff
changeset
|
81 tmp *= negative; |
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:
71
diff
changeset
|
82 protocol.lineBuffer.position(currentPointer); |
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:
diff
changeset
|
83 return tmp; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
84 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
85 |
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
|
86 static String GetNextResponseDataAsString(OldMapiProtocol protocol) throws ProtocolException { |
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:
71
diff
changeset
|
87 int currentPointer = protocol.lineBuffer.position(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
88 int limit = protocol.lineBuffer.limit(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
89 char[] array = protocol.lineBuffer.array(); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
90 |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
91 if (currentPointer >= limit) { |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
92 throw new ProtocolException("unexpected end of string", currentPointer - 1); |
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:
diff
changeset
|
93 } |
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:
71
diff
changeset
|
94 int cnt = 0, mark = currentPointer; |
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:
diff
changeset
|
95 char chr; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
96 |
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:
71
diff
changeset
|
97 while (currentPointer < limit) { |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
98 chr = array[currentPointer++]; |
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:
diff
changeset
|
99 if(chr == ' ') { |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
100 break; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
101 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
102 cnt++; |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
103 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
104 |
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:
71
diff
changeset
|
105 protocol.lineBuffer.position(mark); |
17365ed26611
In Java, you cannot get a pointer to a String, in order to make a faster memory copy. So I had to change a StringBuilder to a CharBuffer which allows to retrieve the pointer and make a faster processing.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
71
diff
changeset
|
106 return new String(array, 0, cnt); |
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:
diff
changeset
|
107 } |
7307caacc2d5
Intermediary commit. Cross-implementation interface (for mapi connection with the old protocol, mapi connection with the new protocol and the embedded connection) almost done. The mcl layer processing is more memory efficient now.
Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
parents:
diff
changeset
|
108 } |