| @@ 101-114 (lines=14) @@ | ||
| 98 | * @param string $limit [optional] |
|
| 99 | * @return string |
|
| 100 | */ |
|
| 101 | protected function prepareUpdate($table, $data, $where = null, $limit = null) |
|
| 102 | { |
|
| 103 | $table = $this->identifier($table); |
|
| 104 | ||
| 105 | foreach ($data as $key => $value) { |
|
| 106 | $column = $this->identifier($key); |
|
| 107 | $value = $this->value($value); |
|
| 108 | $data[$key] = "$column = $value"; |
|
| 109 | } |
|
| 110 | ||
| 111 | $values = implode(', ', $data); |
|
| 112 | ||
| 113 | return static::concatenate(array('UPDATE', $table, 'SET', $values, $where, $limit)); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Prepare a DELETE statement with the given table and clauses. |
|
| @@ 179-192 (lines=14) @@ | ||
| 176 | * @param string $limit [optional] |
|
| 177 | * @return string |
|
| 178 | */ |
|
| 179 | protected function prepareUpdate($table, $data, $where = null, $limit = null) |
|
| 180 | { |
|
| 181 | $table = $this->identifier($table); |
|
| 182 | ||
| 183 | foreach ($data as $key => $value) { |
|
| 184 | $column = $this->identifier($key); |
|
| 185 | $value = $this->value($value); |
|
| 186 | $data[$key] = "$column = $value"; |
|
| 187 | } |
|
| 188 | ||
| 189 | $values = implode(', ', $data); |
|
| 190 | ||
| 191 | return static::concatenate(array('UPDATE', $limit, $table, 'SET', $values, $where)); |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * Prepare a DELETE statement with the given table and clauses. |
|