finish migration class
This commit is contained in:
		
							
								
								
									
										10
									
								
								Query.php
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Query.php
									
									
									
									
									
								
							@@ -75,26 +75,26 @@ class Query
 | 
			
		||||
        // Build the SELECT clause.
 | 
			
		||||
        $columns = implode(", ", $selectColumns);
 | 
			
		||||
        $primaryTable = $this->schema->name;
 | 
			
		||||
        $sqlStatement = "SELECT $columns FROM $primaryTable";
 | 
			
		||||
        $query = "SELECT $columns FROM $primaryTable";
 | 
			
		||||
 | 
			
		||||
        // Append join clauses, if any.
 | 
			
		||||
        if ($this->isJoined())
 | 
			
		||||
            foreach ($this->joins as $join)
 | 
			
		||||
                $sqlStatement .= " " . $join['type']->toString() . " NATURAL JOIN " . $join['table'];
 | 
			
		||||
                $query .= " " . $join['type']->toString() . " NATURAL JOIN " . $join['table'];
 | 
			
		||||
 | 
			
		||||
        // Append the WHERE clause if conditions exist.
 | 
			
		||||
        if ($this->isConditioned()) {
 | 
			
		||||
            $whereClause = $this->combineConditions();
 | 
			
		||||
            $sqlStatement .= " WHERE $whereClause";
 | 
			
		||||
            $query .= " WHERE $whereClause";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Append the ORDER BY clause if ordering is set.
 | 
			
		||||
        if ($this->isOrdered()) {
 | 
			
		||||
            $orderClause = $this->orderBy['name'] . ' ' . $this->orderBy['order'];
 | 
			
		||||
            $sqlStatement .= " ORDER BY $orderClause";
 | 
			
		||||
            $query .= " ORDER BY $orderClause";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return esc_sql($sqlStatement);
 | 
			
		||||
        return $query;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function aggregate(string $col, string $alias, Aggregation $func): Query {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user