mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Remove uses of deprecated extendedSQL()
This commit is contained in:
parent
5ed14915bb
commit
a5a94b520f
@ -834,11 +834,12 @@ class MySQLDatabase extends SS_Database {
|
||||
$match['SiteTree'] = $match['File'] = "1 = 1";
|
||||
}
|
||||
|
||||
// Generate initial queries and base table names
|
||||
// Generate initial DataLists and base table names
|
||||
$lists = array();
|
||||
$baseClasses = array('SiteTree' => '', 'File' => '');
|
||||
foreach($classesToSearch as $class) {
|
||||
$queries[$class] = singleton($class)->extendedSQL($notMatch . $match[$class] . $extraFilters[$class], "");
|
||||
$baseClasses[$class] = reset($queries[$class]->from);
|
||||
$lists[$class] = DataList::create($class)->where($notMatch . $match[$class] . $extraFilters[$class], "");
|
||||
$baseClasses[$class] = '"'.$class.'"';
|
||||
}
|
||||
|
||||
// Make column selection lists
|
||||
@ -847,18 +848,17 @@ class MySQLDatabase extends SS_Database {
|
||||
'File' => array("ClassName","$baseClasses[File].ID","_utf8'' AS ParentID","Title","_utf8'' AS MenuTitle","_utf8'' AS URLSegment","Content","LastEdited","Created","Filename","Name","$relevance[File] AS Relevance","NULL AS CanViewType"),
|
||||
);
|
||||
|
||||
// Process queries
|
||||
foreach($classesToSearch as $class) {
|
||||
// There's no need to do all that joining
|
||||
$queries[$class]->from = array(str_replace('`','',$baseClasses[$class]) => $baseClasses[$class]);
|
||||
$queries[$class]->select = $select[$class];
|
||||
$queries[$class]->orderby = null;
|
||||
}
|
||||
|
||||
// Combine queries
|
||||
// Process and combine queries
|
||||
$querySQLs = array();
|
||||
$totalCount = 0;
|
||||
foreach($queries as $query) {
|
||||
foreach($lists as $class => $list) {
|
||||
$query = $list->dataQuery()->query();
|
||||
|
||||
// There's no need to do all that joining
|
||||
$query->from = array(str_replace(array('"','`'),'',$baseClasses[$class]) => $baseClasses[$class]);
|
||||
$query->select = $select[$class];
|
||||
$query->orderby = null;
|
||||
|
||||
$querySQLs[] = $query->sql();
|
||||
$totalCount += $query->unlimitedRowCount();
|
||||
}
|
||||
|
@ -683,8 +683,11 @@ class Versioned extends DataExtension {
|
||||
// Make sure the table names are not postfixed (e.g. _Live)
|
||||
$oldMode = self::get_reading_mode();
|
||||
self::reading_stage('Stage');
|
||||
|
||||
$query = $this->owner->extendedSQL($filter, $sort, $limit, $join, $having);
|
||||
|
||||
$list = DataObject::get(get_class($this->owner), $filter, $sort, $limit, $join);
|
||||
if($having) $having = $list->having($having);
|
||||
|
||||
$query = $list->dataQuery()->query();
|
||||
|
||||
foreach($query->from as $table => $tableJoin) {
|
||||
if(is_string($tableJoin) && $tableJoin[0] == '"') {
|
||||
|
@ -257,10 +257,7 @@ class Group extends DataObject {
|
||||
|
||||
// Get the children of *all* the groups identified in the previous chunk.
|
||||
// This minimises the number of SQL queries necessary
|
||||
$sql = $this->extendedSQL("\"ParentID\" IN ($idList)", "");
|
||||
$dbResult = $sql->execute();
|
||||
$chunkToAdd = array();
|
||||
foreach($dbResult as $item) $chunkToAdd[] = $item;
|
||||
$chunkToAdd = DataList::create('Group')->where("\"ParentID\" IN ($idList)")->column('ID');
|
||||
}
|
||||
|
||||
return $familyIDs;
|
||||
|
Loading…
Reference in New Issue
Block a user