@@ 418-435 (lines=18) @@ | ||
415 | * @param boolean disable quoting of WHERE clause |
|
416 | * @return Database_Core This Database object. |
|
417 | */ |
|
418 | public function where($key, $value = null, $quote = true) |
|
419 | { |
|
420 | $quote = (func_num_args() < 2 and ! is_array($key)) ? -1 : $quote; |
|
421 | if (is_object($key)) { |
|
422 | $keys = array((string) $key => ''); |
|
423 | } elseif (! is_array($key)) { |
|
424 | $keys = array($key => $value); |
|
425 | } else { |
|
426 | $keys = $key; |
|
427 | } |
|
428 | ||
429 | foreach ($keys as $key => $value) { |
|
430 | $key = (strpos($key, '.') !== false) ? $this->config['table_prefix'].$key : $key; |
|
431 | $this->where[] = $this->driver->where($key, $value, 'AND ', count($this->where), $quote); |
|
432 | } |
|
433 | ||
434 | return $this; |
|
435 | } |
|
436 | ||
437 | /** |
|
438 | * Selects the or where(s) for a database query. |
|
@@ 445-462 (lines=18) @@ | ||
442 | * @param boolean disable quoting of WHERE clause |
|
443 | * @return Database_Core This Database object. |
|
444 | */ |
|
445 | public function orwhere($key, $value = null, $quote = true) |
|
446 | { |
|
447 | $quote = (func_num_args() < 2 and ! is_array($key)) ? -1 : $quote; |
|
448 | if (is_object($key)) { |
|
449 | $keys = array((string) $key => ''); |
|
450 | } elseif (! is_array($key)) { |
|
451 | $keys = array($key => $value); |
|
452 | } else { |
|
453 | $keys = $key; |
|
454 | } |
|
455 | ||
456 | foreach ($keys as $key => $value) { |
|
457 | $key = (strpos($key, '.') !== false) ? $this->config['table_prefix'].$key : $key; |
|
458 | $this->where[] = $this->driver->where($key, $value, 'OR ', count($this->where), $quote); |
|
459 | } |
|
460 | ||
461 | return $this; |
|
462 | } |
|
463 | ||
464 | /** |
|
465 | * Selects the like(s) for a database query. |