You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "liugddx (via GitHub)" <gi...@apache.org> on 2023/04/12 02:49:31 UTC

[GitHub] [incubator-seatunnel] liugddx commented on a diff in pull request #4540: [Improve][Catalog] refactor catalog

liugddx commented on code in PR #4540:
URL: https://github.com/apache/incubator-seatunnel/pull/4540#discussion_r1163523479


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialect.java:
##########
@@ -193,4 +195,40 @@ default ResultSetMetaData getResultSetMetaData(
         PreparedStatement ps = conn.prepareStatement(jdbcSourceConfig.getQuery());
         return ps.getMetaData();
     }
+
+    default String listDatabases() {
+        return "SHOW DATABASES;";
+    }
+
+    default String getUrlFromDatabaseName(String baseUrl, String databaseName, String suffix) {
+        return baseUrl + databaseName + suffix;
+    }
+
+    default String createDatabaseSql(String databaseName) {
+        return String.format("CREATE DATABASE IF NOT EXISTS %s;", quoteIdentifier(databaseName));
+    }
+
+    default String dropDatabaseSql(String databaseName) {
+        return String.format("DROP DATABASE IF EXISTS %s;", quoteIdentifier(databaseName));
+    }
+
+    default String getTableName(ResultSet rs) throws SQLException {
+        return rs.getString(1);

Review Comment:
   > Because missing context, `1` is a Magic number
   
   I set mysql as the default, and other catalogs can override this method. do you have a good suggestion?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org