当前位置: 首页>>代码示例>>PHP>>正文


PHP GetRowCount函数代码示例

本文整理汇总了PHP中GetRowCount函数的典型用法代码示例。如果您正苦于以下问题:PHP GetRowCount函数的具体用法?PHP GetRowCount怎么用?PHP GetRowCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetRowCount函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trim

    $strWhereClause = @$_SESSION[$strTableName . "_pdfwhere"];
}
$_SESSION[$strTableName . "_pdfwhere"] = $strWhereClause;
$strOrderBy = $_SESSION[$strTableName . "_order"];
if (!$strOrderBy) {
    $strOrderBy = $gstrOrderBy;
}
$strSQL .= " " . trim($strOrderBy);
$strSQLbak = $strSQL;
if ($eventObj->exists("BeforeQueryPrint")) {
    $eventObj->BeforeQueryPrint($strSQL, $strWhereClause, $strOrderBy, $pageObject);
}
//	Rebuild SQL if needed
if ($strSQL != $strSQLbak) {
    //	changed $strSQL - old style
    $numrows = GetRowCount($strSQL);
} else {
    $strSQL = $gQuery->gSQLWhere($strWhereClause, $strHavingClause, $strSearchCriteria);
    $strSQL .= " " . trim($strOrderBy);
    $rowcount = false;
    if ($eventObj->exists("ListGetRowCount")) {
        $masterKeysReq = array();
        for ($i = 0; $i < count($pageObject->detailKeysByM); $i++) {
            $masterKeysReq[] = $_SESSION[$strTableName . "_masterkey" . ($i + 1)];
        }
        $rowcount = $eventObj->ListGetRowCount($pageObject->searchClauseObj, $_SESSION[$strTableName . "_mastertable"], $masterKeysReq, $selected_recs, $pageObject);
    }
    if ($rowcount !== false) {
        $numrows = $rowcount;
    } else {
        $numrows = $gQuery->gSQLRowCount($strWhereClause, $strHavingClause, $strSearchCriteria);
开发者ID:aagusti,项目名称:padl-tng,代码行数:31,代码来源:pad_pad_daftar_hist_print.php

示例2: getCurrentRecordInternal

 /**
  * Read current values from the database
  *
  * @return {array} array of current record data
  */
 function getCurrentRecordInternal()
 {
     if (!is_null($this->data)) {
         return $this->data;
     }
     global $gstrOrderBy, $conn;
     $strWhereClause = '';
     $strHavingClause = '';
     if (!$this->all) {
         //	show one record only
         $this->setKeys();
         $strWhereClause = KeyWhere($this->keys);
         $strSQL = $this->gQuery->gSQLWhere($strWhereClause);
     } else {
         if ($_SESSION[$this->tName . "_SelectedSQL"] != "" && @$_REQUEST["records"] == "") {
             $strSQL = $_SESSION[$this->tName . "_SelectedSQL"];
             $strWhereClause = @$_SESSION[$this->tName . "_SelectedWhere"];
         } else {
             $strWhereClause = @$_SESSION[$this->tName . "_where"];
             $strHavingClause = @$_SESSION[$this->tName . "_having"];
             $strSearchCriteria = @$_SESSION[$this->tName . "_criteria"];
             $strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause, $strSearchCriteria);
         }
         //	order by
         $strOrderBy = $_SESSION[$this->tName . "_order"];
         if (!$strOrderBy) {
             $strOrderBy = $gstrOrderBy;
         }
         $strSQL .= " " . trim($strOrderBy);
     }
     $strSQLbak = $strSQL;
     if ($this->eventsObject->exists("BeforeQueryView")) {
         $this->eventsObject->BeforeQueryView($strSQL, $strWhereClause, $this);
     }
     if ($strSQLbak == $strSQL) {
         $strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause);
         if ($this->all) {
             $numrows = $this->gQuery->gSQLRowCount($strWhereClause, $strHavingClause, $strSearchCriteria);
             $strSQL .= " " . trim($strOrderBy);
         }
     } else {
         //	changed $strSQL - old style
         if ($this->all) {
             $numrows = GetRowCount($strSQL);
         }
     }
     if (!$this->all) {
         LogInfo($strSQL);
         $rs = db_query($strSQL, $conn);
     } else {
         // Pagination:
         $nPageSize = 0;
         if (@$_REQUEST["records"] == "page" && $numrows) {
             $mypage = (int) @$_SESSION[$this->tName . "_pagenumber"];
             $nPageSize = (int) @$_SESSION[$this->tName . "_pagesize"];
             if ($numrows <= ($mypage - 1) * $nPageSize) {
                 $mypage = ceil($numrows / $nPageSize);
             }
             if (!$nPageSize) {
                 $nPageSize = $gPageSize;
             }
             if (!$mypage) {
                 $mypage = 1;
             }
             $maxrecs = $nPageSize;
             $strSQL .= " limit " . $nPageSize . " offset " . ($mypage - 1) * $nPageSize;
         }
         $rs = db_query($strSQL, $conn);
     }
     $this->data = $this->cipherer->DecryptFetchedArray($rs);
     if (sizeof($this->data) && $this->eventsObject->exists("ProcessValuesView")) {
         $this->eventsObject->ProcessValuesView($this->data, $this);
     }
     return $this->data;
 }
