00001 <?php
00002
00003
00004
00005
00006
00007
00008 class DBSqlBuilderWhereGroup implements IDBSqlBuilder {
00009
00010
00011
00012 protected $group = null;
00013
00014
00015
00016
00017 public function __construct($group, $params = false) {
00018 $this->group = $group;
00019 }
00020
00021
00022
00023
00024
00025
00026 public function get_sql() {
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
00040 $ret = '(' . implode(' ', $items) . ')';
00041 }
00042 return $ret;
00043 }
00044
00045
00046
00047
00048 protected function push_item(&$items, $item) {
00049 if ($item) {
00050 $items[] = $item;
00051 }
00052 }
00053
00054
00055
00056
00057 protected function translate_logical_operator($operator) {
00058 return $operator;
00059 }
00060 }