if ($searchField == "") { $allSearchFields = GetTableData($strTableName, '.googleLikeFields', array()); } // proccess fields and create sql foreach ($allSearchFields as $f) { $fType = GetFieldType($f, $strTableName); // filter fields by type if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || IsTextType($fType)) { continue; } // get suggest for field if (($searchField == '' || $searchField == GoodFieldName($f)) && CheckFieldPermissions($f)) { $where = ""; $having = ""; if (!$gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) { $where = $searchClauseObj->getSuggestWhere($f, $fType, $suggestAllContent, $searchFor); } elseif ($gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) { $having = $searchClauseObj->getSuggestWhere($f, $fType, $suggestAllContent, $searchFor); } // prepare common vals $sqlHead = "SELECT DISTINCT " . GetFullFieldName($f) . " "; $oHaving = $gQuery->Having(); $sqlHaving = $oHaving->toSql($gQuery); $sqlGroupBy = $gQuery->GroupByToSql(); $where = whereAdd($where, $strSecuritySql); $strSQL = gSQLWhere_having($sqlHead, $gsqlFrom, $gsqlWhereExpr, $sqlGroupBy, $sqlHaving, $where, $having); $strSQL .= " ORDER BY 1 "; $rs = db_query($strSQL, $conn); $i = 0; while ($row = db_fetch_numarray($rs)) { $i++;
} $controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer); // proccess fields and create sql foreach ($allSearchFields as $f) { $fType = $pSet->getFieldType($f); // filter fields by type if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) { continue; } else { } // get suggest for field if (($searchField == '' || $searchField == GoodFieldName($f)) && $pSet->checkFieldPermissions($f)) { $where = ""; $having = ""; if (!$gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) { $where = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor); } elseif ($gQuery->IsAggrFuncField($pSet->getFieldIndex($f) - 1)) { $having = $searchClauseObj->getSuggestWhere($controls->getControl($f), $suggestAllContent, $searchFor); } if (!strlen($where) && !strlen($having)) { continue; } // prepare common vals $where = whereAdd($where . $masterWhere, $strSecuritySql); $distinct = "DISTINCT"; $sqlHead = "SELECT " . $distinct . " " . GetFullFieldName($f) . " "; if ($gQuery->HasGroupBy()) { $strSQL = $gQuery->gSQLWhere_having_fromQuery("", $where, $having); $strSQL = "SELECT DISTINCT st." . AddFieldWrappers($f) . " from (" . $strSQL . ") st"; } else { $strSQL = SQLQuery::gSQLWhere_having($sqlHead, $gQuery->FromToSql(), $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $where, $having);