diff --git a/.circleci/config.yml b/.circleci/config.yml
index c3496390c..8f5c3c1b5 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -100,6 +100,7 @@ jobs:
SINGLESTORE_PASSWORD: << parameters.singlestore_password >>
TEST_ENVIRON: CIRCLE_CI
JAVA_HOME: /usr/lib/jvm/java-<< parameters.java_version >>-openjdk-amd64
+ JAVA_VERSION: << parameters.java_version >>
steps:
- setup_environment:
java_version: << parameters.java_version >>
@@ -115,7 +116,15 @@ jobs:
paths:
- ~/.m2
key: singlestore-jdbc-client-{{ checksum "pom.xml" }}
- - run: mvn test
+ - run:
+ name: Run tests
+ command: |
+ echo "Use JDK ${JAVA_VERSION}"
+ if [ "${JAVA_VERSION}" = "8" ]; then
+ mvn compile -P java8
+ else
+ mvn compile
+ fi
- store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard.
# Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: target/surefire-reports
diff --git a/src/main/java/com/singlestore/jdbc/BlobImpl.java b/src/main/java/com/singlestore/jdbc/BlobImpl.java
index d1611d6f2..a17ceb511 100644
--- a/src/main/java/com/singlestore/jdbc/BlobImpl.java
+++ b/src/main/java/com/singlestore/jdbc/BlobImpl.java
@@ -150,6 +150,7 @@ public InputStream getBinaryStream(final long pos, final long length) throws SQL
* @param pattern the byte array for which to search
* @param start the position at which to begin searching; the first position is 1
* @return the position at which the pattern appears, else -1
+ * @throws java.sql.SQLException if an error occurs
*/
public long position(final byte[] pattern, final long start) throws SQLException {
if (pattern.length == 0) {
@@ -184,6 +185,7 @@ public long position(final byte[] pattern, final long start) throws SQLException
* @param start the position in the BLOB
value at which to begin searching; the first
* position is 1
* @return the position at which the pattern begins, else -1
+ * @throws java.sql.SQLException if an error occurs
*/
public long position(final Blob pattern, final long start) throws SQLException {
byte[] blobBytes = pattern.getBytes(1, (int) pattern.length());
@@ -203,6 +205,7 @@ public long position(final Blob pattern, final long start) throws SQLException {
* @param bytes the array of bytes to be written to the BLOB
value that this
* Blob
object represents
* @return the number of bytes written
+ * @throws java.sql.SQLException if an error occurs
* @see #getBytes
*/
public int setBytes(final long pos, final byte[] bytes) throws SQLException {
diff --git a/src/main/java/com/singlestore/jdbc/Configuration.java b/src/main/java/com/singlestore/jdbc/Configuration.java
index c4dfed3fb..4861486eb 100644
--- a/src/main/java/com/singlestore/jdbc/Configuration.java
+++ b/src/main/java/com/singlestore/jdbc/Configuration.java
@@ -1151,9 +1151,8 @@ public String sessionVariables() {
}
/**
- * Must tinyint be considered as Bit
+ * Must tinyint be considered as Bit (TINYINT is always has reserved length = 4)
*
- * @apiNote TINYINT is always has reserved length = 4
* @return true if tinyint must be considered as Bit
*/
public boolean tinyInt1isBit() {
diff --git a/src/main/java/com/singlestore/jdbc/DatabaseMetaData.java b/src/main/java/com/singlestore/jdbc/DatabaseMetaData.java
index e4e5ffd61..569e1194f 100644
--- a/src/main/java/com/singlestore/jdbc/DatabaseMetaData.java
+++ b/src/main/java/com/singlestore/jdbc/DatabaseMetaData.java
@@ -140,7 +140,7 @@ public Version getVersion() throws java.sql.SQLException {
* This function is to return the version of S2
*
* @return S2 version object
- * @throws java.sql.SQLException
+ * @throws java.sql.SQLException if an error occurs
*/
public Version getSingleStoreVersion() throws java.sql.SQLException {
if (this.singleStoreVersion == null) {
@@ -156,7 +156,7 @@ public Version getSingleStoreVersion() throws java.sql.SQLException {
* This function is to return the version of MySQL
*
* @return MySQL Version Object
- * @throws java.sql.SQLException
+ * @throws java.sql.SQLException if an error occurs
*/
private Version getMySQLVersion() throws java.sql.SQLException {
if (this.version == null) {
diff --git a/src/main/java/com/singlestore/jdbc/ParameterMetaData.java b/src/main/java/com/singlestore/jdbc/ParameterMetaData.java
index c43be291c..b36586a08 100644
--- a/src/main/java/com/singlestore/jdbc/ParameterMetaData.java
+++ b/src/main/java/com/singlestore/jdbc/ParameterMetaData.java
@@ -103,7 +103,7 @@ public int getScale(int idx) throws SQLException {
/**
* Retrieves the designated parameter's SQL type.
*
- * @param param the first parameter is 1, the second is 2, ...
+ * @param idx the first parameter is 1, the second is 2, ...
* @return SQL type from java.sql.Types
* @throws SQLException because not supported
*/
diff --git a/src/main/java/com/singlestore/jdbc/Statement.java b/src/main/java/com/singlestore/jdbc/Statement.java
index bc0a5e6d7..9713936aa 100644
--- a/src/main/java/com/singlestore/jdbc/Statement.java
+++ b/src/main/java/com/singlestore/jdbc/Statement.java
@@ -216,7 +216,7 @@ public void close() throws SQLException {
* Abort current command result if streaming. result-set will be incomplete and closed, but ensure
* connection state
*/
- public void abort() throws SQLException {
+ public void abort() {
lock.lock();
try {
if (!closed) {
diff --git a/src/main/java/com/singlestore/jdbc/client/Context.java b/src/main/java/com/singlestore/jdbc/client/Context.java
index 7e88ea8d8..4443b8b02 100644
--- a/src/main/java/com/singlestore/jdbc/client/Context.java
+++ b/src/main/java/com/singlestore/jdbc/client/Context.java
@@ -174,7 +174,11 @@ public interface Context {
*/
void addStateFlag(int state);
- /** Indicate the number of connection on this server */
+ /**
+ * Indicate the number of connection on this server.
+ *
+ * @param threadsConnected number of threads
+ */
void setTreadsConnected(long threadsConnected);
/**
diff --git a/src/main/java/com/singlestore/jdbc/client/column/SignedTinyIntColumn.java b/src/main/java/com/singlestore/jdbc/client/column/SignedTinyIntColumn.java
index 57034a345..b5ba1dc27 100644
--- a/src/main/java/com/singlestore/jdbc/client/column/SignedTinyIntColumn.java
+++ b/src/main/java/com/singlestore/jdbc/client/column/SignedTinyIntColumn.java
@@ -18,11 +18,7 @@
import java.sql.Types;
import java.util.Calendar;
-/**
- * Column metadata definition
- *
- * @implNote S2 always returns length 4 for TINYINT
- */
+/** Column metadata definition (S2 always returns length 4 for TINYINT) */
public class SignedTinyIntColumn extends ColumnDefinitionPacket implements ColumnDecoder {
/**
diff --git a/src/main/java/com/singlestore/jdbc/client/impl/MultiPrimaryReplicaClient.java b/src/main/java/com/singlestore/jdbc/client/impl/MultiPrimaryReplicaClient.java
index d84e96b4c..bff49b8a7 100644
--- a/src/main/java/com/singlestore/jdbc/client/impl/MultiPrimaryReplicaClient.java
+++ b/src/main/java/com/singlestore/jdbc/client/impl/MultiPrimaryReplicaClient.java
@@ -90,7 +90,7 @@ private void reconnectIfNeeded() {
/**
* Reconnect connection, trying to continue transparently if possible. Different cases. * replica
- * fails => reconnect to replica or to master if no replica available
+ * fails - reconnect to replica or to master if no replica available
*
*
if reconnect succeed on replica / use master, no problem, continuing without interruption // * if reconnect primary, then replay transaction / throw exception if was in transaction. diff --git a/src/main/java/com/singlestore/jdbc/client/impl/StandardClient.java b/src/main/java/com/singlestore/jdbc/client/impl/StandardClient.java index 03f8096fe..1fc38abf3 100644 --- a/src/main/java/com/singlestore/jdbc/client/impl/StandardClient.java +++ b/src/main/java/com/singlestore/jdbc/client/impl/StandardClient.java @@ -113,11 +113,7 @@ public void run() { } } if (streamStmt != null) { - try { - streamStmt.abort(); - } catch (SQLException e) { - // eat - } + streamStmt.abort(); } closeSocket(); } @@ -848,8 +844,10 @@ public Completion readPacket(ClientMessage message) throws SQLException { * @param fetchSize default fetch size * @param resultSetConcurrency concurrency * @param resultSetType type + * @param maxRows max rows * @param closeOnCompletion must resultset close statement on completion * @throws SQLException if any exception + * @return completion result */ public Completion readPacket( com.singlestore.jdbc.Statement stmt, diff --git a/src/main/java/com/singlestore/jdbc/message/client/ChangeDbPacket.java b/src/main/java/com/singlestore/jdbc/message/client/ChangeDbPacket.java index 8dbe80b9e..a09ce1c56 100644 --- a/src/main/java/com/singlestore/jdbc/message/client/ChangeDbPacket.java +++ b/src/main/java/com/singlestore/jdbc/message/client/ChangeDbPacket.java @@ -25,7 +25,7 @@ public ChangeDbPacket(String database) { /** * COM_INIT_DB packet * - *
int<1> 0x02 : COM_INIT_DB Header string int[1] 0x02 : COM_INIT_DB Header string[NUL] schema name
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/ClosePreparePacket.java b/src/main/java/com/singlestore/jdbc/message/client/ClosePreparePacket.java
index d4a232c78..db7a9bbe2 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/ClosePreparePacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/ClosePreparePacket.java
@@ -23,7 +23,7 @@ public ClosePreparePacket(int statementId) {
this.statementId = statementId;
}
- /** COM_STMT_CLOSE packet. int<1> 0x19 COM_STMT_CLOSE header int<4> Statement id */
+ /** COM_STMT_CLOSE packet. int[1] 0x19 COM_STMT_CLOSE header int[4] Statement id */
@Override
public int encode(Writer writer, Context context) throws IOException {
assert statementId != 0;
diff --git a/src/main/java/com/singlestore/jdbc/message/client/ExecutePacket.java b/src/main/java/com/singlestore/jdbc/message/client/ExecutePacket.java
index efd17a11b..2f82e7952 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/ExecutePacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/ExecutePacket.java
@@ -67,10 +67,10 @@ public void ensureReplayable(Context context) throws IOException, SQLException {
/**
* COM_STMT_EXECUTE packet
*
- * int<1> 0x17 : COM_STMT_EXECUTE header int<4> statement id int<1> flags: int<4> Iteration
- * count (always 1) if (param_count > 0) byte<(param_count + 7)/8> null bitmap byte<1>: send type
- * to server (0 / 1) if (send type to server) for each parameter : byte<1>: field type byte<1>:
- * parameter flag for each parameter (i.e param_count times) byte int[1] 0x17 : COM_STMT_EXECUTE header int[4] statement id int[1] flags: int[4] Iteration
+ * count (always 1) if (param_count ] 0) byte[(param_count + 7)/8] null bitmap byte[1]: send type
+ * to server (0 / 1) if (send type to server) for each parameter : byte[1]: field type byte[1]:
+ * parameter flag for each parameter (i.e param_count times) byte[n] binary parameter value
*/
@Override
public int encode(Writer writer, Context context, Prepare newPrepareResult)
diff --git a/src/main/java/com/singlestore/jdbc/message/client/LongDataPacket.java b/src/main/java/com/singlestore/jdbc/message/client/LongDataPacket.java
index cd95f7b71..8bac39a96 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/LongDataPacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/LongDataPacket.java
@@ -40,8 +40,8 @@ public LongDataPacket(int statementId, Parameter parameter, int index) {
/**
* COM_STMT_SEND_LONG_DATA packet
*
- * int<1> 0x18 COM_STMT_SEND_LONG_DATA header int<4> statement id int<2> parameter number
- * byte int[1] 0x18 COM_STMT_SEND_LONG_DATA header int[4] statement id int[2] parameter number
+ * byte[EOF] data
*/
@Override
public int encode(Writer writer, Context context) throws IOException, SQLException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/PingPacket.java b/src/main/java/com/singlestore/jdbc/message/client/PingPacket.java
index 7b81d0c32..c5f78d948 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/PingPacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/PingPacket.java
@@ -17,7 +17,7 @@ public final class PingPacket implements ClientMessage {
/**
* COM_PING packet
*
- * int<1> 0x0e : COM_PING Header
+ * int[1] 0x0e : COM_PING Header
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/PreparePacket.java b/src/main/java/com/singlestore/jdbc/message/client/PreparePacket.java
index 138b9027f..773c63b46 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/PreparePacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/PreparePacket.java
@@ -37,7 +37,7 @@ public PreparePacket(String sql) {
/**
* COM_STMT_PREPARE packet
*
- * int<1> 0x16 COM_STMT_PREPARE header string int[1] 0x16 COM_STMT_PREPARE header string[EOF] SQL Statement
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/QueryPacket.java b/src/main/java/com/singlestore/jdbc/message/client/QueryPacket.java
index 2a2ee37a0..de6aff330 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/QueryPacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/QueryPacket.java
@@ -44,7 +44,7 @@ public int batchUpdateLength() {
/**
* COM_QUERY packet
*
- * int<1> 0x03 : COM_QUERY header string int[1] 0x03 : COM_QUERY header string[EOF] SQL statement
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/QuitPacket.java b/src/main/java/com/singlestore/jdbc/message/client/QuitPacket.java
index 1f6361223..d5d0d2e90 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/QuitPacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/QuitPacket.java
@@ -16,7 +16,7 @@ public final class QuitPacket implements ClientMessage {
/**
* COM_QUIT packet
*
- * int<1> 0x01 : COM_QUIT Header
+ * int[1] 0x01 : COM_QUIT Header
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/message/client/ResetPacket.java b/src/main/java/com/singlestore/jdbc/message/client/ResetPacket.java
index 8a6d58ac5..b8b9d2ca4 100644
--- a/src/main/java/com/singlestore/jdbc/message/client/ResetPacket.java
+++ b/src/main/java/com/singlestore/jdbc/message/client/ResetPacket.java
@@ -17,7 +17,7 @@ public final class ResetPacket implements ClientMessage {
/**
* COM_RESET_CONNECTION packet
*
- * int<1> 0x1f : COM_RESET_CONNECTION Header
+ * int[1] 0x1f : COM_RESET_CONNECTION Header
*/
@Override
public int encode(Writer writer, Context context) throws IOException {
diff --git a/src/main/java/com/singlestore/jdbc/plugin/authentication/addon/gssapi/GssapiAuth.java b/src/main/java/com/singlestore/jdbc/plugin/authentication/addon/gssapi/GssapiAuth.java
index cf9f78336..a9cf19a7a 100644
--- a/src/main/java/com/singlestore/jdbc/plugin/authentication/addon/gssapi/GssapiAuth.java
+++ b/src/main/java/com/singlestore/jdbc/plugin/authentication/addon/gssapi/GssapiAuth.java
@@ -19,6 +19,7 @@ public interface GssapiAuth {
* @param in socket reader
* @param servicePrincipalName SPN
* @param mechanisms mechanisms
+ * @param jaasApplicationName application name
* @throws IOException if any socket error occurs
* @throws SQLException for any other type of errors
*/