开发者ID:aagusti,项目名称:padl-tng,代码行数:80,代码来源:viewpage.php

示例3: getCurrentRecordInternal

	/**
	 * Read current values from the database
	 *
	 * @return {array} array of current record data
	 */
	function getCurrentRecordInternal()
	{
		if (!is_null($this->data))
			return $this->data;
		
		global $gstrOrderBy, $conn;
		$strWhereClause = '';
		$strHavingClause = '';
		if(!$this->all)
		{		
			$strWhereClause = KeyWhere($this->keys);
			if($this->pSet->getAdvancedSecurityType()!=ADVSECURITY_ALL)
				$strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search"));
			$strSQL = $this->gQuery->gSQLWhere($strWhereClause);
		}
		else
		{
			if ($_SESSION[$this->tName."_SelectedSQL"]!="" && @$_REQUEST["records"]=="") 
			{
				$strSQL = $_SESSION[$this->tName."_SelectedSQL"];
				$strWhereClause=@$_SESSION[$this->tName."_SelectedWhere"];
			}
			else
			{
				$strWhereClause = @$_SESSION[$this->tName."_where"];
				$strHavingClause = @$_SESSION[$this->tName."_having"];
				$strSearchCriteria = @$_SESSION[$this->tName."_criteria"];
				$joinFromPart = @$_SESSION[$this->tName."_joinFromPart"];
				if($this->pSet->getAdvancedSecurityType()==ADVSECURITY_VIEW_OWN && $strWhereClause=="")
					$strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search"));
				//$strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause, $strSearchCriteria);
				$strSQL = SQLQuery::gSQLWhere_having($this->gQuery->HeadToSql(), $this->gQuery->FromToSql().$joinFromPart, $this->gQuery->WhereToSql(),
						$this->gQuery->GroupByToSql(), $this->gQuery->Having()->toSql($this->gQuery), $strWhereClause, $strHavingClause, $strSearchCriteria);				
			}
			//	order by
			$strOrderBy = $_SESSION[$this->tName."_order"];
			if(!$strOrderBy)
				$strOrderBy = $gstrOrderBy;
			$strSQL.=" ".trim($strOrderBy);
		}
		
		$strSQLbak = $strSQL;
		if($this->eventsObject->exists("BeforeQueryView"))
			$this->eventsObject->BeforeQueryView($strSQL, $strWhereClause, $this);
		if($strSQLbak == $strSQL)
		{
			//$strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause);
			$strSQL = SQLQuery::gSQLWhere_having($this->gQuery->HeadToSql(), $this->gQuery->FromToSql().$joinFromPart, $this->gQuery->WhereToSql(),
					$this->gQuery->GroupByToSql(), $this->gQuery->Having()->toSql($this->gQuery), $strWhereClause, $strHavingClause, $strSearchCriteria);			
			if($this->all)
			{
				$numrows = $this->gQuery->gSQLRowCount($strWhereClause, $strHavingClause, $strSearchCriteria);
				$strSQL.=" ".trim($strOrderBy);
			}
		}
		else
		{	//	changed $strSQL - old style	
			if($this->all)
				$numrows = GetRowCount($strSQL);
		}
		
		if(!$this->all)
		{
			LogInfo($strSQL);
			$rs = db_query($strSQL, $conn);
		}
		else
		{
			// Pagination:
			$nPageSize = 0;
			if(@$_REQUEST["records"]=="page" && $numrows)
			{
				$mypage = (integer)@$_SESSION[$this->tName."_pagenumber"];
				$nPageSize = (integer)@$_SESSION[$this->tName."_pagesize"];
				if($numrows <= ($mypage-1)*$nPageSize)
					$mypage = ceil($numrows/$nPageSize);
				if(!$nPageSize)
					$nPageSize = $gPageSize;
				if(!$mypage)
					$mypage = 1;
				$strSQL.=" limit ".(($mypage-1)*$nPageSize).",".$nPageSize;
			}
			$rs = db_query($strSQL,$conn);
		}
		
		$this->data = $this->cipherer->DecryptFetchedArray($rs);
		
		if(sizeof($this->data) && $this->eventsObject->exists("ProcessValuesView"))
			$this->eventsObject->ProcessValuesView($this->data, $this);
		
		return $this->data;
	}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:97,代码来源:viewpage.php

