Skip to content

Conversation

@yuguoqiang
Copy link

@yuguoqiang yuguoqiang commented Jul 11, 2025

PR Type

Bug fix


Description

  • Add support for 'mssql' database type identifier

  • Update switch statements to handle both 'sqlserver' and 'mssql'

  • Fix database type compatibility across SQL driver functions


Changes diagram

flowchart LR
  A["Database Type Detection"] --> B["Switch Statement"]
  B --> C["'sqlserver' or 'mssql'"]
  C --> D["SQL Server Operations"]
Loading

Changes walkthrough 📝

Relevant files
Bug fix
ExecuteQueryFn.cs
Add mssql support to query execution                                         

src/Plugins/BotSharp.Plugin.SqlDriver/Functions/ExecuteQueryFn.cs

  • Updated switch case to accept both 'sqlserver' and 'mssql' identifiers
  • Routes both database types to RunQueryInSqlServer method
  • +1/-1     
    GetTableDefinitionFn.cs
    Support mssql in table definition retrieval                           

    src/Plugins/BotSharp.Plugin.SqlDriver/Functions/GetTableDefinitionFn.cs

  • Modified switch statement to handle 'mssql' alongside 'sqlserver'
  • Both types now use GetDdlFromSqlServer method
  • +1/-1     
    SqlSelect.cs
    Enable mssql support in SQL select                                             

    src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlSelect.cs

  • Added 'mssql' as alternative to 'sqlserver' in switch case
  • Routes to RunQueryInSqlServer for both database types
  • +1/-1     
    SqlValidateFn.cs
    Add mssql validation support                                                         

    src/Plugins/BotSharp.Plugin.SqlDriver/Functions/SqlValidateFn.cs

  • Updated validation logic to accept 'mssql' database type
  • Uses same SQL Server validation syntax for both types
  • +1/-1     
    GetTableDefinitionFn.cs
    Support mssql in utility table definition                               

    src/Plugins/BotSharp.Plugin.SqlDriver/UtilFunctions/GetTableDefinitionFn.cs

  • Modified switch to handle 'mssql' alongside 'sqlserver'
  • Both types use GetDdlFromSqlServer utility method
  • +1/-1     
    SqlSelect.cs
    Enable mssql in utility SQL select                                             

    src/Plugins/BotSharp.Plugin.SqlDriver/UtilFunctions/SqlSelect.cs

  • Added 'mssql' as valid database type in switch statement
  • Routes to RunQueryInSqlServer for both database identifiers
  • +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @qodo-merge-pro
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Case Sensitivity

    The switch statement at line 37 doesn't use ToLower() on dbType like other files, which could cause case sensitivity issues when comparing database type strings.

    var tableDdls = dbType switch
    {
        "mysql" => GetDdlFromMySql(tables),
        "sqlserver" or "mssql" => GetDdlFromSqlServer(tables),
        "redshift" => GetDdlFromRedshift(tables),
        _ => throw new NotImplementedException($"Database type {dbType} is not supported.")
    };
    Case Sensitivity

    Similar to the Functions version, this switch statement doesn't normalize the case of dbType before comparison, potentially causing mismatches.

    var tableDdls = dbType switch
    {
        "mysql" => GetDdlFromMySql(tables),
        "sqlserver" or "mssql" => GetDdlFromSqlServer(tables),
        "redshift" => GetDdlFromRedshift(tables,schema),
        _ => throw new NotImplementedException($"Database type {dbType} is not supported.")
    };

    @qodo-merge-pro
    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @Oceania2018 Oceania2018 merged commit 21e92f4 into SciSharp:master Jul 11, 2025
    4 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants