Skip to content

Commit

Permalink
Added support for functions (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsonjohn authored Nov 29, 2024
1 parent fb90833 commit afb2fe5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities

## [5.4.2] - 2024.11.28

### Added

- Added support for MySQL functions in query builder conditions.

## [5.4.1] - 2024.11.26

### Added
Expand Down
12 changes: 11 additions & 1 deletion src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,17 @@ private function parseConditionColumn(string $column): string
{

if (!str_contains($column, '.') && $this->table !== '') { // Support for joins
$column = $this->table . '.' . $column;

$exp = explode('(', $column, 2); // Support for functions

if (isset($exp[1])) {
$column = $exp[0] . '(' . $this->table . '.' . $exp[1];
} else {
$column = $this->table . '.' . $column;
}

return $column;

}

if (str_contains($column, '->')) { // JSON
Expand Down

0 comments on commit afb2fe5

Please sign in to comment.