示例4: trim

}
if (@$_REQUEST["type"]) {
    //	order by
    $strOrderBy = $_SESSION[$strTableName . "_order"];
    if (!$strOrderBy) {
        $strOrderBy = $gstrOrderBy;
    }
    $strSQL .= " " . trim($strOrderBy);
    $strSQLbak = $strSQL;
    if ($eventObj->exists("BeforeQueryExport")) {
        $eventObj->BeforeQueryExport($strSQL, $strWhereClause, $strOrderBy, $pageObject);
    }
    //	Rebuild SQL if needed
    if ($strSQL != $strSQLbak) {
        //	changed $strSQL - old style
        $numrows = GetRowCount($strSQL, $pageObject->connection);
    } else {
        $strSQL = SQLQuery::gSQLWhere_having($gQuery->HeadToSql(), $gQuery->FromToSql() . $joinFromPart, $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $strWhereClause, $strHavingClause, $strSearchCriteria);
        $strSQL .= " " . trim($strOrderBy);
        $rowcount = false;
        if ($eventObj->exists("ListGetRowCount")) {
            $masterKeysReq = array();
            for ($i = 0; $i < count($pageObject->detailKeysByM); $i++) {
                $masterKeysReq[] = $_SESSION[$strTableName . "_masterkey" . ($i + 1)];
            }
            $rowcount = $eventObj->ListGetRowCount($pageObject->searchClauseObj, $_SESSION[$strTableName . "_mastertable"], $masterKeysReq, $selected_recs, $pageObject);
        }
        if ($rowcount !== false) {
            $numrows = $rowcount;
        } else {
            $numrows = SQLQuery::gSQLRowCount_int($gQuery->HeadToSql(), $gQuery->FromToSql() . $joinFromPart, $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $strWhereClause, $strHavingClause, $pageObject->connection, $strSearchCriteria);
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:31,代码来源:DimArea_export.php

示例5: buildSQL

 /**
  * Builds SQL query, for retrieve data from DB
  *
  */
 function buildSQL()
 {
     $this->gstrOrderBy = $this->gQuery->OrderByToSql();
     $this->gsqlHead = $this->gQuery->HeadToSql();
     $this->gsqlFrom = $this->gQuery->FromToSql();
     $this->gsqlWhereExpr = $this->gQuery->WhereToSql();
     $this->gsqlGroupBy = $this->gQuery->GroupByToSql();
     $this->gsqlHaving = $this->gQuery->Having()->toSql($gQuery);
     $agregateFields = $this->pSet->getListOfFieldsByExprType(true);
     $this->searchClauseObj->haveAgregateFields = count($agregateFields) > 0;
     $searchWhereClause = $this->searchClauseObj->getWhere($this->pSet->getListOfFieldsByExprType(false), $this->controls);
     $searchHavingClause = $this->searchClauseObj->getWhere($agregateFields, $this->controls);
     $this->strWhereClause = whereAdd($this->strWhereClause, $searchWhereClause);
     $this->strHavingClause = whereAdd($this->strHavingClause, $searchHavingClause);
     $strSecuritySql = SecuritySQL("Search", $this->tName);
     $this->strWhereClause = whereAdd($this->strWhereClause, $strSecuritySql);
     if ($this->noRecordsFirstPage && !count($_GET) && !count($_POST)) {
         $this->strWhereClause = whereAdd($this->strWhereClause, "1=0");
     }
     //add where clause with foreign keys of current table and it's master table master keys
     $where = $this->addWhereWithMasterTable();
     $this->strWhereClause = whereAdd($this->strWhereClause, $where);
     if ($this->dbType == nDATABASE_DB2) {
         $this->gsqlHead .= ", ROW_NUMBER() over () as DB2_ROW_NUMBER  ";
     }
     $this->strSearchCriteria = postvalue('criteria');
     if ($this->searchClauseObj->isUsedSearchFor && !$this->searchClauseObj->isUsedFieldsForSearch) {
         $this->strSearchCriteria = "or";
     }
     $strSQL = SQLQuery::gSQLWhere_having($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause, $this->strSearchCriteria);
     //	order by
     $strSQL .= " " . trim($this->strOrderBy);
     //	save SQL for use in "Export" and "Printer-friendly" pages
     $_SESSION[$this->sessionPrefix . "_sql"] = $strSQL;
     $_SESSION[$this->sessionPrefix . "_where"] = $this->strWhereClause;
     $_SESSION[$this->sessionPrefix . "_having"] = $this->strHavingClause;
     $_SESSION[$this->sessionPrefix . "_criteria"] = $this->strSearchCriteria;
     $_SESSION[$this->sessionPrefix . "_order"] = $this->strOrderBy;
     //	select and display records
     $this->addMasterDetailSubQuery();
     $strSQLbak = $strSQL;
     if ($this->eventExists("BeforeQueryList")) {
         $tstrWhereClause = $this->strWhereClause;
         $tstrOrderBy = $this->strOrderBy;
         $this->eventsObject->BeforeQueryList($strSQL, $tstrWhereClause, $tstrOrderBy, $this);
         $this->strWhereClause = $tstrWhereClause;
         $this->strOrderBy = $tstrOrderBy;
     }
     //	Rebuild SQL if needed
     if ($strSQL != $strSQLbak) {
         //	changed $strSQL - old style
         $this->numRowsFromSQL = GetRowCount($strSQL);
     } else {
         $strSQL = SQLQuery::gSQLWhere_having($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause, $this->strSearchCriteria);
         $strSQL .= " " . trim($this->strOrderBy);
         $rowcount = false;
         if ($this->eventExists("ListGetRowCount")) {
             $rowcount = $this->eventsObject->ListGetRowCount($this->searchClauseObj, $this->masterTable, $this->masterKeysReq, null, $this);
         }
         if ($rowcount !== false) {
             $this->numRowsFromSQL = $rowcount;
         } else {
             $this->numRowsFromSQL = SQLQuery::gSQLRowCount_int($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause, $this->strSearchCriteria);
         }
     }
     LogInfo($strSQL);
     $this->querySQL = $strSQL;
 }
开发者ID:aagusti,项目名称:padl-tng,代码行数:72,代码来源:listpage.php

示例6: calcRowCount

 protected function calcRowCount()
 {
     global $gQuery;
     $strSQLbak = $this->sqlParts["sql"];
     $sql = $this->sqlParts["sql"];
     $where = $this->sqlParts["where"];
     $orderby = $this->sqlParts["orderby"];
     if ($this->eventsObject->exists("BeforeQueryPrint")) {
         $this->eventsObject->BeforeQueryPrint($sql, $where, $orderby, $this);
     }
     //	Rebuild SQL if needed
     if ($sql != $strSQLbak) {
         //	changed $strSQL - old style
         $this->totalRowCount = GetRowCount($sql, $this->connection);
         return;
     }
     // rebuild sql
     $this->sqlParts["where"] = $where;
     $this->sqlParts["orderby"] = $orderby;
     $this->sqlParts["sql"] = SQLQuery::gSQLWhere_having($gQuery->HeadToSql(), $gQuery->FromToSql() . $this->sqlParts["join"], $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $this->sqlParts["where"], $this->sqlParts["having"], $this->sqlParts["searchCriteria"]);
     $this->sqlParts["sql"] .= " " . trim($this->sqlParts["orderby"]);
     if ($this->eventsObject->exists("ListGetRowCount")) {
         $this->totalRowCount = $this->eventsObject->ListGetRowCount($this->searchClauseObj, $this->masterTable, $this->masterKeys, $this->selectedRecords, $this);
     }
     if ($this->totalRowCount === false) {
         $this->totalRowCount = SQLQuery::gSQLRowCount_int($gQuery->HeadToSql(), $gQuery->FromToSql() . $this->sqlParts["join"], $gQuery->WhereToSql(), $gQuery->GroupByToSql(), $gQuery->Having()->toSql($gQuery), $this->sqlParts["where"], $this->sqlParts["having"], $this->connection, $this->sqlParts["searchCriteria"]);
     }
 }
开发者ID:kcallow,项目名称:MatchMe,代码行数:28,代码来源:printpage.php

示例7: GetRowCount

    print '  -  ID #' . $objRow[$strPkColumnName] . '  -  ' . $objRow['strAddress1'] . ' ' . $objRow['strCity'] . "\r\n";
    ParentPagerAddress::CreateOrUpdateForMsSqlRow($objRow);
}
///////////////////////////
// ParentPager Child Records
////////////////////////////
$strTableName = 'tblChildInStationHistory';
$strPkColumnName = 'lngChildHistoryID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    printf('[%6s/%6s]', $intCurrentRow++, $intRowCount);
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    print '  -  ID #' . $objRow[$strPkColumnName] . "\r\n";
    ParentPagerChildHistory::CreateOrUpdateForMsSqlRow($objRow);
}
///////////////////////////
// ParentPager Volunteer Records
////////////////////////////
$strTableName = 'tblAttendantInStationHistory';
$strPkColumnName = 'lngAttendantHistoryID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    printf('[%6s/%6s]', $intCurrentRow++, $intRowCount);
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    print '  -  ID #' . $objRow[$strPkColumnName] . "\r\n";
    ParentPagerAttendantHistory::CreateOrUpdateForMsSqlRow($objRow);
}
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:get-data.cli.php

示例8: buildSQL

 /**
  * Builds SQL query, for retrieve data from DB
  *
  */
 function buildSQL()
 {
     global $gQuery;
     $searchWhereClause = $this->searchClauseObj->getWhere(GetListOfFieldsByExprType(false, $this->tName));
     $searchHavingClause = $this->searchClauseObj->getWhere(GetListOfFieldsByExprType(true, $this->tName));
     $this->strWhereClause = whereAdd($this->strWhereClause, $searchWhereClause);
     $this->strHavingClause = whereAdd($this->strHavingClause, $searchHavingClause);
     $strSecuritySql = SecuritySQL("Search", $this->tName);
     $this->strWhereClause = whereAdd($this->strWhereClause, $strSecuritySql);
     if ($this->noRecordsFirstPage && !count($_GET) && !count($_POST)) {
         $this->strWhereClause = whereAdd($this->strWhereClause, "1=0");
     }
     //add where clause with foreign keys of current table and it's master table master keys
     $where = $this->addWhereWithMasterTable();
     $this->strWhereClause = whereAdd($this->strWhereClause, $where);
     if ($this->dbType == nDATABASE_DB2) {
         $this->gsqlHead .= ", ROW_NUMBER() over () as DB2_ROW_NUMBER  ";
     }
     $strSQL = gSQLWhere_having($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause);
     //	order by
     $strSQL .= " " . trim($this->strOrderBy);
     //	save SQL for use in "Export" and "Printer-friendly" pages
     $_SESSION[$this->sessionPrefix . "_sql"] = $strSQL;
     $_SESSION[$this->sessionPrefix . "_where"] = $this->strWhereClause;
     $_SESSION[$this->sessionPrefix . "_having"] = $this->strHavingClause;
     $_SESSION[$this->sessionPrefix . "_order"] = $this->strOrderBy;
     $_SESSION[$this->sessionPrefix . "_arrFieldForSort"] = $this->arrFieldForSort;
     $_SESSION[$this->sessionPrefix . "_arrHowFieldSort"] = $this->arrHowFieldSort;
     //	select and display records
     $this->addMasterDetailSubQuery();
     $strSQLbak = $strSQL;
     if ($this->eventExists("BeforeQueryList")) {
         $tstrWhereClause = $this->strWhereClause;
         $tstrOrderBy = $this->strOrderBy;
         $this->eventsObject->BeforeQueryList($strSQL, $tstrWhereClause, $tstrOrderBy);
         $this->strWhereClause = $tstrWhereClause;
         $this->strOrderBy = $tstrOrderBy;
     }
     //	Rebuild SQL if needed
     if ($strSQL != $strSQLbak) {
         //	changed $strSQL - old style
         $this->numRowsFromSQL = GetRowCount($strSQL);
     } else {
         $strSQL = gSQLWhere_having($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause);
         $strSQL .= " " . trim($this->strOrderBy);
         $rowcount = false;
         if ($this->eventExists("ListGetRowCount")) {
             $rowcount = $this->eventsObject->ListGetRowCount($this->searchClauseObj, $this->masterTable, $this->masterKeysReq, null);
         }
         if ($rowcount !== false) {
             $this->numRowsFromSQL = $rowcount;
         } else {
             $this->numRowsFromSQL = gSQLRowCount_int($this->gsqlHead, $this->gsqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause);
         }
     }
     LogInfo($strSQL);
     $this->querySQL = $strSQL;
 }
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:62,代码来源:listpage.php

示例9: buildSQL

 /**
  * Builds SQL query, for retrieve data from DB
  */
 function buildSQL()
 {
     $this->gstrOrderBy = $this->gQuery->OrderByToSql();
     $this->gsqlHead = $this->gQuery->HeadToSql();
     if ($this->connection->dbType == nDATABASE_DB2) {
         $this->gsqlHead .= ", ROW_NUMBER() over () as DB2_ROW_NUMBER ";
     }
     // add to gsqlHead subquery counting the number of details
     $this->addMasterDetailSubQuery();
     $this->gsqlFrom = $this->gQuery->FromToSql();
     $this->gsqlWhereExpr = $this->gQuery->WhereToSql();
     $this->gsqlGroupBy = $this->gQuery->GroupByToSql();
     $this->gsqlHaving = $this->gQuery->Having()->toSql($this->gQuery);
     $whereComponents = $this->getWhereComponents();
     $searchWhere = $whereComponents["searchWhere"];
     $searchHaving = $whereComponents["searchHaving"];
     $joinFromPart = $whereComponents["joinFromPart"];
     $filterWhere = $this->getFiltersWhere();
     $filterHaving = $this->getFiltersHaving();
     //$this->strWhereClause could contain some conditions for a lookup list page so It needs combining with commonWhere
     $sqlWhere = combineSQLCriteria(array($whereComponents["commonWhere"], $filterWhere, $this->strWhereClause));
     $sqlHaving = combineSQLCriteria(array($whereComponents["commonHaving"], $filterHaving));
     $sqlFrom = $this->gsqlFrom . $joinFromPart;
     $strSecuritySql = $this->SecuritySQL("Search", $this->tName);
     // where clause with foreign keys of current table and it's master table master keys
     $masterWhere = $this->getMasterTableSQLClause();
     $this->strWhereClause = combineSQLCriteria(array($searchWhere, $strSecuritySql, $masterWhere, $filterWhere));
     $this->strHavingClause = combineSQLCriteria(array($searchHaving, $filterHaving));
     if ($this->mode != LIST_DETAILS && $this->noRecordsFirstPage && !$this->isRequiredSearchRunning()) {
         $this->strWhereClause = whereAdd($this->strWhereClause, "1=0");
         $sqlWhere = combineSQLCriteria(array($sqlWhere, "1=0"));
     }
     $searchCombineType = $whereComponents["searchUnionRequired"] ? "or" : "and";
     $strSQL = SQLQuery::gSQLWhere_having($this->gsqlHead, $sqlFrom, $sqlWhere, $this->gsqlGroupBy, $sqlHaving, $searchWhere, $searchHaving, $searchCombineType);
     $strSQL .= " " . trim($this->strOrderBy);
     //	save SQL parts to use in "Export" and "Printer-friendly" pages and to get prev\next records
     $_SESSION[$this->sessionPrefix . "_sql"] = $strSQL;
     $_SESSION[$this->sessionPrefix . "_where"] = $this->strWhereClause;
     $_SESSION[$this->sessionPrefix . "_having"] = $this->strHavingClause;
     $_SESSION[$this->sessionPrefix . "_criteria"] = $searchCombineType;
     $_SESSION[$this->sessionPrefix . "_order"] = $this->strOrderBy;
     $_SESSION[$this->sessionPrefix . "_joinFromPart"] = $joinFromPart;
     $strSQLbak = $strSQL;
     $whereModifiedInEvent = false;
     if ($this->eventExists("BeforeQueryList")) {
         $tstrWhereClause = $this->strWhereClause;
         $tstrOrderBy = $this->strOrderBy;
         $this->eventsObject->BeforeQueryList($strSQL, $tstrWhereClause, $tstrOrderBy, $this);
         $whereModifiedInEvent = $tstrWhereClause != $this->strWhereClause;
         $this->strWhereClause = $tstrWhereClause;
         $this->strOrderBy = $tstrOrderBy;
         //	Rebuild SQL if needed
         if ($strSQL != $strSQLbak) {
             //	changed $strSQL - old style
             $this->numRowsFromSQL = GetRowCount($strSQL, $this->connection);
         } else {
             if ($whereModifiedInEvent || $this->strOrderBy != $tstrOrderBy) {
                 $strSQL = SQLQuery::gSQLWhere_having($this->gsqlHead, $sqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause, $searchCombineType);
                 $strSQL .= " " . trim($this->strOrderBy);
             }
         }
     }
     $rowcount = false;
     if ($this->eventExists("ListGetRowCount")) {
         $rowcount = $this->eventsObject->ListGetRowCount($this->searchClauseObj, $this->masterTable, $this->masterKeysReq, null, $this);
     }
     if ($rowcount !== false) {
         $this->numRowsFromSQL = $rowcount;
     } else {
         if ($whereModifiedInEvent) {
             $this->numRowsFromSQL = SQLQuery::gSQLRowCount_int($this->gsqlHead, $sqlFrom, $this->gsqlWhereExpr, $this->gsqlGroupBy, $this->gsqlHaving, $this->strWhereClause, $this->strHavingClause, $this->connection, $searchCombineType);
         } else {
             $this->numRowsFromSQL = SQLQuery::gSQLRowCount_int($this->gsqlHead, $sqlFrom, $sqlWhere, $this->gsqlGroupBy, $sqlHaving, $searchWhere, $searchHaving, $this->connection, $searchCombineType);
         }
     }
     LogInfo($strSQL);
     $this->querySQL = $strSQL;
 }
开发者ID:sdev1,项目名称:CloudStockEnquiry,代码行数:81,代码来源:listpage.php


注:本文中的GetRowCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。