} if (!$mypage) { $mypage = 1; } $strSQL = AddTop($strSQL, $mypage * $nPageSize); } } $listarray = false; if ($eventObj->exists("ListQuery")) { $listarray = $eventObj->ListQuery($pageObject->searchClauseObj, $_SESSION[$strTableName . "_arrFieldForSort"], $_SESSION[$strTableName . "_arrHowFieldSort"], $_SESSION[$strTableName . "_mastertable"], $masterKeysReq, $selected_recs, $nPageSize, $mypage); } if ($listarray !== false) { $rs = $listarray; } elseif ($nPageSize > 0) { $rs = db_query($strSQL, $conn); db_pageseek($rs, $nPageSize, $mypage); } else { $rs = db_query($strSQL, $conn); } if (!ini_get("safe_mode")) { set_time_limit(300); } if (substr(@$_REQUEST["type"], 0, 5) == "excel") { // remove grouping $locale_info["LOCALE_SGROUPING"] = "0"; $locale_info["LOCALE_SMONGROUPING"] = "0"; ExportToExcel(); } else { if (@$_REQUEST["type"] == "word") { ExportToWord(); } else {
/** * Seeks recs, depending on page number etc. * * @param string $strSQL */ function seekPageInRecSet($strSQL) { $listarray = false; if ($this->eventExists("ListQuery")) { $arrFieldForSort = array(); $arrHowFieldSort = array(); for ($i = 0; $i < count($this->orderClause->fieldsList); $i++) { $arrFieldForSort[] = $this->orderClause->fieldsList[$i]->fieldIndex; $arrHowFieldSort[] = $this->orderClause->fieldsList[$i]->orderDirection; } $listarray = $this->eventsObject->ListQuery($this->searchClauseObj, $arrFieldForSort, $arrHowFieldSort, $this->masterTable, $this->masterKeysReq, null, $this->pageSize, $this->myPage, $this); } if ($listarray !== false) { $this->recSet = $listarray; } else { if ($this->dbType == nDATABASE_MySQL) { if ($this->maxPages > 1) { $strSQL .= " limit " . ($this->myPage - 1) * $this->pageSize . "," . $this->pageSize; } $this->recSet = db_query($strSQL, $this->conn); } elseif ($this->dbType == nDATABASE_MSSQLServer) { if ($this->maxPages > 1) { $strSQL = AddTop($strSQL, $this->myPage * $this->pageSize); } $this->recSet = db_query($strSQL, $this->conn); db_pageseek($this->recSet, $this->pageSize, $this->myPage); } elseif ($this->dbType == nDATABASE_Access) { if ($this->maxPages > 1) { $strSQL = AddTop($strSQL, $this->myPage * $this->pageSize); } $this->recSet = db_query($strSQL, $this->conn); db_pageseek($this->recSet, $this->pageSize, $this->myPage); } elseif ($this->dbType == nDATABASE_Oracle) { if ($this->maxPages > 1) { $strSQL = AddRowNumber($strSQL, $this->myPage * $this->pageSize); } $this->recSet = db_query($strSQL, $this->conn); db_pageseek($this->recSet, $this->pageSize, $this->myPage); } elseif ($this->dbType == nDATABASE_PostgreSQL) { if ($this->maxPages > 1) { $maxrecs = $this->pageSize; $strSQL .= " limit " . $this->pageSize . " offset " . ($this->myPage - 1) * $this->pageSize; } $this->recSet = db_query($strSQL, $this->conn); } elseif ($this->dbType == nDATABASE_DB2) { if ($this->maxPages > 1) { $strSQL = "with DB2_QUERY as (" . $strSQL . ") select * from DB2_QUERY where DB2_ROW_NUMBER between " . (($this->myPage - 1) * $this->pageSize + 1) . " and " . $this->myPage * $this->pageSize; } $this->recSet = db_query($strSQL, $this->conn); } elseif ($this->dbType == nDATABASE_Informix) { if ($this->maxPages > 1) { $strSQL = AddTopIfx($strSQL, $this->myPage * $this->pageSize); } $this->recSet = db_query($strSQL, $this->conn); db_pageseek($this->recSet, $this->pageSize, $this->myPage); } elseif ($this->dbType == nDATABASE_SQLite3) { if ($this->maxPages > 1) { $strSQL .= " limit " . ($this->myPage - 1) * $this->pageSize . "," . $this->pageSize; } $this->recSet = db_query($strSQL, $this->conn); } else { $this->recSet = db_query($strSQL, $this->conn); db_pageseek($this->recSet, $this->pageSize, $this->myPage); } } }