You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2024/01/25 00:22:52 UTC

(shardingsphere) branch master updated: Support parsing SQL Server INSERT INTO sql (#29842)

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

duanzhengqiang 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 696f4969a15 Support parsing SQL Server INSERT INTO sql  (#29842)
696f4969a15 is described below

commit 696f4969a1569a3a16e6c4632147f2019afe1be7
Author: K <45...@users.noreply.github.com>
AuthorDate: Thu Jan 25 01:22:44 2024 +0100

    Support parsing SQL Server INSERT INTO sql  (#29842)
    
    * create first insert test case
    
    * complete first insert test case
    
    * complete second insert test case
---
 .../parser/src/main/resources/case/dml/insert.xml  | 33 ++++++++++++++++++++++
 .../main/resources/sql/supported/dml/insert.xml    |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/test/it/parser/src/main/resources/case/dml/insert.xml b/test/it/parser/src/main/resources/case/dml/insert.xml
index a8e4800478d..5d7ba83eece 100644
--- a/test/it/parser/src/main/resources/case/dml/insert.xml
+++ b/test/it/parser/src/main/resources/case/dml/insert.xml
@@ -3380,4 +3380,37 @@
             </from>
         </select>
     </insert>
+
+    <insert sql-case-id="insert_into_table_get_date">
+        <table name="#Test" start-index="12" stop-index="16"/>
+        <columns start-index="17" stop-index="17"/>
+        <values>
+            <value>
+                <assignment-value>
+                    <literal-expression value="OC" start-index="26" stop-index="30"/>
+                </assignment-value>
+                <assignment-value>
+                    <literal-expression value="Ounces" start-index="33" stop-index="41"/>
+                </assignment-value>
+                <assignment-value>
+                    <function function-name="GETDATE" text="GETDATE()" start-index="44" stop-index="52" />
+                </assignment-value>
+            </value>
+        </values>
+    </insert>
+
+    <insert sql-case-id="insert_into_table_from_table">
+        <table name="#Test" start-index="12" stop-index="16"/>
+        <columns start-index="17" stop-index="17"/>
+        <select>
+            <projections start-index="25" stop-index="25">
+                <shorthand-projection start-index="25" stop-index="25"/>
+            </projections>
+            <from>
+                <simple-table name="UnitMeasure" start-index="32" stop-index="53">
+                    <owner name="Production" start-index="32" stop-index="41"/>
+                </simple-table>
+            </from>
+        </select>
+    </insert>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/insert.xml b/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
index 44b8e240e62..62eea73a42e 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
@@ -123,4 +123,6 @@
     <sql-case id="insert_with_currency_value" value="INSERT INTO [HR].[Employees]([SSN], [FirstName], [LastName], [Salary]) VALUES ('795-73-9838', N'Catherine', N'Abel', $31692)" db-types="SQLServer"/>
     <sql-case id="insert_with_select_from_open_row_1" value="INSERT INTO myTable(FileName, FileType, Document) SELECT 'Text1.txt' AS FileName, '.txt' AS FileType, * FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document" db-types="SQLServer"/>
     <sql-case id="insert_with_select_from_open_row_2" value="INSERT INTO achievements with (TABLOCK) (id, description) SELECT * FROM OPENROWSET(BULK 'csv/achievements.csv', DATA_SOURCE = 'MyAzureBlobStorage', FORMAT ='CSV', FORMATFILE='csv/achievements-c.xml', FORMATFILE_DATA_SOURCE = 'MyAzureBlobStorage') AS DataFile" db-types="SQLServer"/>
+    <sql-case id="insert_into_table_get_date" value="INSERT INTO #Test VALUES (N'OC', N'Ounces', GETDATE())" db-types="SQLServer"/>
+    <sql-case id="insert_into_table_from_table" value="INSERT INTO #Test SELECT * FROM Production.UnitMeasure" db-types="SQLServer"/>
 </sql-cases>