@@ -78,37 +78,37 @@ |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | private function buildLimitQuery($limit, $offset, $query = array()){ |
81 | - $limitQuery = []; |
|
82 | - if (!empty($limit)) { |
|
83 | - $query[] = 'LIMIT'; |
|
81 | + $limitQuery = []; |
|
82 | + if (!empty($limit)) { |
|
83 | + $query[] = 'LIMIT'; |
|
84 | 84 | |
85 | - if (!empty($offset)) { |
|
86 | - $query[] = $offset.','; |
|
87 | - } |
|
85 | + if (!empty($offset)) { |
|
86 | + $query[] = $offset.','; |
|
87 | + } |
|
88 | 88 | |
89 | - $query[] = $limit; |
|
90 | - } |
|
89 | + $query[] = $limit; |
|
90 | + } |
|
91 | 91 | |
92 | - if (count($limitQuery)) { |
|
93 | - $query = array_merge($query, $limitQuery); |
|
94 | - } |
|
95 | - return $query; |
|
92 | + if (count($limitQuery)) { |
|
93 | + $query = array_merge($query, $limitQuery); |
|
94 | + } |
|
95 | + return $query; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function query($query, $fetchRows){ |
99 | - try { |
|
100 | - $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
|
101 | - |
|
102 | - if ($fetchRows == 'count') { |
|
103 | - $obj = $obj->fetchColumn(); |
|
104 | - } |
|
105 | - |
|
106 | - return $obj; |
|
107 | - } catch (\PDOException $ex) { |
|
108 | - throw new \PDOException($ex->getMessage(), 1); |
|
109 | - } catch (Exception $e) { |
|
110 | - throw new Exception($e->getMessage(), 1); |
|
111 | - } |
|
99 | + try { |
|
100 | + $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
|
101 | + |
|
102 | + if ($fetchRows == 'count') { |
|
103 | + $obj = $obj->fetchColumn(); |
|
104 | + } |
|
105 | + |
|
106 | + return $obj; |
|
107 | + } catch (\PDOException $ex) { |
|
108 | + throw new \PDOException($ex->getMessage(), 1); |
|
109 | + } catch (Exception $e) { |
|
110 | + throw new Exception($e->getMessage(), 1); |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function buildQuery(array $params) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | return "'".$field."'"; |
69 | 69 | } |
70 | 70 | |
71 | - private function getQueryFields($fields, $tbl){ |
|
71 | + private function getQueryFields($fields, $tbl) { |
|
72 | 72 | $startQuery = join(', ', $fields); |
73 | 73 | if (empty($fields)) { |
74 | 74 | $startQuery = $this->quote($tbl).'.*'; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return $startQuery; |
78 | 78 | } |
79 | 79 | |
80 | - private function buildLimitQuery($limit, $offset, $query = array()){ |
|
80 | + private function buildLimitQuery($limit, $offset, $query = array()) { |
|
81 | 81 | $limitQuery = []; |
82 | 82 | if (!empty($limit)) { |
83 | 83 | $query[] = 'LIMIT'; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | return $query; |
96 | 96 | } |
97 | 97 | |
98 | - public function query($query, $fetchRows){ |
|
98 | + public function query($query, $fetchRows) { |
|
99 | 99 | try { |
100 | 100 | $obj = Connection::get()->query($this->queryPrefix($query), \PDO::FETCH_OBJ); |
101 | 101 |
@@ -26,13 +26,13 @@ |
||
26 | 26 | * @since v0.0.5 |
27 | 27 | */ |
28 | 28 | public function delete( |
29 | - $table, |
|
30 | - $where, |
|
31 | - $whereRaw, |
|
32 | - $whereIn, |
|
33 | - $whereNotIn, |
|
34 | - $whereNull, |
|
35 | - $whereNotNull |
|
29 | + $table, |
|
30 | + $where, |
|
31 | + $whereRaw, |
|
32 | + $whereIn, |
|
33 | + $whereNotIn, |
|
34 | + $whereNull, |
|
35 | + $whereNotNull |
|
36 | 36 | ) |
37 | 37 | { |
38 | 38 | $wqb = new WhereQueryBuilder(); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $wqb = new WhereQueryBuilder(); |
39 | 39 | $query = "DELETE FROM ".$table; |
40 | 40 | |
41 | - try{ |
|
41 | + try { |
|
42 | 42 | $whereQuery = $wqb->buildAllWhereQuery( |
43 | 43 | $where, |
44 | 44 | $whereRaw, |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | $whereNull, |
48 | 48 | $whereNotNull |
49 | 49 | ); |
50 | - $query.= " ".join(" ", $whereQuery); |
|
50 | + $query .= " ".join(" ", $whereQuery); |
|
51 | 51 | Connection::get()->query($this->queryPrefix($query)); |
52 | - } catch(Exception $e){ |
|
52 | + } catch (Exception $e) { |
|
53 | 53 | throw new Exception($e->getMessage()); |
54 | 54 | } |
55 | 55 |