Skip to content

Releases: rkrx/php-mysql-query-builder

Refined Query Builder Generics for RunnableSelect

26 Jan 09:47

Choose a tag to compare

This commit refines PHPDoc generics in the RunnableSelect interface to better align callback return types with the resulting collections and generators. Affected methods: fetchIndexedRows, fetchRows, fetchRowsLazy, and fetchRow.

Support for temporary tables and code modernization.

11 Jan 13:51

Choose a tag to compare

  • Temporary Tables: A new temporary() method allows materializing a SELECT statement immediately into a temporary database table, including schema definitions and engine options.
  • Lifecycle Management: The new RunnableTemporaryTable interface and its implementation provide methods to retrieve the table name and explicitly delete it using release().
  • Integration: The TableNameBuilder was updated to allow temporary table instances to be used directly within FROM or JOIN clauses.
  • Refactoring: Several switch statements were replaced with modern PHP match expressions, and code formatting was unified across the project with improved spacing and standardized lambda syntax.
  • Error Handling: The database exception interpretation was modernized, and QueryStatement now implements Stringable to facilitate easier debugging.

Documentation Expansion and Input Validation

07 Dec 14:30

Choose a tag to compare

This update expands the project documentation regarding insert operations and introduces stricter input validation for query building methods.

Documentation

  • Renamed INSTRUCTIONS.md to AGENTS.md.
  • Added comprehensive examples and usage guides for INSERT and UPSERT statements, including details on table aliases, mass inserts (INSERT INTO ... SELECT), field masking, and ON DUPLICATE KEY UPDATE strategies.

Source Code Changes

  • Limit and Offset Validation: Added strict validation to ensure values passed to LIMIT and OFFSET clauses are numeric. The builder now explicitly casts these values and throws an InvalidValueException if non-numeric values are provided.
  • Table Data Validation: Updated TableNameBuilder to validate that data used for table generation is either scalar or iterable, ensuring unsupported types raise an InvalidArgumentException.
  • Type Hinting: Improved the PHPDoc return type annotation for RunnableSelect::fetchKeyValue to array<array-key, mixed> to support better static analysis.

PHP 8.0 related improvements; added JsonTable-Class

30 Sep 18:04

Choose a tag to compare

0.5.0

Add JsonTable and related test

AliasReplacer: Also handle Table additions like `prefix#table FOR SYSTEM_TIME ALL`

27 Jun 08:16

Choose a tag to compare

Enhanced typing

25 May 17:07

Choose a tag to compare

0.4.4

Refactor type annotations for improved PHPStan compatibility

Enhanced typing

27 Mar 16:33

Choose a tag to compare

0.4.3.2

Enhanced typing

Enhanced typing

27 Mar 12:55

Choose a tag to compare

0.4.3.1

Updated typing

Enhanced typing

27 Mar 12:40

Choose a tag to compare

0.4.3

Enhanced typing

Fixed issues reported by phpstan

26 Mar 12:00

Choose a tag to compare

0.4.2

Fixed issues reported by phpstan