You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/28 07:23:27 UTC

[GitHub] [shardingsphere] sandynz commented on a diff in pull request #22475: Pipeline SQL builder add reserved metadata, only quote reserved words

sandynz commented on code in PR #22475:
URL: https://github.com/apache/shardingsphere/pull/22475#discussion_r1033196872


##########
kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/sqlbuilder/MySQLPipelineSQLBuilderTest.java:
##########
@@ -61,4 +61,20 @@ private DataRecord mockDataRecord(final String tableName) {
         result.addColumn(new Column("c3", "", true, false));
         return result;
     }
+    
+    @Test
+    public void assertQuoteKeyword() {
+        String tableName = "CASCADE";
+        String actualCountSql = sqlBuilder.buildCountSQL(null, tableName);
+        assertThat(actualCountSql, is(String.format("SELECT COUNT(*) FROM %s", sqlBuilder.quote(tableName))));
+        actualCountSql = sqlBuilder.buildCountSQL(null, tableName.toLowerCase());
+        assertThat(actualCountSql, is(String.format("SELECT COUNT(*) FROM %s", sqlBuilder.quote(tableName.toLowerCase()))));
+    }
+    
+    @Test
+    public void assertQuoteNormal() {

Review Comment:
   1, Method name `assertQuoteNormal` could be improved, there's no `quoted` in SQL.
   
   2, Could we simplify `expectedDropSQL`, `String.format` is not necessary.
   
   And also in other implementations.
   



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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