|
@@ 68-81 (lines=14) @@
|
| 65 |
|
* @param mixed $return External variable to store query results |
| 66 |
|
* @return mixed If no arguments passed returns query results collection, otherwise query success status |
| 67 |
|
*/ |
| 68 |
|
public function exec(&$return = null) |
| 69 |
|
{ |
| 70 |
|
// Call handlers stack |
| 71 |
|
$this->_callHandlers(); |
| 72 |
|
|
| 73 |
|
/** @var RecordInterface[] Perform DB request */ |
| 74 |
|
$return = $this->database->find($this->class_name, $this); |
| 75 |
|
|
| 76 |
|
// Clear this query |
| 77 |
|
$this->flush(); |
| 78 |
|
|
| 79 |
|
// Return bool or collection |
| 80 |
|
return func_num_args() ? sizeof($return) : $return; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
/** |
| 84 |
|
* Perform database request and get first record from results collection |
|
@@ 90-103 (lines=14) @@
|
| 87 |
|
* @return mixed If no arguments passed returns query results first database record object, |
| 88 |
|
* otherwise query success status |
| 89 |
|
*/ |
| 90 |
|
public function first(& $return = null) |
| 91 |
|
{ |
| 92 |
|
// Call handlers stack |
| 93 |
|
$this->_callHandlers(); |
| 94 |
|
|
| 95 |
|
/** @var RecordInterface[] Perform DB request */ |
| 96 |
|
$return = array_shift($this->database->find($this->class_name, $this)); |
| 97 |
|
|
| 98 |
|
// Clear this query |
| 99 |
|
$this->flush(); |
| 100 |
|
|
| 101 |
|
// Return bool or collection |
| 102 |
|
return func_num_args() ? sizeof($return) : $return; |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
/** |
| 106 |
|
* Perform database request and get array of record field values |
|
@@ 112-122 (lines=11) @@
|
| 109 |
|
* @param string $return External variable to store query results |
| 110 |
|
* @return Ambigous <boolean, NULL, mixed> |
| 111 |
|
*/ |
| 112 |
|
public function fields($fieldName, &$return = null) |
| 113 |
|
{ |
| 114 |
|
// Call handlers stack |
| 115 |
|
$this->_callHandlers(); |
| 116 |
|
|
| 117 |
|
// Perform DB request |
| 118 |
|
$return = $this->database->fetchColumn($this->class_name, $this, $fieldName); |
| 119 |
|
|
| 120 |
|
// Return bool or collection |
| 121 |
|
return func_num_args() > 1 ? sizeof($return) : $return; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
/** |
| 125 |
|
* Set query entity to work with. |