@@ 233-250 (lines=18) @@ | ||
230 | * |
|
231 | * @return string |
|
232 | */ |
|
233 | protected static function buildClause($tableName, $data) |
|
234 | { |
|
235 | $counter = 0; |
|
236 | $updateQuery = ""; |
|
237 | $arraySize = count($data); |
|
238 | ||
239 | foreach ($data as $key => $value) |
|
240 | { |
|
241 | $counter++; |
|
242 | $columnName = self::checkColumn($tableName, self::sanitize($key)); |
|
243 | $updateQuery .= $columnName ." = '".self::sanitize($value)."'"; |
|
244 | if ($arraySize > $counter) |
|
245 | { |
|
246 | $updateQuery .= ", "; |
|
247 | } |
|
248 | } |
|
249 | return $updateQuery; |
|
250 | } |
|
251 | ||
252 | /** |
|
253 | * Get the fields to be fillables defined in the model |
|
@@ 307-325 (lines=19) @@ | ||
304 | return $where; |
|
305 | } |
|
306 | ||
307 | public static function whereLikeClause($tableName, $data, $condition) |
|
308 | { |
|
309 | $where = ""; |
|
310 | $counter = 0; |
|
311 | $arraySize = count($data); |
|
312 | ||
313 | foreach ( $data as $key => $value ) |
|
314 | { |
|
315 | $counter++; |
|
316 | $columnName = self::checkColumn($tableName, self::sanitize($key)); |
|
317 | $where .= $columnName ." LIKE '%".self::sanitize($value)."%'"; |
|
318 | if ( $arraySize > $counter ) |
|
319 | { |
|
320 | $where .= " " . $condition . " "; |
|
321 | } |
|
322 | } |
|
323 | ||
324 | return $where; |
|
325 | } |
|
326 | ||
327 | /** |
|
328 | * selectQuery |