|
@@ 81-94 (lines=14) @@
|
| 78 |
|
* @param mixed $return External variable to store query results |
| 79 |
|
* @return mixed If no arguments passed returns query results collection, otherwise query success status |
| 80 |
|
*/ |
| 81 |
|
public function exec(&$return = null) |
| 82 |
|
{ |
| 83 |
|
// Call handlers stack |
| 84 |
|
$this->_callHandlers(); |
| 85 |
|
|
| 86 |
|
/** @var RecordInterface[] Perform DB request */ |
| 87 |
|
$return = $this->database->find($this->class_name, $this); |
| 88 |
|
|
| 89 |
|
// Clear this query |
| 90 |
|
$this->flush(); |
| 91 |
|
|
| 92 |
|
// Return bool or collection |
| 93 |
|
return func_num_args() ? sizeof($return) : $return; |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
/** |
| 97 |
|
* Perform database request and get first record from results collection |
|
@@ 103-116 (lines=14) @@
|
| 100 |
|
* @return mixed If no arguments passed returns query results first database record object, |
| 101 |
|
* otherwise query success status |
| 102 |
|
*/ |
| 103 |
|
public function first(& $return = null) |
| 104 |
|
{ |
| 105 |
|
// Call handlers stack |
| 106 |
|
$this->_callHandlers(); |
| 107 |
|
|
| 108 |
|
/** @var RecordInterface[] Perform DB request */ |
| 109 |
|
$return = array_shift($this->database->find($this->class_name, $this)); |
| 110 |
|
|
| 111 |
|
// Clear this query |
| 112 |
|
$this->flush(); |
| 113 |
|
|
| 114 |
|
// Return bool or collection |
| 115 |
|
return func_num_args() ? sizeof($return) : $return; |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
/** |
| 119 |
|
* Perform database request and get array of record field values |
|
@@ 125-135 (lines=11) @@
|
| 122 |
|
* @param string $return External variable to store query results |
| 123 |
|
* @return Ambigous <boolean, NULL, mixed> |
| 124 |
|
*/ |
| 125 |
|
public function fields($fieldName, &$return = null) |
| 126 |
|
{ |
| 127 |
|
// Call handlers stack |
| 128 |
|
$this->_callHandlers(); |
| 129 |
|
|
| 130 |
|
// Perform DB request |
| 131 |
|
$return = $this->database->fetchColumn($this->class_name, $this, $fieldName); |
| 132 |
|
|
| 133 |
|
// Return bool or collection |
| 134 |
|
return func_num_args() > 1 ? sizeof($return) : $return; |
| 135 |
|
} |
| 136 |
|
|
| 137 |
|
/** |
| 138 |
|
* Set query entity to work with. |