@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | public function getSelect() |
| 136 | 136 | { |
| 137 | - if(count($this->_table_names) == 0) { |
|
| 138 | - throw new exception('Specify at least 1 table name'); |
|
| 139 | - } |
|
| 137 | + if(count($this->_table_names) == 0) { |
|
| 138 | + throw new exception('Specify at least 1 table name'); |
|
| 139 | + } |
|
| 140 | 140 | $_read_fields = $this->_read_fields; |
| 141 | 141 | if (count($_read_fields) == 0) { |
| 142 | 142 | $_read_fields[] = '*'; |
@@ -179,22 +179,22 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | public function getUpdate() |
| 181 | 181 | { |
| 182 | - if(count($this->_table_names) == 0) { |
|
| 183 | - throw new exception('Specify at least 1 table name'); |
|
| 184 | - } |
|
| 185 | - if(count($this->_write_fields) == 0) { |
|
| 186 | - throw new exception('Specify at least 1 write field (set function)'); |
|
| 187 | - } |
|
| 182 | + if(count($this->_table_names) == 0) { |
|
| 183 | + throw new exception('Specify at least 1 table name'); |
|
| 184 | + } |
|
| 185 | + if(count($this->_write_fields) == 0) { |
|
| 186 | + throw new exception('Specify at least 1 write field (set function)'); |
|
| 187 | + } |
|
| 188 | 188 | $updates = array(); |
| 189 | 189 | for ($d = 0, $m = count($this->_write_fields); $d < $m; ++$d) { |
| 190 | 190 | $t = $this->_write_fields[$d].'='; |
| 191 | 191 | switch ($this->_write_field_types[$d]) { |
| 192 | 192 | case 0: |
| 193 | 193 | $t .= "'".$this->_write_values[$d]."'"; |
| 194 | - break; |
|
| 195 | - default: |
|
| 194 | + break; |
|
| 195 | + default: |
|
| 196 | 196 | $t .= $this->_write_values[$d]; |
| 197 | - } |
|
| 197 | + } |
|
| 198 | 198 | $updates[] = $t; |
| 199 | 199 | } |
| 200 | 200 | $update_fields = implode(', ', $updates); |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | public function getInsert() |
| 212 | 212 | { |
| 213 | - if(count($this->_table_names) == 0) { |
|
| 214 | - throw new exception('Specify at least 1 table name'); |
|
| 215 | - } |
|
| 216 | - if(count($this->_write_fields) == 0) { |
|
| 217 | - throw new exception('Specify at least 1 write field (set function)'); |
|
| 218 | - } |
|
| 213 | + if(count($this->_table_names) == 0) { |
|
| 214 | + throw new exception('Specify at least 1 table name'); |
|
| 215 | + } |
|
| 216 | + if(count($this->_write_fields) == 0) { |
|
| 217 | + throw new exception('Specify at least 1 write field (set function)'); |
|
| 218 | + } |
|
| 219 | 219 | $table = $this->_table_names[0]; |
| 220 | 220 | $fields = '`'.implode('`, `', $this->_write_fields).'`'; |
| 221 | 221 | $values = array(); |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | switch ($this->_write_field_types[$d]) { |
| 224 | 224 | case 0: |
| 225 | 225 | $values[] = "'".$this->_write_values[$d]."'"; |
| 226 | - break; |
|
| 226 | + break; |
|
| 227 | 227 | default: |
| 228 | 228 | $values[] = $this->_write_values[$d]; |
| 229 | - } |
|
| 229 | + } |
|
| 230 | 230 | } |
| 231 | 231 | $string = sprintf('insert into %1$s (%2$s) values(%3$s)', $table, $fields, implode(', ', $values)); |
| 232 | 232 | |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | public function getDelete() |
| 237 | 237 | { |
| 238 | - if(count($this->_table_names) == 0) { |
|
| 239 | - throw new exception('Specify at least 1 table name'); |
|
| 240 | - } |
|
| 238 | + if(count($this->_table_names) == 0) { |
|
| 239 | + throw new exception('Specify at least 1 table name'); |
|
| 240 | + } |
|
| 241 | 241 | $table = $this->_table_names[0]; |
| 242 | 242 | $where = count($this->_conditions) > 0 ? (' where '.implode(' and ', $this->_conditions)) : null; |
| 243 | 243 | $limit = null; |