.

DBSqlBuilderWhereGroup Class Reference
[Model]

SQL Builder for grouped WHERE clauses. More...

Inheritance diagram for DBSqlBuilderWhereGroup:
IDBSqlBuilder DBSqlBuilderWhereGroupMysql

List of all members.

Public Member Functions

  __construct ($group, $params=false)
  get_sql ()
  Return SQL fragment.

Protected Member Functions

  push_item (&$items, $item)
  Append item to list.
  translate_logical_operator ($operator)
  Return Driver specific value for AND or OR.

Protected Attributes

  $group = null

Detailed Description

SQL Builder for grouped WHERE clauses.

Author:
Gerd Riesselmann

Definition at line 8 of file dbsqlbuilder.wheregroup.cls.php.


Constructor & Destructor Documentation

DBSqlBuilderWhereGroup::__construct ( group,
params = false  
)
Parameters:
DBWhereGroup  $where

Definition at line 17 of file dbsqlbuilder.wheregroup.cls.php.

00017                                                              {
00018                 $this->group = $group;
00019         }       

Member Function Documentation

DBSqlBuilderWhereGroup::get_sql (  ) 

Return SQL fragment.

Returns:
string

Implements IDBSqlBuilder.

Definition at line 26 of file dbsqlbuilder.wheregroup.cls.php.

00026                                   {             
00027                 $ret = '';
00028                 $items = array();
00029                 foreach($this->group->get_children() as $where) {
00030                         $sql = $where->get_sql();
00031                         if (!empty($sql)) {
00032                                 if (count($items)) {
00033                                         $this->push_item($items, $this->translate_logical_operator($where->get_logical_operator()));                                    
00034                                 }
00035                                 $this->push_item($items, $sql);
00036                         }
00037                 }
00038                 if (count($items)) {
00039                         // We did something, so $ret is not empty
00040                         $ret = '(' . implode(' ', $items) . ')';
00041                 }
00042                 return $ret;
00043         }
DBSqlBuilderWhereGroup::push_item ( &$  items,
item  
) [protected]

Append item to list.

Definition at line 48 of file dbsqlbuilder.wheregroup.cls.php.

00048                                                      {
00049                 if ($item) {
00050                         $items[] = $item;
00051                 }
00052         }
DBSqlBuilderWhereGroup::translate_logical_operator ( operator  )  [protected]

Return Driver specific value for AND or OR.

Definition at line 57 of file dbsqlbuilder.wheregroup.cls.php.

00057                                                                  {
00058                 return $operator;
00059         }

Member Data Documentation

DBSqlBuilderWhereGroup::$group = null [protected]

Definition at line 12 of file dbsqlbuilder.wheregroup.cls.php.


The documentation for this class was generated from the following file: