Skip to content

Commit

Permalink
[misc] MySQL 8 test correction
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jan 29, 2021
1 parent ee71dd4 commit 61c2105
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis/sql/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ CREATE USER 'bob'@'%';
GRANT ALL ON *.* TO 'bob'@'%' with grant option;

CREATE USER 'boby'@'%' identified by 'hey';
GRANT ALL ON *.* TO 'boby'@'%' /*M!100401 identified by 'hey' with grant option*/ ;
GRANT ALL ON *.* TO 'boby'@'%' /*M!100401 identified by 'hey' */ with grant option;

CREATE USER 'boby'@'localhost' identified by 'hey';
GRANT ALL ON *.* TO 'boby'@'localhost' /*M!100401 identified by 'hey' with grant option*/ ;
GRANT ALL ON *.* TO 'boby'@'localhost' /*M!100401 identified by 'hey' */ with grant option;

FLUSH PRIVILEGES;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@ public ResultSet getBestRowIdentifier(
throw new SQLException("'table' parameter cannot be null in getBestRowIdentifier()");
}

boolean hasIsGeneratedCol = (connection.isServerMariaDb() && connection.versionGreaterOrEqual(10, 2, 0));
boolean hasIsGeneratedCol =
(connection.isServerMariaDb() && connection.versionGreaterOrEqual(10, 2, 0));

String sql =
"SELECT "
Expand Down
14 changes: 10 additions & 4 deletions src/test/java/org/mariadb/jdbc/StoredProcedureTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -582,16 +582,22 @@ public void testMetaCatalogNoAccessToProcedureBodies() throws Exception {
Statement statement = sharedConnection.createStatement();
statement.execute("DROP USER IF EXISTS 'test_jdbc'@'%'");
statement.execute("DROP USER IF EXISTS 'test_jdbc'@'localhost'");
statement.execute("CREATE USER 'test_jdbc'@'localhost' IDENTIFIED BY 'testJ@dc1'");
statement.execute(
"CREATE USER 'test_jdbc'@'localhost' IDENTIFIED /*!80000 WITH mysql_native_password */ BY 'testJ@dc1'");
statement.execute(
"GRANT ALL ON "
+ database
+ ".* TO 'test_jdbc'@'localhost' IDENTIFIED BY 'testJ@dc1' WITH GRANT OPTION");
statement.execute("CREATE USER 'test_jdbc'@'%' IDENTIFIED BY 'testJ@dc1'");
+ ".* TO 'test_jdbc'@'localhost' "
+ ((isMariadbServer() || !minVersion(8, 0)) ? " IDENTIFIED BY 'testJ@dc1' " : "")
+ " WITH GRANT OPTION");
statement.execute(
"CREATE USER 'test_jdbc'@'%' IDENTIFIED /*!80000 WITH mysql_native_password */ BY 'testJ@dc1'");
statement.execute(
"GRANT ALL ON "
+ database
+ ".* TO 'test_jdbc'@'%' IDENTIFIED BY 'testJ@dc1' WITH GRANT OPTION");
+ ".* TO 'test_jdbc'@'%' "
+ ((isMariadbServer() || !minVersion(8, 0)) ? " IDENTIFIED BY 'testJ@dc1' " : "")
+ " WITH GRANT OPTION");
statement.execute("FLUSH PRIVILEGES");
Properties properties = new Properties();
properties.put("user", "test_jdbc");
Expand Down

0 comments on commit 61c2105

Please sign in to comment.