Commit 4ca7aa6237d3ce02518c73bd26ab27f654bcd988
1 parent
8b2508f1
Make use of the DocumentJoinClause and DocumentJoinParams in BrowseQuery
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4954 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
7 additions
and
3 deletions
lib/browse/PartialQuery.inc.php
| @@ -93,13 +93,15 @@ class BrowseQuery extends PartialQuery{ | @@ -93,13 +93,15 @@ class BrowseQuery extends PartialQuery{ | ||
| 93 | $sQuery = sprintf("SELECT %s FROM %s AS D | 93 | $sQuery = sprintf("SELECT %s FROM %s AS D |
| 94 | LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id | 94 | LEFT JOIN %s AS DM ON D.metadata_version_id = DM.id |
| 95 | LEFT JOIN %s AS DC ON DM.content_version_id = DC.id | 95 | LEFT JOIN %s AS DC ON DM.content_version_id = DC.id |
| 96 | + %s | ||
| 96 | %s %s", | 97 | %s %s", |
| 97 | $sSelect, KTUtil::getTableName("documents"), | 98 | $sSelect, KTUtil::getTableName("documents"), |
| 98 | KTUtil::getTableName("document_metadata_version"), | 99 | KTUtil::getTableName("document_metadata_version"), |
| 99 | KTUtil::getTableName("document_content_version"), | 100 | KTUtil::getTableName("document_content_version"), |
| 100 | - $sPermissionJoin, $sWhere); | 101 | + $this->sDocumentJoinClause, $sPermissionJoin, $sWhere); |
| 101 | $aParams = array(); | 102 | $aParams = array(); |
| 102 | - $aParams = array_merge($aParams, $aPermissionParams); | 103 | + $aParams = array_merge($aParams, $this->aDocumentJoinParams); |
| 104 | + $aParams = array_merge($aParams, $aPermissionParams); | ||
| 103 | $aParams[] = $this->folder_id; | 105 | $aParams[] = $this->folder_id; |
| 104 | return array($sQuery, $aParams); | 106 | return array($sQuery, $aParams); |
| 105 | } | 107 | } |
| @@ -174,11 +176,13 @@ class BrowseQuery extends PartialQuery{ | @@ -174,11 +176,13 @@ class BrowseQuery extends PartialQuery{ | ||
| 174 | } | 176 | } |
| 175 | 177 | ||
| 176 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 178 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 179 | + $this->sDocumentJoinClause = $sJoinClause; | ||
| 180 | + $this->aDocumentJoinParams = $aJoinParams; | ||
| 177 | $res = $this->_getDocumentQuery(); | 181 | $res = $this->_getDocumentQuery(); |
| 178 | if (PEAR::isError($res)) { return array(); } // no permissions | 182 | if (PEAR::isError($res)) { return array(); } // no permissions |
| 179 | list($sQuery, $aParams) = $res; | 183 | list($sQuery, $aParams) = $res; |
| 180 | $sQuery .= " ORDER BY " . $sSortColumn . " " . $sSortOrder . " "; | 184 | $sQuery .= " ORDER BY " . $sSortColumn . " " . $sSortOrder . " "; |
| 181 | - | 185 | + |
| 182 | $sQuery .= " LIMIT ?, ?"; | 186 | $sQuery .= " LIMIT ?, ?"; |
| 183 | $aParams[] = $iBatchStart; | 187 | $aParams[] = $iBatchStart; |
| 184 | $aParams[] = $iBatchSize; | 188 | $aParams[] = $iBatchSize; |