mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Support SELECT DISTINCT queries
This commit is contained in:
parent
e3138f7278
commit
a086c93935
2 changed files with 12 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ class Query extends VariableBase
|
|||
public $conditions = array();
|
||||
public $groupby = null;
|
||||
public $navigation = null;
|
||||
public $select_distinct = false;
|
||||
|
||||
/**
|
||||
* Attributes for query generation.
|
||||
|
|
@ -92,6 +93,10 @@ class Query extends VariableBase
|
|||
{
|
||||
// Initialize the query string.
|
||||
$result = 'SELECT ';
|
||||
if ($this->select_distinct)
|
||||
{
|
||||
$result .= 'DISTINCT ';
|
||||
}
|
||||
|
||||
// Compose the column list.
|
||||
$columns = array();
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@ class DBQueryParser
|
|||
}
|
||||
|
||||
// Load columns.
|
||||
if ($xml->columns && $select_distinct = trim($xml->columns['distinct']))
|
||||
{
|
||||
if ($select_distinct === 'distinct' || toBool($select_distinct))
|
||||
{
|
||||
$query->select_distinct = true;
|
||||
}
|
||||
}
|
||||
foreach ($xml->columns->column as $tag)
|
||||
{
|
||||
if ($tag->getName() === 'query')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue