예제 #1
0
$result = array();
// traversing searchable fields
foreach ($allSearchFields as $f) {
    // filter fields by type
    $fType = $pSet->getFieldType($f);
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) {
        continue;
    }
    if ($_connection->dbType == nDATABASE_Oracle && IsTextType($fType)) {
        continue;
    }
    if ($searchField != '' && $searchField != GoodFieldName($f) || !$pSet->checkFieldPermissions($f)) {
        continue;
    }
    $fieldControl = $controls->getControl($f);
    $isAggregateField = $pSet->isAggregateField($f);
    $where = $fieldControl->getSuggestWhere($searchOpt, $searchFor, $isAggregateField);
    $having = $fieldControl->getSuggestHaving($searchOpt, $searchFor, $isAggregateField);
    if (!strlen($where) && !strlen($having)) {
        continue;
    }
    $where = whereAdd($where . $masterWhere, $strSecuritySql);
    $clausesData = $fieldControl->getSelectColumnsAndJoinFromPart($searchFor, $searchOpt, true);
    $selectColumns = $clausesData["selectColumns"];
    $fromClause = $gQuery->FromToSql() . $clausesData["joinFromPart"];
    $distinct = "DISTINCT";
    if ($_connection->dbType == nDATABASE_MSSQLServer || $_connection->dbType == nDATABASE_Access) {
        if (IsTextType($fType)) {
            $distinct = "";
        }
    }