From aa8cdc60d87b13b406b1d341cd93e702e52b4e48 Mon Sep 17 00:00:00 2001 From: rusher Date: Mon, 13 Jul 2020 16:36:22 +0200 Subject: [PATCH 1/5] [CONJ-802] version parser correction --- pom.xml | 2 +- .../jdbc/internal/util/constant/Version.java | 13 +++++++------ .../java/org/mariadb/jdbc/ConnectionTest.java | 19 +++++++++++++++++++ src/test/resources/conf.properties | 3 +-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 8baf35f27..e4d38424a 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ mariadb-java-client jar mariadb-java-client - 2.6.1 + 2.6.2-SNAPSHOT JDBC driver for MariaDB and MySQL https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/ diff --git a/src/main/java/org/mariadb/jdbc/internal/util/constant/Version.java b/src/main/java/org/mariadb/jdbc/internal/util/constant/Version.java index fde43ea73..c031a172b 100644 --- a/src/main/java/org/mariadb/jdbc/internal/util/constant/Version.java +++ b/src/main/java/org/mariadb/jdbc/internal/util/constant/Version.java @@ -65,23 +65,24 @@ public final class Version { static { InputStream inputStream = null; - String tmpVersion = "5.5.0"; + String tmpVersion = "2.6.2"; try { Properties prop = new Properties(); - inputStream = Version.class.getClassLoader().getResourceAsStream("mariadb.properties"); + inputStream = Version.class.getResourceAsStream("/mariadb.properties"); if (inputStream != null) { prop.load(inputStream); + // get the property value and print it out + tmpVersion = prop.getProperty("version"); } else { System.out.println("property file 'mariadb.properties' not found in the classpath"); } - - // get the property value and print it out - tmpVersion = prop.getProperty("version"); } catch (Exception e) { // eat } finally { try { - inputStream.close(); + if (inputStream != null) { + inputStream.close(); + } } catch (IOException ioe) { // eat } diff --git a/src/test/java/org/mariadb/jdbc/ConnectionTest.java b/src/test/java/org/mariadb/jdbc/ConnectionTest.java index 6f425096d..69397f61a 100644 --- a/src/test/java/org/mariadb/jdbc/ConnectionTest.java +++ b/src/test/java/org/mariadb/jdbc/ConnectionTest.java @@ -1006,4 +1006,23 @@ public void readOnly() throws SQLException { connection.setReadOnly(false); stmt.execute("DROP TABLE testReadOnly"); } + + + @Test + public void connectionAttributes() throws SQLException { + + try (MariaDbConnection conn = (MariaDbConnection) setConnection("&connectionAttributes=test:test1")) { + Statement stmt = conn.createStatement(); + ResultSet rs1 = stmt.executeQuery("SELECT @@performance_schema"); + rs1.next(); + if ("1".equals(rs1.getString(1))) { + ResultSet rs = stmt.executeQuery("SELECT * from performance_schema.session_connect_attrs where processlist_id=" + + conn.getServerThreadId() + " AND ATTR_NAME='test'"); + while (rs.next()) { + assertEquals("test1", rs.getString("ATTR_VALUE")); + } + } + }; + } + } diff --git a/src/test/resources/conf.properties b/src/test/resources/conf.properties index 8aa91c424..1fe773618 100644 --- a/src/test/resources/conf.properties +++ b/src/test/resources/conf.properties @@ -2,5 +2,4 @@ DB_HOST=localhost DB_PORT=3306 DB_DATABASE=testj DB_USER=root -DB_PASSWORD= - +DB_PASSWORD= \ No newline at end of file From d7927934e9d0e680f8838628e7d555913345bbcb Mon Sep 17 00:00:00 2001 From: rusher Date: Fri, 17 Jul 2020 16:30:36 +0200 Subject: [PATCH 2/5] [CONJ-808] collation utf32 regression correction --- .../mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java index 6e9a5f26e..a8a4b0de2 100644 --- a/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java +++ b/src/main/java/org/mariadb/jdbc/internal/protocol/AbstractConnectProtocol.java @@ -1219,7 +1219,7 @@ private byte decideLanguage(int serverLanguage) { if (serverLanguage >= 192 && serverLanguage <= 215) { // equivalent utf8mb4 collation - return (byte) (serverLanguage - 32); + return (byte) (serverLanguage + 32); } return (byte) 224; // UTF8MB4_UNICODE_CI; From 426d8290ff76e7984d03505f3f2b98afd07cf76b Mon Sep 17 00:00:00 2001 From: rusher Date: Wed, 22 Jul 2020 11:53:56 +0200 Subject: [PATCH 3/5] [misc] error improvement on wrong label --- .../com/read/dao/ColumnLabelIndexer.java | 10 +++++- .../java/org/mariadb/jdbc/ConnectionTest.java | 14 ++++---- .../java/org/mariadb/jdbc/ResultSetTest.java | 34 +++++++++++++------ 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/internal/com/read/dao/ColumnLabelIndexer.java b/src/main/java/org/mariadb/jdbc/internal/com/read/dao/ColumnLabelIndexer.java index f284a7007..eb4284f3d 100644 --- a/src/main/java/org/mariadb/jdbc/internal/com/read/dao/ColumnLabelIndexer.java +++ b/src/main/java/org/mariadb/jdbc/internal/com/read/dao/ColumnLabelIndexer.java @@ -131,7 +131,15 @@ public int getIndex(String name) throws SQLException { res = originalMap.get(lowerName); if (res == null) { - throw ExceptionFactory.INSTANCE.create("No such column: " + name, "42S22", 1054); + Map possible = new HashMap<>(); + possible.putAll(aliasMap); + possible.putAll(originalMap); + throw ExceptionFactory.INSTANCE.create( + String.format( + "No such column: '%s'. '%s' must be in %s", + name, lowerName, possible.keySet().toString()), + "42S22", + 1054); } return res; } diff --git a/src/test/java/org/mariadb/jdbc/ConnectionTest.java b/src/test/java/org/mariadb/jdbc/ConnectionTest.java index 69397f61a..c2b1a5fb6 100644 --- a/src/test/java/org/mariadb/jdbc/ConnectionTest.java +++ b/src/test/java/org/mariadb/jdbc/ConnectionTest.java @@ -1007,22 +1007,24 @@ public void readOnly() throws SQLException { stmt.execute("DROP TABLE testReadOnly"); } - @Test public void connectionAttributes() throws SQLException { - try (MariaDbConnection conn = (MariaDbConnection) setConnection("&connectionAttributes=test:test1")) { + try (MariaDbConnection conn = + (MariaDbConnection) setConnection("&connectionAttributes=test:test1")) { Statement stmt = conn.createStatement(); ResultSet rs1 = stmt.executeQuery("SELECT @@performance_schema"); rs1.next(); if ("1".equals(rs1.getString(1))) { - ResultSet rs = stmt.executeQuery("SELECT * from performance_schema.session_connect_attrs where processlist_id=" - + conn.getServerThreadId() + " AND ATTR_NAME='test'"); + ResultSet rs = + stmt.executeQuery( + "SELECT * from performance_schema.session_connect_attrs where processlist_id=" + + conn.getServerThreadId() + + " AND ATTR_NAME='test'"); while (rs.next()) { assertEquals("test1", rs.getString("ATTR_VALUE")); } } - }; + } } - } diff --git a/src/test/java/org/mariadb/jdbc/ResultSetTest.java b/src/test/java/org/mariadb/jdbc/ResultSetTest.java index 05c63358f..820c53e7e 100644 --- a/src/test/java/org/mariadb/jdbc/ResultSetTest.java +++ b/src/test/java/org/mariadb/jdbc/ResultSetTest.java @@ -1196,19 +1196,31 @@ public void checkInvisibleMetaData() throws SQLException { @Test public void columnNamesMappingError() throws SQLException { - createTable("columnNamesMappingError", "xx tinyint(1)"); + createTable( + "columnNamesMappingError", "xX INT NOT NULL AUTO_INCREMENT, " + " PRIMARY KEY(xX)"); + Statement stmt = sharedConnection.createStatement(); stmt.executeUpdate("INSERT INTO columnNamesMappingError VALUES (4)"); - ResultSet rs = stmt.executeQuery("SELECT * FROM columnNamesMappingError"); - assertTrue(rs.next()); - assertEquals(4, rs.getInt("xx")); - try { - rs.getInt("wrong_column_name"); - fail("must have fail, column 'wrong_column_name' does not exists"); - } catch (SQLException e) { - assertEquals("42S22", e.getSQLState()); - assertEquals(1054, e.getErrorCode()); - assertEquals("No such column: wrong_column_name", e.getMessage()); + try (PreparedStatement preparedStatement = + sharedConnection.prepareStatement( + "SELECT * FROM " + "columnNamesMappingError", + ResultSet.TYPE_FORWARD_ONLY, + ResultSet.CONCUR_UPDATABLE)) { + ResultSet rs = preparedStatement.executeQuery(); + assertTrue(rs.next()); + assertEquals(4, rs.getInt("xx")); + try { + rs.getInt("wrong_column_name"); + fail("must have fail, column 'wrong_column_name' does not exists"); + } catch (SQLException e) { + assertEquals("42S22", e.getSQLState()); + assertEquals(1054, e.getErrorCode()); + assertTrue( + e.getMessage() + .contains( + "No such column: 'wrong_column_name'. 'wrong_column_name' must be in " + + "[xx, columnnamesmappingerror.xx]")); + } } } From ca79fb31bee3213c362178c7fd9b633f8f4707b1 Mon Sep 17 00:00:00 2001 From: rusher Date: Wed, 22 Jul 2020 18:12:59 +0200 Subject: [PATCH 4/5] [CONJ-809] resultset metadata implementation correction for isReadOnly/isWritable/isDefinitelyWritable --- .../jdbc/MariaDbResultSetMetaData.java | 19 ++-- .../jdbc/ServerSidePreparedStatement.java | 2 +- .../com/read/resultset/SelectResultSet.java | 2 +- .../read/resultset/UpdatableResultSet.java | 5 - .../mariadb/jdbc/ResultSetMetaDataTest.java | 41 ++++--- .../java/org/mariadb/jdbc/ResultSetTest.java | 2 +- .../org/mariadb/jdbc/UpdateResultSetTest.java | 107 ++---------------- 7 files changed, 44 insertions(+), 134 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java b/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java index d5438f603..e23449bda 100644 --- a/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java +++ b/src/main/java/org/mariadb/jdbc/MariaDbResultSetMetaData.java @@ -36,7 +36,6 @@ public class MariaDbResultSetMetaData implements ResultSetMetaData { private final ColumnDefinition[] fieldPackets; private final Options options; private final boolean forceAlias; - private final boolean updatable; /** * Constructor. @@ -44,17 +43,12 @@ public class MariaDbResultSetMetaData implements ResultSetMetaData { * @param fieldPackets column informations * @param options connection options * @param forceAlias force table and column name alias as original data - * @param updatable is column updatable */ public MariaDbResultSetMetaData( - final ColumnDefinition[] fieldPackets, - final Options options, - final boolean forceAlias, - final boolean updatable) { + final ColumnDefinition[] fieldPackets, final Options options, final boolean forceAlias) { this.fieldPackets = fieldPackets; this.options = options; this.forceAlias = forceAlias; - this.updatable = updatable; } /** @@ -312,10 +306,9 @@ public String getColumnTypeName(final int column) throws SQLException { * @throws SQLException if a database access error occurs or in case of wrong index */ public boolean isReadOnly(final int column) throws SQLException { - if (column >= 1 && column <= fieldPackets.length) { - return !updatable; - } - throw ExceptionFactory.INSTANCE.create(String.format("no column with index %s", column)); + ColumnDefinition ci = getColumnInformation(column); + return (ci.getOriginalTable() == null || ci.getOriginalTable().isEmpty()) + && (ci.getOriginalName() == null || ci.getOriginalName().isEmpty()); } /** @@ -362,7 +355,9 @@ private ColumnDefinition getColumnInformation(int column) throws SQLException { if (column >= 1 && column <= fieldPackets.length) { return fieldPackets[column - 1]; } - throw ExceptionFactory.INSTANCE.create("No such column"); + throw ExceptionFactory.INSTANCE.create( + String.format( + "wrong column index %s. must be in [1, %s] range", column, fieldPackets.length)); } /** diff --git a/src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java b/src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java index 2dc278102..d3dbae7fc 100644 --- a/src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java +++ b/src/main/java/org/mariadb/jdbc/ServerSidePreparedStatement.java @@ -118,7 +118,7 @@ private void setMetaFromResult() { parameterCount = serverPrepareResult.getParameters().length; metadata = new MariaDbResultSetMetaData( - serverPrepareResult.getColumns(), protocol.getUrlParser().getOptions(), false, false); + serverPrepareResult.getColumns(), protocol.getUrlParser().getOptions(), false); parameterMetaData = new MariaDbParameterMetaData(serverPrepareResult.getParameters()); } diff --git a/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java index 5f9a27311..08b6c4a55 100644 --- a/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java +++ b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java @@ -1150,7 +1150,7 @@ public String getCursorName() throws SQLException { /** {inheritDoc}. */ public ResultSetMetaData getMetaData() { - return new MariaDbResultSetMetaData(columnsInformation, options, forceAlias, false); + return new MariaDbResultSetMetaData(columnsInformation, options, forceAlias); } /** {inheritDoc}. */ diff --git a/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java index 9c3754cd1..d24018ea2 100644 --- a/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java +++ b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/UpdatableResultSet.java @@ -273,11 +273,6 @@ private void checkIfUpdatable(Results results) throws SQLException { } } - @Override - public ResultSetMetaData getMetaData() { - return new MariaDbResultSetMetaData(columnsInformation, options, false, canBeUpdate); - } - private UpdatableColumnDefinition[] getUpdatableColumns() { return (UpdatableColumnDefinition[]) columnsInformation; } diff --git a/src/test/java/org/mariadb/jdbc/ResultSetMetaDataTest.java b/src/test/java/org/mariadb/jdbc/ResultSetMetaDataTest.java index 02750d79e..bfaa12069 100644 --- a/src/test/java/org/mariadb/jdbc/ResultSetMetaDataTest.java +++ b/src/test/java/org/mariadb/jdbc/ResultSetMetaDataTest.java @@ -70,41 +70,46 @@ public void metaDataTest() throws SQLException { assertEquals("unikey_col", rsmd.getColumnName(3)); assertEquals(Types.CHAR, rsmd.getColumnType(4)); assertEquals(Types.SMALLINT, rsmd.getColumnType(5)); - assertTrue(rsmd.isReadOnly(1)); - assertTrue(rsmd.isReadOnly(2)); - assertTrue(rsmd.isReadOnly(3)); - assertTrue(rsmd.isReadOnly(4)); - assertTrue(rsmd.isReadOnly(5)); - assertFalse(rsmd.isWritable(1)); - assertFalse(rsmd.isWritable(2)); - assertFalse(rsmd.isWritable(3)); - assertFalse(rsmd.isWritable(4)); - assertFalse(rsmd.isWritable(5)); - assertFalse(rsmd.isDefinitelyWritable(1)); - assertFalse(rsmd.isDefinitelyWritable(2)); - assertFalse(rsmd.isDefinitelyWritable(3)); - assertFalse(rsmd.isDefinitelyWritable(4)); - assertFalse(rsmd.isDefinitelyWritable(5)); + assertFalse(rsmd.isReadOnly(1)); + assertFalse(rsmd.isReadOnly(2)); + assertFalse(rsmd.isReadOnly(3)); + assertFalse(rsmd.isReadOnly(4)); + assertFalse(rsmd.isReadOnly(5)); + assertTrue(rsmd.isWritable(1)); + assertTrue(rsmd.isWritable(2)); + assertTrue(rsmd.isWritable(3)); + assertTrue(rsmd.isWritable(4)); + assertTrue(rsmd.isWritable(5)); + assertTrue(rsmd.isDefinitelyWritable(1)); + assertTrue(rsmd.isDefinitelyWritable(2)); + assertTrue(rsmd.isDefinitelyWritable(3)); + assertTrue(rsmd.isDefinitelyWritable(4)); + assertTrue(rsmd.isDefinitelyWritable(5)); try { rsmd.isReadOnly(6); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 6")); + assertTrue(sqle.getMessage().contains("wrong column index 6. must be in [1, 5] range")); } try { rsmd.isWritable(6); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 6")); + assertTrue(sqle.getMessage().contains("wrong column index 6. must be in [1, 5] range")); } try { rsmd.isDefinitelyWritable(6); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 6")); + assertTrue(sqle.getMessage().contains("wrong column index 6. must be in [1, 5] range")); } + rs = stmt.executeQuery("select count(char_col) from test_rsmd"); + assertTrue(rs.next()); + rsmd = rs.getMetaData(); + assertTrue(rsmd.isReadOnly(1)); + DatabaseMetaData md = sharedConnection.getMetaData(); ResultSet cols = md.getColumns(null, null, "test\\_rsmd", null); cols.next(); diff --git a/src/test/java/org/mariadb/jdbc/ResultSetTest.java b/src/test/java/org/mariadb/jdbc/ResultSetTest.java index 820c53e7e..dccb2a934 100644 --- a/src/test/java/org/mariadb/jdbc/ResultSetTest.java +++ b/src/test/java/org/mariadb/jdbc/ResultSetTest.java @@ -1202,7 +1202,7 @@ public void columnNamesMappingError() throws SQLException { Statement stmt = sharedConnection.createStatement(); stmt.executeUpdate("INSERT INTO columnNamesMappingError VALUES (4)"); try (PreparedStatement preparedStatement = - sharedConnection.prepareStatement( + sharedConnection.prepareStatement( "SELECT * FROM " + "columnNamesMappingError", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)) { diff --git a/src/test/java/org/mariadb/jdbc/UpdateResultSetTest.java b/src/test/java/org/mariadb/jdbc/UpdateResultSetTest.java index f64b70696..7b4a88764 100644 --- a/src/test/java/org/mariadb/jdbc/UpdateResultSetTest.java +++ b/src/test/java/org/mariadb/jdbc/UpdateResultSetTest.java @@ -224,7 +224,7 @@ public void testMultipleDatabase() throws Exception { } @Test - public void testUpdateWithoutPrimary() throws Exception { + public void testMeta() throws Exception { createTable( "UpdateWithoutPrimary", "`id` INT NOT NULL AUTO_INCREMENT," @@ -265,126 +265,41 @@ public void testUpdateWithoutPrimary() throws Exception { "ResultSet cannot be updated. " + "Primary key field `id` is not in result-set")); } - ResultSetMetaData rsmd = rs.getMetaData(); - assertTrue(rsmd.isReadOnly(1)); - assertTrue(rsmd.isReadOnly(2)); - assertFalse(rsmd.isWritable(1)); - assertFalse(rsmd.isWritable(2)); - assertFalse(rsmd.isDefinitelyWritable(1)); - assertFalse(rsmd.isDefinitelyWritable(2)); - - try { - rsmd.isReadOnly(3); - fail("must have throw exception"); - } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 3")); - } - try { - rsmd.isWritable(3); - fail("must have throw exception"); - } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 3")); - } - try { - rsmd.isDefinitelyWritable(3); - fail("must have throw exception"); - } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 3")); - } - } - int[] autoInc = setAutoInc(); - ResultSet rs = stmt.executeQuery("SELECT id, t1, t2 FROM UpdateWithoutPrimary"); - assertTrue(rs.next()); - assertEquals(autoInc[1] + autoInc[0], rs.getInt(1)); - assertEquals("1-1", rs.getString(2)); - assertEquals("1-2", rs.getString(3)); - - assertFalse(rs.next()); - } - - @Test - public void testUpdateWithPrimary() throws Exception { - createTable( - "testUpdateWithPrimary", - "`id` INT NOT NULL AUTO_INCREMENT," - + "`t1` VARCHAR(50) NOT NULL," - + "`t2` VARCHAR(50) NULL default 'default-value'," - + "PRIMARY KEY (`id`)", - "DEFAULT CHARSET=utf8"); - - Statement stmt = sharedConnection.createStatement(); - stmt.executeQuery( - "INSERT INTO testUpdateWithPrimary(t1,t2) values ('1-1','1-2'),('2-1','2-2')"); - - String utf8escapeQuote = "你好 '' \" \\"; - - try (PreparedStatement preparedStatement = - sharedConnection.prepareStatement( - "SELECT id, t1, t2 FROM testUpdateWithPrimary", - ResultSet.TYPE_FORWARD_ONLY, - ResultSet.CONCUR_UPDATABLE)) { - ResultSet rs = preparedStatement.executeQuery(); - - rs.moveToInsertRow(); - rs.updateInt(1, -1); - rs.updateString(2, "0-1"); - rs.updateString(3, "0-2"); - rs.insertRow(); - - assertTrue(rs.next()); - assertTrue(rs.next()); - rs.updateString(2, utf8escapeQuote); - rs.updateRow(); - ResultSetMetaData rsmd = rs.getMetaData(); assertFalse(rsmd.isReadOnly(1)); assertFalse(rsmd.isReadOnly(2)); - assertFalse(rsmd.isReadOnly(3)); assertTrue(rsmd.isWritable(1)); assertTrue(rsmd.isWritable(2)); - assertTrue(rsmd.isWritable(3)); assertTrue(rsmd.isDefinitelyWritable(1)); assertTrue(rsmd.isDefinitelyWritable(2)); - assertTrue(rsmd.isDefinitelyWritable(3)); try { - rsmd.isReadOnly(4); + rsmd.isReadOnly(3); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 4")); + System.out.println(sqle.getMessage()); + assertTrue(sqle.getMessage().contains("wrong column index 3. must be in [1, 2] range")); } try { - rsmd.isWritable(4); + rsmd.isWritable(3); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 4")); + assertTrue(sqle.getMessage().contains("wrong column index 3. must be in [1, 2] range")); } try { - rsmd.isDefinitelyWritable(4); + rsmd.isDefinitelyWritable(3); fail("must have throw exception"); } catch (SQLException sqle) { - assertTrue(sqle.getMessage().contains("no column with index 4")); + assertTrue(sqle.getMessage().contains("wrong column index 3. must be in [1, 2] range")); } } - - final int[] autoInc = setAutoInc(); - - ResultSet rs = stmt.executeQuery("SELECT id, t1, t2 FROM testUpdateWithPrimary"); - assertTrue(rs.next()); - assertEquals(-1, rs.getInt(1)); - assertEquals("0-1", rs.getString(2)); - assertEquals("0-2", rs.getString(3)); - + int[] autoInc = setAutoInc(); + ResultSet rs = stmt.executeQuery("SELECT id, t1, t2 FROM UpdateWithoutPrimary"); assertTrue(rs.next()); - assertEquals(autoInc[0] + autoInc[1], rs.getInt(1)); + assertEquals(autoInc[1] + autoInc[0], rs.getInt(1)); assertEquals("1-1", rs.getString(2)); assertEquals("1-2", rs.getString(3)); - assertTrue(rs.next()); - assertEquals(2 * autoInc[0] + autoInc[1], rs.getInt(1)); - assertEquals(utf8escapeQuote, rs.getString(2)); - assertEquals("2-2", rs.getString(3)); - assertFalse(rs.next()); } From 6de6b5dbf2e3cee3643f59d0d1699424d0ce040f Mon Sep 17 00:00:00 2001 From: rusher Date: Wed, 22 Jul 2020 18:54:08 +0200 Subject: [PATCH 5/5] bump 2.6.2 version --- CHANGELOG.md | 8 ++++++++ README.md | 4 ++-- pom.xml | 2 +- src/main/resources/mariadb.properties | 19 ------------------- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6afe101d0..cfa1917ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [2.6.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.6.2) (23 Jul. 2020) +[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.6.1...2.6.2) + +* CONJ-804 - Automatic charset correction +* CONJ-809 - SelectResultSet's (ResultSet)MetaData always indicates all columns to be readonly +* CONJ-802 - Version parsing depending on Classloader might result in connection Exception + + ## [2.6.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.6.1) (23 Jun. 2020) [Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.6.0...2.6.1) diff --git a/README.md b/README.md index 3036e11ed..204f89880 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ or maven : org.mariadb.jdbc mariadb-java-client - 2.6.1 + 2.6.2 ``` @@ -46,7 +46,7 @@ Development snapshot are available on sonatype nexus repository org.mariadb.jdbc mariadb-java-client - 2.6.2-SNAPSHOT + 2.6.3-SNAPSHOT ``` diff --git a/pom.xml b/pom.xml index e4d38424a..1fc53e3e9 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ mariadb-java-client jar mariadb-java-client - 2.6.2-SNAPSHOT + 2.6.2 JDBC driver for MariaDB and MySQL https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/ diff --git a/src/main/resources/mariadb.properties b/src/main/resources/mariadb.properties index d28b42a72..e5683df88 100644 --- a/src/main/resources/mariadb.properties +++ b/src/main/resources/mariadb.properties @@ -1,20 +1 @@ -# -# MariaDB Client for Java -# -# Copyright (c) 2012-2014 Monty Program Ab. -# Copyright (c) 2015-2020 MariaDB Corporation Ab. -# -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; either version 2.1 of the License, or (at your option) -# any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public License along -# with this library; if not, write to Monty Program Ab info@montyprogram.com. -# version=${project.version} \ No newline at end of file