This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b810249  #6604, support parse hex value (#6806)
b810249 is described below

commit b810249de062a8273409968df73840f3627f1736
Author: Zhang Yonglun <[email protected]>
AuthorDate: Wed Aug 12 19:24:45 2020 +0800

    #6604, support parse hex value (#6806)
---
 .../src/main/antlr4/imports/mysql/Literals.g4               |  2 +-
 .../src/test/resources/case/dml/insert.xml                  | 13 +++++++++++++
 .../src/test/resources/sql/supported/dml/insert.xml         |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Literals.g4
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Literals.g4
index 40f3773..0fcffab 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Literals.g4
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Literals.g4
@@ -35,7 +35,7 @@ NUMBER_
     ;
 
 HEX_DIGIT_
-    : '0x' HEX_+ | 'X' SQ_ HEX_+ SQ_
+    : '0x' HEX_+ | X SQ_ HEX_+ SQ_
     ;
 
 BIT_NUM_
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case/dml/insert.xml
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case/dml/insert.xml
index d4562d2..4fbb00c 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case/dml/insert.xml
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case/dml/insert.xml
@@ -1285,4 +1285,17 @@
         </values>
     </insert>
     
+    <insert sql-case-id="insert_with_digit_literals_value">
+        <table name="digit_literals_value_test" start-index="12" 
stop-index="36" />
+        <columns start-index="37" stop-index="42">
+            <column name="col1" start-index="38" stop-index="41" />
+        </columns>
+        <values>
+            <value>
+                <assignment-value>
+                    <literal-expression value="x'1234'" />
+                </assignment-value>
+            </value>
+        </values>
+    </insert>
 </sql-parser-test-cases>
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported/dml/insert.xml
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported/dml/insert.xml
index 747e379..3f73801 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported/dml/insert.xml
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported/dml/insert.xml
@@ -62,4 +62,5 @@
     <sql-case id="insert_select_without_generate_key_column" value="INSERT 
INTO t_order_item(order_id, user_id, status, creation_date) SELECT order_id, 
user_id, 'insert', '2017-08-08' FROM t_order_item WHERE order_id = ?" 
db-types="MySQL" />
     <sql-case id="insert_select_on_duplicate_key_update" value="INSERT INTO 
t_order(order_id, user_id, status) SELECT order_id, user_id, status FROM 
t_order WHERE order_id = ? ON DUPLICATE KEY UPDATE status = VALUES(status)" 
db-types="MySQL" />
     <sql-case id="insert_with_emoji_value" value="INSERT INTO 
t_emoji_test(col1) VALUES('test😀')" db-types="MySQL" />
+    <sql-case id="insert_with_digit_literals_value" value="INSERT INTO 
digit_literals_value_test(col1) VALUES(x'1234')" db-types="MySQL" />
 </sql-cases>

Reply via email to