You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "TherChenYang (via GitHub)" <gi...@apache.org> on 2024/01/23 09:32:01 UTC

[PR] Support parsing SQL Server default schema [shardingsphere]

TherChenYang opened a new pull request, #29814:
URL: https://github.com/apache/shardingsphere/pull/29814

   Fixes #29173.
   
   Changes proposed in this pull request:
     - suport parsing SQL Server sql with default schema [offical link](https://learn.microsoft.com/zh-cn/sql/t-sql/queries/from-transact-sql?view=sql-server-ver16)
   <img width="701" alt="image" src="https://github.com/apache/shardingsphere/assets/124348939/156523ad-1ca6-4ecc-a5c1-816408236fcb">
   
   > sql case 
   ```sql
   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
   ```
   
   ```sql
   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
   ```
   
   ```sql
   SELECT has_backup_checksums, database_name, *
   FROM msdb..backupset
   ```
   
   ```sql
   SELECT FileName = df.name,
      current_file_size_MB = df.size*1.0/128,
      max_size = CASE df.max_size
        WHEN 0 THEN 'Autogrowth is off.'
        WHEN -1 THEN 'Autogrowth is on.'
        ELSE 'Log file grows to a maximum size of 2 TB.'
      END,
      growth_value =
        CASE
          WHEN df.growth = 0 THEN df.growth
          WHEN df.growth > 0 AND df.is_percent_growth = 0 THEN df.growth*1.0/128.0
          WHEN df.growth > 0 AND df.is_percent_growth = 1 THEN df.growth
        END,
      growth_increment_unit =
        CASE
          WHEN df.growth = 0 THEN 'Size is fixed.'
          WHEN df.growth > 0 AND df.is_percent_growth = 0  THEN 'Growth value is MB.'
          WHEN df.growth > 0 AND df.is_percent_growth = 1  THEN 'Growth value is a percentage.'
        END
   FROM tempdb.sys.database_files AS df
   ```
   
   ```sql
   SELECT plan_handle, st.text
   FROM sys.dm_exec_cached_plans
   CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st
   WHERE text LIKE N'SELECT * FROM Person.Address%'
   ```
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


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


Re: [PR] Support parsing SQL Server default schema [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #29814:
URL: https://github.com/apache/shardingsphere/pull/29814


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