00001 <?php
00002
00003
00004
00005
00006
00007
00008 class DBSqlBuilderWhereGroupSphinx extends DBSqlBuilderWhereGroup {
00009
00010
00011
00012
00013
00014 public function get_sql() {
00015 $query_ret = '';
00016 $items_query = array();
00017 $items_filter = array();
00018 foreach($this->group->get_children() as $where) {
00019 $arr = $where->get_sql();
00020 $items_filter = array_merge($items_filter, $arr['filter']);
00021 $query = $arr['query'];
00022 if (!empty($query)) {
00023 if (count($items_query)) {
00024 $this->push_item($items_query, $this->translate_logical_operator($where->get_logical_operator()));
00025 }
00026 $this->push_item($items_query, $query);
00027 }
00028 }
00029 if (count($items_query)) {
00030
00031 $query_ret = '(' . implode(' ', $items_query) . ')';
00032 }
00033 return array(
00034 'filter' => $items_filter,
00035 'query' => $query_ret
00036 );
00037 }
00038
00039
00040
00041
00042 protected function translate_logical_operator($operator) {
00043 switch ($operator) {
00044 case DBWhere::LOGIC_OR:
00045 return '|';
00046 default:
00047 return '';
00048 }
00049 }
00050 }