8 class Query extends \Rsi\Thing{
21 $this->_tables[] = $table;
25 $this->_select[] = $column;
29 public function join($join,$outer =
false){
30 $this->_tables[] = ($outer ?
'left ' :
'') .
'join ' . $join;
34 public function where($condition){
35 $this->_where[] = is_array($condition) ?
'(' . implode(
' or ',$condition) .
')' : $condition;
40 $this->_group[] = $group;
45 $this->_having[] = $condition;
50 $this->_order[] = $order;
54 public function limit($limit,$offset = 0){
55 $this->_limit = $limit;
56 $this->_offset = $offset;
60 public function arg($key,$value){
61 $this->_args[$key] = $value;
65 public function args($values = null){
66 $this->_args = array_merge($this->_args,$values);
80 'select ' . ($this->_select ? implode(
',',$this->_select) :
'*') .
81 "\nfrom " . implode(
"\n ",$this->_tables) .
82 ($this->_where ?
"\nwhere " . implode(
"\n and ",$this->_where) :
'') .
83 ($this->_group ?
"\ngroup by " . implode(
',',$this->_group) :
'') .
84 ($this->_having ?
"\nhaving " . implode(
' and ',$this->_having) :
'') .
85 ($this->_order ?
"\norder by " . implode(
',',$this->_order) :
'') .
86 ($this->_limit ?
"\nlimit {$this->_offset},{$this->_limit}" :
'');
89 protected function _set($key,$value){
90 $this->
arg($key,$value);
93 protected function _get($key){
94 return \Rsi\Record::get($this->_args,$key,
false);
join($join, $outer=false)