@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | switch ($this->_write_field_types[$d]) { |
| 170 | 170 | case 0: |
| 171 | 171 | $t .= "'" . $this->_write_values[$d] . "'"; |
| 172 | - break; |
|
| 173 | - default: |
|
| 172 | + break; |
|
| 173 | + default: |
|
| 174 | 174 | $t .= $this->_write_values[$d]; |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | $updates[] = $t; |
| 177 | 177 | } |
| 178 | 178 | $update_fields = implode(", ", $updates); |
@@ -195,10 +195,10 @@ discard block |
||
| 195 | 195 | switch ($this->_write_field_types[$d]) { |
| 196 | 196 | case 0: |
| 197 | 197 | $values[] = "'" . $this->_write_values[$d] . "'"; |
| 198 | - break; |
|
| 198 | + break; |
|
| 199 | 199 | default: |
| 200 | 200 | $values[] = $this->_write_values[$d]; |
| 201 | - } |
|
| 201 | + } |
|
| 202 | 202 | } |
| 203 | 203 | $string = sprintf('insert into %1$s (%2$s) values(%3$s)', $table, $fields, implode(", ", $values)); |
| 204 | 204 | return $string; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function addOrCondition() |
| 93 | 93 | { |
| 94 | - $this->_conditions[] = '('.implode(' or ', func_get_args()).')'; |
|
| 94 | + $this->_conditions[] = '(' . implode(' or ', func_get_args()) . ')'; |
|
| 95 | 95 | |
| 96 | 96 | return $this; |
| 97 | 97 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | $limit = null; |
| 143 | 143 | if ($this->limit > 0) { |
| 144 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 144 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 145 | 145 | } |
| 146 | 146 | $group = null; |
| 147 | 147 | if (count($this->_group_fields) > 0) { |
| 148 | - $group = ' group by '.implode(', ', $this->_group_fields).' '; |
|
| 148 | + $group = ' group by ' . implode(', ', $this->_group_fields) . ' '; |
|
| 149 | 149 | } |
| 150 | 150 | $order = null; |
| 151 | 151 | if (count($this->_order_fields) > 0) { |
@@ -157,20 +157,20 @@ discard block |
||
| 157 | 157 | $pos = strpos($of[0], '.'); |
| 158 | 158 | if ($pos !== false) { |
| 159 | 159 | $t = explode('.', $of[0]); |
| 160 | - $t[1] = '`'.$t[1].'`'; |
|
| 160 | + $t[1] = '`' . $t[1] . '`'; |
|
| 161 | 161 | $of[0] = implode('.', $t); |
| 162 | 162 | $order .= $of[0]; |
| 163 | 163 | } else { |
| 164 | - $order .= '`'.$of[0].'`'; |
|
| 164 | + $order .= '`' . $of[0] . '`'; |
|
| 165 | 165 | } |
| 166 | - $order .= ' '.($of[1] ? 'asc' : 'desc'); |
|
| 166 | + $order .= ' ' . ($of[1] ? 'asc' : 'desc'); |
|
| 167 | 167 | } else { |
| 168 | 168 | $order .= $of[0]; |
| 169 | 169 | } |
| 170 | 170 | ++$i; |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | - $string = sprintf('select %1$s from %2$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null, $order, $limit, $group); |
|
| 173 | + $string = sprintf('select %1$s from %2$s%3$s%6$s%4$s%5$s', implode(', ', $_read_fields), implode(', ', $this->_table_names), count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null, $order, $limit, $group); |
|
| 174 | 174 | |
| 175 | 175 | return $string; |
| 176 | 176 | } |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | $updates = array(); |
| 181 | 181 | for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) { |
| 182 | - $t = $this->_write_fields[$d].'='; |
|
| 182 | + $t = $this->_write_fields[$d] . '='; |
|
| 183 | 183 | switch ($this->_write_field_types[$d]) { |
| 184 | 184 | case 0: |
| 185 | - $t .= "'".$this->_write_values[$d]."'"; |
|
| 185 | + $t .= "'" . $this->_write_values[$d] . "'"; |
|
| 186 | 186 | break; |
| 187 | 187 | default: |
| 188 | 188 | $t .= $this->_write_values[$d]; |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | $update_fields = implode(', ', $updates); |
| 193 | 193 | $limit = null; |
| 194 | 194 | if ($this->limit > 0) { |
| 195 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 195 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 196 | 196 | } |
| 197 | - $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null; |
|
| 197 | + $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null; |
|
| 198 | 198 | $string = sprintf('update %1$s set %2$s %3$s %4$s', $this->_table_names[0], $update_fields, $where, $limit); |
| 199 | 199 | |
| 200 | 200 | return $string; |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | public function insert() |
| 204 | 204 | { |
| 205 | 205 | $table = $this->_table_names[0]; |
| 206 | - $fields = '`'.implode('`, `', $this->_write_fields).'`'; |
|
| 206 | + $fields = '`' . implode('`, `', $this->_write_fields) . '`'; |
|
| 207 | 207 | $values = array(); |
| 208 | 208 | for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) { |
| 209 | 209 | switch ($this->_write_field_types[$d]) { |
| 210 | 210 | case 0: |
| 211 | - $values[] = "'".$this->_write_values[$d]."'"; |
|
| 211 | + $values[] = "'" . $this->_write_values[$d] . "'"; |
|
| 212 | 212 | break; |
| 213 | 213 | default: |
| 214 | 214 | $values[] = $this->_write_values[$d]; |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | public function delete() |
| 223 | 223 | { |
| 224 | 224 | $table = $this->_table_names[0]; |
| 225 | - $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null; |
|
| 225 | + $where = count($this->_conditions) > 0 ? (' where ' . implode(' and ', $this->_conditions)) : null; |
|
| 226 | 226 | $limit = null; |
| 227 | 227 | if ($this->limit > 0) { |
| 228 | - $limit = ' limit '.($this->limit_offset != -1 ? $this->limit_offset.', ' : null).$this->limit; |
|
| 228 | + $limit = ' limit ' . ($this->limit_offset != -1 ? $this->limit_offset . ', ' : null) . $this->limit; |
|
| 229 | 229 | } |
| 230 | 230 | $string = sprintf('delete from %1$s %2$s %3$s', $table, $where, $limit); |
| 231 | 231 | |