| @@ 87-99 (lines=13) @@ | ||
| 84 | * @param string $limit [optional] |
|
| 85 | * @return string |
|
| 86 | */ |
|
| 87 | protected function prepareUpdate($table, $data, $where = null, $limit = null) { |
|
| 88 | $table = $this->identifier($table); |
|
| 89 | ||
| 90 | foreach ($data as $key => $value) { |
|
| 91 | $column = $this->identifier($key); |
|
| 92 | $value = $this->value($value); |
|
| 93 | $data[$key] = "$column = $value"; |
|
| 94 | } |
|
| 95 | ||
| 96 | $values = implode(', ', $data); |
|
| 97 | ||
| 98 | return static::concatenate(array('UPDATE', $table, 'SET', $values, $where, $limit)); |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Prepare a DELETE statement with the given table and clauses. |
|
| @@ 73-85 (lines=13) @@ | ||
| 70 | * @param string $limit [optional] |
|
| 71 | * @return string |
|
| 72 | */ |
|
| 73 | protected function prepareUpdate($table, $data, $where = null, $limit = null) { |
|
| 74 | $table = $this->identifier($table); |
|
| 75 | ||
| 76 | foreach ($data as $key => $value) { |
|
| 77 | $column = $this->identifier($key); |
|
| 78 | $value = $this->value($value); |
|
| 79 | $data[$key] = "$column = $value"; |
|
| 80 | } |
|
| 81 | ||
| 82 | $values = implode(', ', $data); |
|
| 83 | ||
| 84 | return static::concatenate(array('UPDATE', $limit, $table, 'SET', $values, $where)); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Prepare a DELETE statement with the given table and clauses. |
|