QueryChain.class.php

Go to the documentation of this file.
00001 <?php
00002 /****************************************************************************
00003  *   Copyright (C) 2004-2007 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 /* $Id: QueryChain.class.php 4687 2007-12-09 18:57:18Z voxus $ */
00012 
00016     final class QueryChain extends SQLChain
00017     {
00018         public function toBoolean(Form $form)
00019         {
00020             throw new UnsupportedMethodException('get rid of useless interface');
00021         }
00022 
00026         public static function block($args, $logic)
00027         {
00028             $queryChain = new self;
00029             
00030             foreach ($args as $arg) {
00031                 if (!$arg instanceof SelectQuery)
00032                     throw new WrongArgumentException(
00033                         'unsupported object type: '.get_class($arg)
00034                     );
00035                 
00036                 $queryChain->exp($arg, $logic);
00037             }
00038             
00039             return $queryChain;
00040         }
00041         
00045         public function union(SelectQuery $query)
00046         {
00047             return $this->exp($query, CombineQuery::UNION);
00048         }
00049         
00053         public function unionAll(SelectQuery $query)
00054         {
00055             return $this->exp($query, CombineQuery::UNION_ALL);
00056         }
00057         
00061         public function intersect(SelectQuery $query)
00062         {
00063             return $this->exp($query, CombineQuery::INTERSECT);
00064         }
00065         
00069         public function intersectAll(SelectQuery $query)
00070         {
00071             return $this->exp($query, CombineQuery::INTERSECT_ALL);
00072         }
00073         
00077         public function except(SelectQuery $query)
00078         {
00079             return $this->exp($query, CombineQuery::EXCEPT);
00080         }
00081         
00085         public function exceptAll(SelectQuery $query)
00086         {
00087             return $this->exp($query, CombineQuery::EXCEPT_ALL);
00088         }
00089     }
00090 ?>

Generated on Sun Dec 9 21:56:23 2007 for onPHP by  doxygen 1.5.4