00001 <?php 00002 /**************************************************************************** 00003 * Copyright (C) 2004-2008 by Konstantin V. Arkhipov, Anton E. Lebedevich * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation; either version 3 of the * 00008 * License, or (at your option) any later version. * 00009 * * 00010 ****************************************************************************/ 00011 00015 final class QueryChain extends SQLChain 00016 { 00017 public function toBoolean(Form $form) 00018 { 00019 throw new UnsupportedMethodException('get rid of useless interface'); 00020 } 00021 00025 public static function block($args, $logic) 00026 { 00027 $queryChain = new self; 00028 00029 foreach ($args as $arg) { 00030 if (!$arg instanceof SelectQuery) 00031 throw new WrongArgumentException( 00032 'unsupported object type: '.get_class($arg) 00033 ); 00034 00035 $queryChain->exp($arg, $logic); 00036 } 00037 00038 return $queryChain; 00039 } 00040 00044 public function union(SelectQuery $query) 00045 { 00046 return $this->exp($query, CombineQuery::UNION); 00047 } 00048 00052 public function unionAll(SelectQuery $query) 00053 { 00054 return $this->exp($query, CombineQuery::UNION_ALL); 00055 } 00056 00060 public function intersect(SelectQuery $query) 00061 { 00062 return $this->exp($query, CombineQuery::INTERSECT); 00063 } 00064 00068 public function intersectAll(SelectQuery $query) 00069 { 00070 return $this->exp($query, CombineQuery::INTERSECT_ALL); 00071 } 00072 00076 public function except(SelectQuery $query) 00077 { 00078 return $this->exp($query, CombineQuery::EXCEPT); 00079 } 00080 00084 public function exceptAll(SelectQuery $query) 00085 { 00086 return $this->exp($query, CombineQuery::EXCEPT_ALL); 00087 } 00088 } 00089 ?>