| @@ 26-45 (lines=20) @@ | ||
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| 26 | class UpdateSetRule extends BasicRule |
|
| 27 | { |
|
| 28 | public function __construct($context){ |
|
| 29 | parent::__construct($context); |
|
| 30 | $this->impl = new UpdateSetImpl(); |
|
| 31 | } |
|
| 32 | /** |
|
| 33 | * update('table')->set(['a'=>1]) => "UPDATE table SET a=1" |
|
| 34 | ||
| 35 | * update('table')->set('a=?',1) => "UPDATE table SET a=1" |
|
| 36 | * @param array|string $expr |
|
| 37 | * @param mixed $_ |
|
| 38 | * @return UpdateSetWhereRule |
|
| 39 | */ |
|
| 40 | public function set($expr, $_=null) { |
|
| 41 | $this->impl->set($this->context, $expr, array_slice(func_get_args(), 1)); |
|
| 42 | return new UpdateSetWhereRule($this->context, $this->impl); |
|
| 43 | } |
|
| 44 | private $impl; |
|
| 45 | } |
|
| 46 | ||
| 47 | class UpdateSetWhereRule extends WhereRule |
|
| 48 | { |
|
| @@ 47-66 (lines=20) @@ | ||
| 44 | private $impl; |
|
| 45 | } |
|
| 46 | ||
| 47 | class UpdateSetWhereRule extends WhereRule |
|
| 48 | { |
|
| 49 | public function __construct(Context $context, UpdateSetImpl $impl){ |
|
| 50 | parent::__construct($context); |
|
| 51 | $this->impl = $impl; |
|
| 52 | } |
|
| 53 | /** |
|
| 54 | * update('table')->set(['a'=>1]) => "UPDATE table SET a=1" |
|
| 55 | ||
| 56 | * update('table')->set('a=?',1) => "UPDATE table SET a=1" |
|
| 57 | * @param array|string $expr |
|
| 58 | * @param mixed $_ |
|
| 59 | * @return WhereRule |
|
| 60 | */ |
|
| 61 | public function set($expr, $_=null) { |
|
| 62 | $this->impl->set($this->context, $expr, array_slice(func_get_args(), 1)); |
|
| 63 | return new UpdateSetWhereRule($this->context, $this->impl); |
|
| 64 | } |
|
| 65 | private $impl; |
|
| 66 | } |
|
| 67 | ||
| 68 | ||