Reorder and categorize query attributes for easy reference

This commit is contained in:
Kijin Sung 2020-06-27 01:25:05 +09:00
parent a1b946bae6
commit dcbd26e7f2
2 changed files with 19 additions and 8 deletions

View file

@ -7,14 +7,11 @@ namespace Rhymix\Framework\Parsers\DBQuery;
*/
class Query extends VariableBase
{
/**
* Attributes common to all queries.
*/
public $name;
public $alias;
public $type;
public $operation;
public $column;
public $pipe;
public $join_type;
public $join_conditions = array();
public $tables = array();
public $columns = array();
public $conditions = array();
@ -24,7 +21,21 @@ class Query extends VariableBase
public $update_duplicate = false;
/**
* Attributes for query generation.
* Attributes for subqueries in the <tables> or <columns> section.
*/
public $alias;
public $join_type;
public $join_conditions = array();
/**
* Attributes for subqueries in the <conditions> section.
*/
public $operation;
public $column;
public $pipe;
/**
* Attributes used during query string generation.
*/
protected $_prefix = '';
protected $_args = array();

View file

@ -40,12 +40,12 @@ class DBQueryParser
// Load basic information about this query.
$query = new DBQuery\Query;
$query->name = $name ?: null;
$query->type = strtoupper($xml['action']) ?: 'SELECT';
$query->alias = trim($xml['alias']) ?: null;
if ($query->alias && !$query->name)
{
$query->name = $query->alias;
}
$query->type = strtoupper($xml['action']) ?: 'SELECT';
// Load attributes that only apply to subqueries in the <conditions> block.
$query->operation = trim($xml['operation']) ?: null;