Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ public boolean isClosed() throws SQLException {

public DatabaseMetaData getMetaData() throws SQLException {
checkOpen();
if (null != databaseMetaData) {
if (!metadataNullOrClosed()) {
return databaseMetaData;
} else {
synchronized (VitessConnection.class) {
if (null == databaseMetaData) {
if (metadataNullOrClosed()) {
String dbEngine = initializeDBProperties();
if (dbEngine.equals("mariadb")) {
databaseMetaData = new VitessMariaDBDatabaseMetadata(this);
Expand All @@ -232,6 +232,10 @@ public DatabaseMetaData getMetaData() throws SQLException {
}
}

private boolean metadataNullOrClosed() throws SQLException {
return null == databaseMetaData || null == databaseMetaData.getConnection() || databaseMetaData.getConnection().isClosed();
}

public boolean isReadOnly() throws SQLException {
checkOpen();
return readOnly;
Expand Down Expand Up @@ -786,7 +790,7 @@ private String initializeDBProperties() throws SQLException {
HashMap<String, String> dbVariables = new HashMap<>();
String dbEngine = null;

if (null == databaseMetaData) {
if (metadataNullOrClosed()) {
String versionValue;
ResultSet resultSet = null;
VitessStatement vitessStatement = new VitessStatement(this);
Expand Down