Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[CONJ-288] using SHOW VARIABLES to replace SELECT on connection to pe…
…rmit connection on a galera non primary node
  • Loading branch information
rusher committed Apr 28, 2016
1 parent 95e7a7f commit 69c5997
Showing 1 changed file with 8 additions and 10 deletions.
Expand Up @@ -593,17 +593,15 @@ private void loadServerData() throws QueryException, IOException {
serverData = new TreeMap<>();
SingleExecutionResult qr = new SingleExecutionResult(null, 0, true, false);
try {
executeQuery(qr, "SELECT "
+ "@@max_allowed_packet, "
+ "@@system_time_zone, "
+ "@@time_zone, "
+ "@@sql_mode", ResultSet.TYPE_FORWARD_ONLY);
executeQuery(qr, "SHOW VARIABLES WHERE Variable_name in ("
+ "'max_allowed_packet', "
+ "'system_time_zone', "
+ "'time_zone', "
+ "'sql_mode'"
+ ")", ResultSet.TYPE_FORWARD_ONLY);
MariaSelectResultSet resultSet = qr.getResult();
if (resultSet.next()) {
serverData.put("max_allowed_packet", resultSet.getString(1));
serverData.put("system_time_zone", resultSet.getString(2));
serverData.put("time_zone", resultSet.getString(3));
serverData.put("sql_mode", resultSet.getString(4));
while (resultSet.next()) {
serverData.put(resultSet.getString(1), resultSet.getString(2));
}
} catch (SQLException sqle) {
throw new QueryException("could not load system variables", -1, ExceptionMapper.SqlStates.CONNECTION_EXCEPTION.getSqlState(), sqle);
Expand Down

0 comments on commit 69c5997

Please sign in to comment.