Skip to content

Latest commit

 

History

History
114 lines (91 loc) · 5.16 KB

File metadata and controls

114 lines (91 loc) · 5.16 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.2.3 - 2026-03-18

Added

  • BuilderRaw __toString() method: BuilderRaw objects can now be cast to string automatically
    • Enables use in implode(), string concatenation, and other string contexts
    • Returns the raw SQL expression value

1.0.2.2 - 2026-02-19

Added

  • Alias parameter in table() method: The table() static method now accepts an optional second parameter for table alias
    • Syntax: Builder::table('users', 'u') sets table alias in one call
    • Simplifies initialization when table alias is known upfront
    • Alternative to chaining ->alias() method

Changed

  • Builder::table() method signature updated from table(string $table) to table(string $table, string $alias = '')

1.0.2.1 - 2026-02-05

Added

  • IS NULL and IS NOT NULL operator support: Use ['column' => ['IS', null]] and ['column' => ['IS NOT', null]] in WHERE conditions
    • No parameter binding for NULL checks (correct SQL syntax)
    • Works with both where() and orWhere() methods
  • Test coverage for IS NULL and IS NOT NULL operators (4 new tests)
  • Enhanced README documentation with IS NULL/IS NOT NULL examples

Fixed

  • IS NOT NULL operator now correctly generates column IS NOT NULL instead of column IS NOT ? with null parameter
  • Resolved issue where null values were incorrectly bound as parameters in IS/IS NOT operations

1.0.2 - 2026-02-04

Added

  • ON DUPLICATE KEY UPDATE support: Use onDuplicateKeyUpdate() method to handle duplicate key errors gracefully in INSERT queries (MySQL/MariaDB)
    • Basic value updates: ->onDuplicateKeyUpdate(['column' => 'value'])
    • Increment values: ->onDuplicateKeyUpdate(['points' => Builder::raw('points + 100')])
    • Use VALUES() function: ->onDuplicateKeyUpdate(['points' => Builder::raw('points + VALUES(points)')])
  • Test coverage for ON DUPLICATE KEY UPDATE functionality

Note: The following features were released in v1.0.1 but were initially marked as "Unreleased" and not included in the release notes above.

### Added
- Query builder reuse methods: clearWhere(), clearSelect(), clearJoin(), clearGroupBy(), clearOrderBy(), clearLimit(), clearAll()
- Comprehensive "Understanding build() Return Value" section in README
- Enhanced documentation with query result examples for all operators
- Tracy Debugger integration with custom panel
- QueryLogger and QueryPanel for development debugging

### Changed
- Updated all examples to use correct namespace (EasyQuery/Builder)
- Improved OR Conditions examples with multiple conditions
- Renamed test files from GenerateQuery* to Builder* to match class names
- Updated all documentation references from GenerateQuery to EasyQuery

1.0.1 - 2026-01-19

Added

  • NOT IN operator support: Use ['column' => ['NOT IN', [values]]] in where conditions
  • Raw SQL with bindings: Builder::raw('COALESCE(amount, ?)', [0]) for parameterized raw expressions
  • Safe identifier validation: Builder::safeIdentifier($userInput) validates column/table names
  • Safe raw expressions: Builder::rawSafe() for user-provided column names with SQL injection protection
  • BuilderRaw::withIdentifiers(): Create raw expressions with multiple safe identifier substitutions
  • New tests for NOT IN, raw bindings, and identifier validation (62 tests, 129 assertions)

Security

  • Added protection for user-provided column names in raw SQL expressions
  • Identifier validation only allows alphanumeric characters, underscores, and dots

1.0.0 - 2026-01-15

Added

  • Initial release with fluent API for SQL query building
  • Support for SELECT, INSERT, UPDATE, DELETE, COUNT queries
  • Automatic parameter binding for SQL injection protection
  • Raw SQL expression support via raw() method
  • WHERE conditions with operators (=, !=, <, >, <=, >=, LIKE)
  • IN and BETWEEN operator support
  • JOIN support (INNER, LEFT, RIGHT)
  • Table aliases
  • GROUP BY and ORDER BY clauses
  • LIMIT and OFFSET support
  • FlightPHP SimplePdo integration examples
  • Legacy PDO and MySQLi support examples
  • Comprehensive PHPUnit test suite (44 tests, 97 assertions)
  • PHPStan Level Max compliance
  • English documentation and examples

Features

  • Zero dependencies (4 core files: Builder, BuilderRaw, QueryLogger, QueryPanel)
  • PHP 7.4+ support
  • PSR-4 autoloading
  • Framework agnostic design
  • Database agnostic (works with any DB driver)