PHP Class phprs\ezsql\rules\update\UpdateSetRule

Inheritance: extends phprs\ezsql\rules\basic\WhereRule
Show file Open project: caoym/phprs-restful

Public Methods

Method Description
__construct ( $context )
set ( string $column, mixed $value ) : UpdateSetRule update('table')->set('a', 1) => "UPDATE table SET a=1" update('table')->set('a', 1)->set('b',Sql::native('now()')) => "UPDATE table SET a=1,b=now()"
setArgs ( array $values ) : UpdateSetRule update('table')->set(['a'=>1, 'b'=>Sql::native('now()')]) => "UPDATE table SET a=1,b=now()"
setExpr ( string $expr, mixed $_ = null ) : UpdateSetRule update('table')->setExpr('a=a+?',1)

Method Details

__construct() public method

public __construct ( $context )

set() public method

update('table')->set('a', 1) => "UPDATE table SET a=1" update('table')->set('a', 1)->set('b',Sql::native('now()')) => "UPDATE table SET a=1,b=now()"
public set ( string $column, mixed $value ) : UpdateSetRule
$column string
$value mixed
return UpdateSetRule

setArgs() public method

update('table')->set(['a'=>1, 'b'=>Sql::native('now()')]) => "UPDATE table SET a=1,b=now()"
public setArgs ( array $values ) : UpdateSetRule
$values array
return UpdateSetRule

setExpr() public method

update('table')->setExpr('a=a+?',1)
public setExpr ( string $expr, mixed $_ = null ) : UpdateSetRule
$expr string
$_ mixed
return UpdateSetRule