Skip to content

v2.10.0

Choose a tag to compare

@tommyknocker tommyknocker released this 09 Nov 18:39
· 274 commits to master since this release

🎉 Release v2.10.0 - MSSQL Support & Architecture Improvements

We're excited to announce v2.10.0, a major release that adds full Microsoft SQL Server (MSSQL) support as the fifth database dialect, along with significant architecture improvements and example enhancements.

🚀 What's New

✨ MSSQL (Microsoft SQL Server) Support

PDOdb now supports 5 database dialects: SQLite, MySQL, MariaDB, PostgreSQL, and Microsoft SQL Server!

  • Complete MSSQL dialect implementation with comprehensive SQL Server-specific features
  • 732+ new tests across 28 test suites covering all MSSQL functionality
  • GitHub Actions CI integration with dedicated MSSQL testing job
  • All 64 examples now work perfectly on MSSQL (64/64 passing ✅)
  • Custom REGEXP support using PATINDEX for pattern matching
  • Cross-dialect compatibility - all helper functions work consistently across all five dialects

MSSQL-Specific Features

  • LATERAL JOIN → Automatic conversion to CROSS APPLY/OUTER APPLY
  • MERGE statements → Native UPSERT operations
  • Window functions → Full SQL Server window function support
  • JSON operations → Complete JSON support using SQL Server JSON functions
  • Type casting → Safe type conversion using TRY_CAST
  • String functions → Dialect-specific implementations (LEN vs LENGTH, CEILING vs CEIL)
  • Boolean typesBIT type with proper 0/1 handling
  • Identity columnsIDENTITY(1,1) support for auto-incrementing keys

🏗️ Architecture Improvements

Major Refactoring Following SOLID Principles

We've moved all dialect-specific logic from general classes into dialect implementations, following the Open/Closed Principle:

  • 20+ new DialectInterface methods for better abstraction:

    • formatLateralJoin(), needsColumnQualificationInUpdateSet()
    • executeExplainAnalyze(), getBooleanType(), getTimestampType()
    • isNoFieldsError(), appendLimitOffset()
    • formatGreatest(), formatLeast(), buildDropTableIfExistsSql()
    • And many more...
  • No more dialect checks in general classes - No more if ($driver === 'sqlsrv') scattered throughout the codebase

  • Better separation of concerns - Each dialect handles its own specific requirements

📚 Example Improvements

  • Refactored examples - Removed Db::raw() calls with dialect-specific SQL
  • Library helpers usage - Examples now use library helpers exclusively (Db::length(), Db::position(), Db::greatest(), etc.)
  • Schema Builder usage - Examples use Schema Builder for DDL operations where possible
  • Better educational value - Examples demonstrate proper library usage patterns

🐛 Bug Fixes

  • PostgreSQL - Fixed DROP TABLE CASCADE for foreign key constraints
  • MSSQL - Fixed type compatibility issues in GREATEST/LEAST functions
  • MSSQL - Proper boolean handling (TRUE/FALSE → 1/0 for BIT type)
  • MSSQL - Fixed string function conversions (LENGTH → LEN, SUBSTRING syntax)
  • MSSQL - Proper LIMIT/OFFSET syntax (OFFSET ... FETCH NEXT ... ROWS ONLY)
  • MSSQL - Proper error handling for "contains no fields" errors
  • All dialects - All examples now work correctly on all five dialects

📊 Statistics

  • Tests: 2052 tests, 7097 assertions (+732 tests, +2239 assertions from v2.9.3)
  • Examples: 320/320 passing (64 files × 5 dialects)
    • SQLite: 64/64 ✅
    • MySQL: 64/64 ✅
    • MariaDB: 64/64 ✅
    • PostgreSQL: 64/64 ✅
    • MSSQL: 64/64 ✅ (NEW!)

🔄 Migration Guide

No breaking changes! This release maintains 100% backward compatibility. All existing code continues to work without modifications.

🙏 Thank You

Thank you to everyone who contributed to this release! Your feedback and contributions make PDOdb better with every release.


Full Changelog: v2.9.3...v2.10.0