@@ -79,37 +79,37 @@ |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | private function buildLimitQuery($limit, $offset, $query = []){ |
| 82 | - $limitQuery = []; |
|
| 83 | - if (!empty($limit)) { |
|
| 84 | - $query[] = 'LIMIT'; |
|
| 82 | + $limitQuery = []; |
|
| 83 | + if (!empty($limit)) { |
|
| 84 | + $query[] = 'LIMIT'; |
|
| 85 | 85 | |
| 86 | - if (!empty($offset)) { |
|
| 87 | - $query[] = $offset.','; |
|
| 88 | - } |
|
| 86 | + if (!empty($offset)) { |
|
| 87 | + $query[] = $offset.','; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - $query[] = $limit; |
|
| 91 | - } |
|
| 90 | + $query[] = $limit; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - if (count($limitQuery)) { |
|
| 94 | - $query = array_merge($query, $limitQuery); |
|
| 95 | - } |
|
| 96 | - return $query; |
|
| 93 | + if (count($limitQuery)) { |
|
| 94 | + $query = array_merge($query, $limitQuery); |
|
| 95 | + } |
|
| 96 | + return $query; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function query($query, $fetchRows){ |
| 100 | - try { |
|
| 101 | - $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
|
| 102 | - |
|
| 103 | - if ($fetchRows == 'count') { |
|
| 104 | - $obj = $obj->fetchColumn(); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - return $obj; |
|
| 108 | - } catch (\PDOException $ex) { |
|
| 109 | - throw new \PDOException($ex->getMessage(), 1); |
|
| 110 | - } catch (Exception $e) { |
|
| 111 | - throw new Exception($e->getMessage(), 1); |
|
| 112 | - } |
|
| 100 | + try { |
|
| 101 | + $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
|
| 102 | + |
|
| 103 | + if ($fetchRows == 'count') { |
|
| 104 | + $obj = $obj->fetchColumn(); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + return $obj; |
|
| 108 | + } catch (\PDOException $ex) { |
|
| 109 | + throw new \PDOException($ex->getMessage(), 1); |
|
| 110 | + } catch (Exception $e) { |
|
| 111 | + throw new Exception($e->getMessage(), 1); |
|
| 112 | + } |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function buildQuery(array $params) |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | return "'".$field."'"; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function getQueryFields($fields, $tbl){ |
|
| 72 | + private function getQueryFields($fields, $tbl) { |
|
| 73 | 73 | $startQuery = join(', ', $fields); |
| 74 | 74 | if (empty($fields)) { |
| 75 | 75 | $startQuery = $this->quote($tbl).'.*'; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return $startQuery; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - private function buildLimitQuery($limit, $offset, $query = []){ |
|
| 81 | + private function buildLimitQuery($limit, $offset, $query = []) { |
|
| 82 | 82 | $limitQuery = []; |
| 83 | 83 | if (!empty($limit)) { |
| 84 | 84 | $query[] = 'LIMIT'; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $query; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function query($query, $fetchRows){ |
|
| 99 | + public function query($query, $fetchRows) { |
|
| 100 | 100 | try { |
| 101 | 101 | $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
| 102 | 102 | |