Merge pull request #9845 from HARVS1789UK/dataquery-exists-sql-portability-fix

Bug Fix - Ensure DataQuery::exists() SQL is both valid MySQL and T-SQL
This commit is contained in:
Guy Marriott 2021-02-10 10:21:42 -08:00 committed by GitHub
commit eaadd40c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -479,7 +479,7 @@ class DataQuery
}
// 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);