Skip to content

v1.2.0

Choose a tag to compare

@0x1000000 0x1000000 released this 01 Apr 00:35
· 49 commits to main since this release

1.2.0

Highlights

  • SQL → SqExpress pipeline

    • Parse raw T-SQL into SqExpress AST
    • Validate SQL at compile time via Roslyn analyzer
    • Convert SQL into strongly-typed SqExpress C# code
  • Parameterization for real db queries

    • Configurable strategies (None, ThrowOnLimit, LiteralFallback)
    • Built-in handling of database parameter limits
  • Advanced schema-aware tooling

    • Source-generated models from table descriptors ([TableDescriptor], [SqModel])
    • Derived-table descriptors with strict analyzer validation
    • Stronger compile-time guarantees for schema correctness
  • Query analysis & navigation

    • TablesGraph for foreign-key traversal and join-path discovery
    • Automatic shortest-path join resolution

New Features

  • Added non-generic syntax tree visitor support with IExprVisitor and ExprVisitorBase.
  • ExprVisitorBase now provides traversal context via CurrentPath, CurrentNode, and Depth.
  • Added selecting-source abstractions for extracting projected columns and materializing a source as a subquery:
    • ISelectingSource
    • IExprTableSource.Alias
    • ExtractSelecting()
    • ToSubQuery()
  • Added parametrization modes to SqDatabase:
    • None
    • ThrowOnLimit
    • LiteralFallback
  • Added exporter parameter limits used by parametrization:
    • TSqlExporter: 2000
    • PgSqlExporter: 65535
    • MySqlExporter: 65535
  • Added ExprPortableScalarFunction / PortableScalarFunction and portable helpers in SqQueryBuilder (T-SQL-first names):
    • Len, DataLength
    • Year, Month, Day, Hour, Minute, Second
    • CurrentDate, CurrentTime, CurrentTimestamp
    • IndexOf, Left, Right, Repeat
  • Added dialect mappings for portable scalar functions in TSqlBuilder, PgSqlBuilder, and MySqlBuilder.
  • Added an optional SQL-import workflow via SqTSqlParser.Parse(...), including:
    • support for T-SQL named parameters (@name) mapped to ExprParameter with WithParams(...) replacement helpers
    • mapping for common T-SQL functions (LEN, DATALENGTH, CHARINDEX, LEFT, RIGHT, REPLICATE, date-part/current date-time functions) to portable AST nodes for PostgreSQL/MySQL export
  • Added a built-in Roslyn analyzer and code fix for SqTSqlParser.Parse(...):
    • validates raw SQL during compilation
    • checks discovered SqExpress table descriptors
    • can convert supported SqTSqlParser.Parse(...) calls into generated SqExpress C# code
  • Added attribute-based SqModel source generation for table declarations:
    • class-level SqModel on [TableDescriptor] / [TempTableDescriptor]
    • column-level SqModels and SqModelCast
    • source-generated DTO models now default to record shape when generated from analyzer-driven table declarations
  • Added dedicated derived-table descriptor support:
    • [DerivedTableDescriptor]
    • Derived...Column attributes for derived-table output columns
    • analyzer validation preventing descriptor-family mixing and enforcing that Derived...Column is only used with derived-table descriptors
  • Added flags-based table comparison and inclusion helpers:
    • TableComparisonFlags for CompareWith(...)
    • TableIncludesFlags for Includes(...)
  • Added TablesGraph for foreign-key-graph navigation and join-path discovery:
    • Contains, References, GetReferences, GetAllReferences, GetReferencedBy, GetAllReferencedBy
    • TryToJoinTables(...) returning a joinable IExprTableSource
    • deterministic shortest-path selection when several join routes exist
  • Added column-shape extraction helpers used by the MERGE polyfill to infer projected column names and SQL types from subqueries and table sources.
  • Added TypedColumn as a shared typed-column abstraction for table and custom columns.

Bugfix

  • MySQL metadata now treats utf8mb3 and utf8mb4 columns as Unicode and exports Unicode columns as utf8mb4 while preserving explicit column length when possible. (#4)
  • MERGE polyfill now supports more source shapes, including derived SELECT sources, and preserves richer inferred temp-table column types where possible.
  • Typed custom-column conversion now preserves more SQL type details such as string length/fixed-size/XML, decimal precision-scale, byte-array size, and date/date-time distinctions.

Breaking Changes

  • Some public syntax/source interfaces gained new members, including selecting-source and alias-related APIs, so custom implementations may need to be updated.
  • IQuerySpecificationBuilderFiltered.GroupBy(...) now accepts ExprValue / IReadOnlyList<ExprValue> instead of ExprColumn / IReadOnlyList<ExprColumn>.
  • ExprOffsetFetch.Offset and ExprOffsetFetch.Fetch are now ExprValue instead of ExprInt32Literal. In most existing code, the workaround is to cast explicitly to ExprInt32Literal.
  • ExprLike.Test and ExprLike.Pattern are now ExprValue instead of ExprStringLiteral. In most existing code, the workaround is to cast explicitly to ExprStringLiteral.
  • SqModelGenType now defaults to Record in SqExpress.props. ImmutableClass is still supported for backward compatibility.
  • The legacy file-based model builder (genmodels / property-level [SqModel]) is now deprecated and is planned for removal in 2.0.