eskabetxe commented on code in PR #109:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/109#discussion_r1700016781


##########
flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/OceanBaseFactory.java:
##########
@@ -54,6 +55,20 @@ public JdbcCatalog createCatalog(
             String username,
             String pwd,
             String baseUrl) {
-        throw new UnsupportedOperationException("Catalog for OceanBase is not 
supported yet.");
+        throw new UnsupportedOperationException(
+                "Catalog for OceanBase without 'compatible-mode' is not 
supported.");

Review Comment:
   OceanBase don't have an default compatible mode??



##########
flink-connector-jdbc-oceanbase/src/main/java/org/apache/flink/connector/jdbc/oceanbase/database/catalog/OceanBaseCatalog.java:
##########
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.jdbc.oceanbase.database.catalog;
+
+import org.apache.flink.annotation.Internal;
+import 
org.apache.flink.connector.jdbc.core.database.catalog.AbstractJdbcCatalog;
+import 
org.apache.flink.connector.jdbc.core.database.catalog.JdbcCatalogTypeMapper;
+import org.apache.flink.connector.jdbc.core.table.JdbcConnectorOptions;
+import org.apache.flink.table.catalog.ObjectPath;
+import org.apache.flink.table.catalog.UniqueConstraint;
+import org.apache.flink.table.catalog.exceptions.CatalogException;
+import org.apache.flink.table.catalog.exceptions.DatabaseNotExistException;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.util.Preconditions;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.Set;
+
+import static 
org.apache.flink.connector.jdbc.JdbcConnectionOptions.getBriefAuthProperties;
+
+/** Catalog for OceanBase. */
+@Internal
+public class OceanBaseCatalog extends AbstractJdbcCatalog {
+
+    private static final Set<String> builtinDatabases =
+            new HashSet<String>() {
+                {
+                    add("__public");
+                    add("information_schema");
+                    add("mysql");
+                    add("oceanbase");
+                    add("LBACSYS");
+                    add("ORAAUDITOR");
+                }
+            };
+
+    private final String compatibleMode;
+    private final JdbcCatalogTypeMapper dialectTypeMapper;
+
+    public OceanBaseCatalog(
+            ClassLoader userClassLoader,
+            String catalogName,
+            String compatibleMode,
+            String defaultDatabase,
+            String username,
+            String pwd,
+            String baseUrl) {
+        this(
+                userClassLoader,
+                catalogName,
+                compatibleMode,
+                defaultDatabase,
+                baseUrl,
+                getBriefAuthProperties(username, pwd));
+    }
+
+    public OceanBaseCatalog(
+            ClassLoader userClassLoader,
+            String catalogName,
+            String compatibleMode,
+            String defaultDatabase,
+            String baseUrl,
+            Properties connectionProperties) {
+        super(userClassLoader, catalogName, defaultDatabase, baseUrl, 
connectionProperties);
+        this.compatibleMode = compatibleMode;
+        this.dialectTypeMapper = new OceanBaseTypeMapper(compatibleMode);
+    }
+
+    private boolean isMySQLMode() {
+        return "mysql".equalsIgnoreCase(compatibleMode);

Review Comment:
   should we have the compatible-mode on an enum?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to