mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
eaadd40c3b
@ -479,7 +479,7 @@ class DataQuery
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrap the whole thing in an "EXISTS"
|
// 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);
|
$result = DB::prepared_query($sql, $params);
|
||||||
$row = $result->first();
|
$row = $result->first();
|
||||||
$result = reset($row);
|
$result = reset($row);
|
||||||
|
Loading…
Reference in New Issue
Block a user