terrymanu commented on code in PR #19841:
URL: https://github.com/apache/shardingsphere/pull/19841#discussion_r936692334


##########
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-jdbc/shardingsphere-standalone-mode-repository-jdbc-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2Repository.java:
##########
@@ -44,7 +44,7 @@ public void init(final Properties props) {
         String jdbcUrl = 
Optional.ofNullable(Strings.emptyToNull(localRepositoryProps.getValue(JDBCRepositoryPropertyKey.JDBC_URL))).orElse(DEFAULT_JDBC_URL);
         String user = 
Optional.ofNullable(Strings.emptyToNull(localRepositoryProps.getValue(JDBCRepositoryPropertyKey.USER))).orElse(DEFAULT_USER);
         String password = 
Optional.ofNullable(Strings.emptyToNull(localRepositoryProps.getValue(JDBCRepositoryPropertyKey.PASSWORD))).orElse(DEFAULT_PASSWORD);
-        initTable(jdbcUrl, user, password);
+        initProviderAndTable(jdbcUrl, user, password);

Review Comment:
   how about remove `H2Repository`, just use `JDBCRepository + 
H2JDBCRepositoryProvider`?



##########
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-jdbc/shardingsphere-standalone-mode-repository-jdbc-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryProvider.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.shardingsphere.mode.repository.standalone.h2;
+
+import 
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepositoryProvider;
+
+/**
+ * H2 JDBC repository provider.
+ */
+public class H2JDBCRepositoryProvider implements JDBCRepositoryProvider {

Review Comment:
   Please add final if class does not design for extension.



##########
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-jdbc/shardingsphere-standalone-mode-repository-jdbc-h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryProvider.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.shardingsphere.mode.repository.standalone.h2;
+
+import 
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepositoryProvider;
+
+/**
+ * H2 JDBC repository provider.
+ */
+public class H2JDBCRepositoryProvider implements JDBCRepositoryProvider {
+    
+    @Override
+    public String dropTableSQL() {
+        return "DROP TABLE IF EXISTS repository";
+    }
+    
+    @Override
+    public String createTableSQL() {
+        return "CREATE TABLE repository(id varchar(36) PRIMARY KEY, key TEXT, 
value TEXT, parent TEXT)";

Review Comment:
   How about add escape characters(`) with table and column names to avoid 
reversed words conflict? 



##########
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-repository/shardingsphere-standalone-mode-repository-provider/shardingsphere-standalone-mode-repository-jdbc/shardingsphere-standalone-mode-repository-jdbc-core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryProvider.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * 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.shardingsphere.mode.repository.standalone.jdbc;
+
+import org.apache.shardingsphere.spi.annotation.SingletonSPI;
+import org.apache.shardingsphere.spi.type.typed.TypedSPI;
+
+/**
+ * JDBC repository provider.
+ */
+@SingletonSPI
+public interface JDBCRepositoryProvider extends TypedSPI {
+    
+    /**
+     * Drop table SQL.
+     *
+     * @return SQL statement to drop table
+     */
+    String dropTableSQL();
+    
+    /**
+     * Create table SQL.
+     *
+     * @return SQL statement to create table
+     */
+    String createTableSQL();
+    
+    /**
+     * Select by key SQL.
+     *
+     * @return SQL statement to select table
+     */
+    String selectByKeySQL();
+    
+    /**
+     * Select by parent key SQL.
+     *
+     * @return SQL statement to select table
+     */
+    String selectByParentKeySQL();
+    
+    /**
+     * Insert SQL.
+     *
+     * @return SQL statement to insert table
+     */
+    String insertSQL();
+    
+    /**
+     * Update SQL.
+     *
+     * @return SQL statement to update table

Review Comment:
   `SQL statement` is the core concept in ShardingSphere parser module, how 
about just change it to `SQL`?



-- 
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