You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add MSSQL engine for parse and analyze via teesql (#4571)
* Add MSSQL engine for parse and analyze via teesql
Add a new mssql engine backed by github.com/sqlc-dev/teesql, a T-SQL
parser producing a SqlScriptDOM-compatible AST. The engine converts
teesql's AST into sqlc's internal AST and analyzes queries through the
analysis core, seeded with SQL Server's type system.
- internal/engine/mssql: parser, AST converter, reserved keywords and
dialect seed (types, functions, operator rules)
- Wire the engine into the compiler's core-analysis path and the parse
and analyze commands as the mssql (alias sqlserver) dialect
- Named @parameters share a number across repeated uses; OUTPUT clauses
map to returning lists with INSERTED/DELETED qualifiers stripped; the
dbo schema maps to the catalog's default namespace
- End-to-end coverage under parse_basic, analyze_basic and
analyze_params
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FrnQ4EoZ3WCWWrSsm8bhCP
* mssql: fix DML alias targets, byte offsets, dead keyword
Address review findings on the initial engine:
- DELETE dropped its FROM clause, so the T-SQL join form
(DELETE b FROM books b JOIN ...) failed to resolve. UPDATE and DELETE
now resolve an alias target against the FROM clause: the matching
relation becomes the statement's target, and the ON conditions of any
inner join dissolved by pulling it out move to the WHERE clause.
Relations under outer joins are left alone.
- AST Location fields carried teesql's UTF-16 code-unit offsets while
StmtLocation/StmtLen are byte offsets; the converter now maps
locations through the same byte-offset table as statement spans.
- Drop the unreachable "within group" reserved-keyword case: keywords
are checked one identifier token at a time.
- Cover INSERT ... OUTPUT and the UPDATE/DELETE alias forms end to end
under analyze_dml/mssql.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FrnQ4EoZ3WCWWrSsm8bhCP
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments