Definition at line 39 of file indexed_query.inc.
◆ __construct()
IndexedQuery::__construct |
( |
|
$class, |
|
|
|
$constraints = "" , |
|
|
|
$indexBy = "" |
|
) |
| |
◆ create()
static IndexedQuery::create |
( |
|
$class, |
|
|
|
$constraints = "" , |
|
|
|
$indexBy = "" |
|
) |
| |
|
static |
◆ execute()
IndexedQuery::execute |
( |
| ) |
|
Reimplemented from AbstractQuery.
Definition at line 55 of file indexed_query.inc.
66 $order_by_idx = strpos(strtoupper($this->
constraints),
"ORDER BY");
67 if ($order_by_idx !==
false)
69 $orderBy = substr($this->
constraints, $order_by_idx);
74 $fields = $prototype->getFieldList();
77 $query =
"SELECT $fields FROM {$prototype->table} {$this->constraints} ".$prototype->getIdentityConstraint().
" $orderBy";
78 trace(
"DataItem indexedQuery(): $query", 3);
84 $useFormat = preg_match(
"/^[A-Za-z0-9_]*$/", $field) ? false :
true;
90 $result = $db->prepare($query);
91 $result->execute($this->
params);
93 while($line = $result->fetch())
96 $item->populate($line);
98 $val = ($useFormat) ? $item->format($field) : $item->get($field);
100 if (array_key_exists($val, $items))
103 if (!is_array($items[$val]))
105 $items[$val] = array($items[$val]);
107 $items[$val][] = $item;
111 $items[$val] = $item;
117 catch(PDOException $e)
119 $err =
"indexedQuery() failed - " . $e->getMessage();
constraints($constraints)
Sets the constraint clause for the Query.
filter($filter)
Sets a filter to constrain the fields retrieved when the query is executed.
params($params)
Sets the bound parameters array.
static getConnection()
Retrieves a reference to the global database connection.
trace($msg, $lvl=3, $callStack=null)
Send output to the trace log.
◆ indexBy()
IndexedQuery::indexBy |
( |
|
$indexBy | ) |
|
◆ $indexBy
The documentation for this class was generated from the following file: