| Total Complexity | 8 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class MySQLQuery extends Query |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * The internal MySQL handle that points to the result set. |
||
| 13 | * Select queries will have mysqli_result as a value. |
||
| 14 | * Non-select queries will not |
||
| 15 | * |
||
| 16 | * @var mixed |
||
| 17 | */ |
||
| 18 | protected $handle; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Hook the result-set given into a Query class, suitable for use by SilverStripe. |
||
| 22 | * |
||
| 23 | * @param MySQLiConnector $database The database object that created this query. |
||
| 24 | * @param mixed $handle the internal mysql handle that is points to the resultset. |
||
| 25 | * Non-mysqli_result values could be given for non-select queries (e.g. true) |
||
| 26 | */ |
||
| 27 | public function __construct($database, $handle) |
||
| 30 | } |
||
| 31 | |||
| 32 | public function __destruct() |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getIterator() |
||
| 40 | { |
||
| 41 | if (is_object($this->handle)) { |
||
| 42 | while ($data = $this->handle->fetch_assoc()) { |
||
| 43 | yield $data; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | public function numRecords() |
||
| 55 | } |
||
| 56 | } |
||
| 57 |