Skip to content

Commit

Permalink
Bug Fix - Ensure DataQuery::exists() SQL is both valid MySQL and T-SQL
Browse files Browse the repository at this point in the history
The original SQL statement is not valid T-SQL for use with SQL Server
  • Loading branch information
HARVS1789UK committed Feb 8, 2021
1 parent 2f5d976 commit 33365b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ORM/DataQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public function exists(): bool
}

// Wrap the whole thing in an "EXISTS"
$sql = 'SELECT EXISTS(' . $statement->sql($params) . ')';
$sql = 'SELECT CASE WHEN EXISTS(' . $statement->sql($params) . ') THEN 1 ELSE 0 END';
$result = DB::prepared_query($sql, $params);
$row = $result->first();
$result = reset($row);
Expand Down

0 comments on commit 33365b9

Please sign in to comment.