Commit 3b303461fb64440ab526eb59e91a392454ef1d76
1 parent
4c277404
Merged in from DEV trunk...
KTS-3389 "Sql limit statement should not use parameters" Fixed. Changed the limit statements to specify the limit and not use parameters (LIMIT ?,?) Committed by: Megan Watson Reviewed by: Conrad Vermeulen Merged in some whitespace differences from DEV trunk. Committed By: Kevin Fourie Reviewed By: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/branches/3.5.3-Branch@8531 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
124 additions
and
145 deletions
lib/browse/PartialQuery.inc.php
| @@ -6,51 +6,51 @@ | @@ -6,51 +6,51 @@ | ||
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2008 KnowledgeTree Inc. | 7 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 8 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 9 | - * | 9 | + * |
| 10 | * This program is free software; you can redistribute it and/or modify it under | 10 | * This program is free software; you can redistribute it and/or modify it under |
| 11 | * the terms of the GNU General Public License version 3 as published by the | 11 | * the terms of the GNU General Public License version 3 as published by the |
| 12 | * Free Software Foundation. | 12 | * Free Software Foundation. |
| 13 | - * | 13 | + * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT | 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 17 | * details. | 17 | * details. |
| 18 | - * | 18 | + * |
| 19 | * You should have received a copy of the GNU General Public License | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | - * | ||
| 22 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | 21 | + * |
| 22 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | * California 94120-7775, or email info@knowledgetree.com. | 23 | * California 94120-7775, or email info@knowledgetree.com. |
| 24 | - * | 24 | + * |
| 25 | * The interactive user interfaces in modified source and object code versions | 25 | * The interactive user interfaces in modified source and object code versions |
| 26 | * of this program must display Appropriate Legal Notices, as required under | 26 | * of this program must display Appropriate Legal Notices, as required under |
| 27 | * Section 5 of the GNU General Public License version 3. | 27 | * Section 5 of the GNU General Public License version 3. |
| 28 | - * | 28 | + * |
| 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 29 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 30 | * these Appropriate Legal Notices must retain the display of the "Powered by | 30 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 31 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 31 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 32 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 33 | - * must display the words "Powered by KnowledgeTree" and retain the original | 33 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 34 | * copyright notice. | 34 | * copyright notice. |
| 35 | * Contributor( s): ______________________________________ | 35 | * Contributor( s): ______________________________________ |
| 36 | * | 36 | * |
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | /* Partial Query | 39 | /* Partial Query |
| 40 | - * | 40 | + * |
| 41 | * Each of the different partial queries handles generating a document and folder | 41 | * Each of the different partial queries handles generating a document and folder |
| 42 | * list. Also handles sorting. | 42 | * list. Also handles sorting. |
| 43 | * | 43 | * |
| 44 | */ | 44 | */ |
| 45 | - | ||
| 46 | -// FIXME API how to handle indicating which other rows need joining | 45 | + |
| 46 | +// FIXME API how to handle indicating which other rows need joining | ||
| 47 | 47 | ||
| 48 | require_once(KT_LIB_DIR . '/util/ktutil.inc'); | 48 | require_once(KT_LIB_DIR . '/util/ktutil.inc'); |
| 49 | require_once(KT_LIB_DIR . '/database/dbutil.inc'); | 49 | require_once(KT_LIB_DIR . '/database/dbutil.inc'); |
| 50 | require_once(KT_LIB_DIR . '/search/searchutil.inc.php'); | 50 | require_once(KT_LIB_DIR . '/search/searchutil.inc.php'); |
| 51 | - | ||
| 52 | -define('XXX_HARDCODE_SIMPLE_FOLDER_SEARCH', true); | ||
| 53 | - | 51 | + |
| 52 | +define('XXX_HARDCODE_SIMPLE_FOLDER_SEARCH', true); | ||
| 53 | + | ||
| 54 | // Abstract base class. | 54 | // Abstract base class. |
| 55 | class PartialQuery { | 55 | class PartialQuery { |
| 56 | var $sPermissionName = 'ktcore.permissions.read'; | 56 | var $sPermissionName = 'ktcore.permissions.read'; |
| @@ -62,29 +62,29 @@ class PartialQuery { | @@ -62,29 +62,29 @@ class PartialQuery { | ||
| 62 | // no batching. just use count. | 62 | // no batching. just use count. |
| 63 | function getFolderCount() { return 0; } | 63 | function getFolderCount() { return 0; } |
| 64 | function getDocumentCount() { return 0; } | 64 | function getDocumentCount() { return 0; } |
| 65 | - | 65 | + |
| 66 | /* Generating the items for the collection requires generating the core of the | 66 | /* Generating the items for the collection requires generating the core of the |
| 67 | - * query, and then adding the columns and tables that are needed to make the | ||
| 68 | - * the sorting work. naturally, this could be somewhat complex, so in order | 67 | + * query, and then adding the columns and tables that are needed to make the |
| 68 | + * the sorting work. naturally, this could be somewhat complex, so in order | ||
| 69 | * to make everything clear, a number of "namespaces" are reserved in the simple | 69 | * to make everything clear, a number of "namespaces" are reserved in the simple |
| 70 | * case. The SearchQuery needs a number of others, and those are discussed there. | 70 | * case. The SearchQuery needs a number of others, and those are discussed there. |
| 71 | - * | 71 | + * |
| 72 | * the sort column should be joined as "sort_col." | 72 | * the sort column should be joined as "sort_col." |
| 73 | * the documents column is joined as "D." | 73 | * the documents column is joined as "D." |
| 74 | * the folders column is joined as "F." | 74 | * the folders column is joined as "F." |
| 75 | * | 75 | * |
| 76 | - * In order to allow the additional table-joins, etc, the "$sJoinClause, $aJoinParams" | 76 | + * In order to allow the additional table-joins, etc, the "$sJoinClause, $aJoinParams" |
| 77 | * should be passed through. This should _completely_ handle the join, and should depend only | 77 | * should be passed through. This should _completely_ handle the join, and should depend only |
| 78 | * on columns that are known to be there. | 78 | * on columns that are known to be there. |
| 79 | * | 79 | * |
| 80 | - * Browse currently has no way to specify additional constraints. For that, | 80 | + * Browse currently has no way to specify additional constraints. For that, |
| 81 | * use SearchQuery or create a new PartialQuery object. | 81 | * use SearchQuery or create a new PartialQuery object. |
| 82 | * | 82 | * |
| 83 | - * The abstraction is not complete, and some amount of understanding about the specific | ||
| 84 | - * query being _created_ is required. Once this is done, minimal changes in the view | 83 | + * The abstraction is not complete, and some amount of understanding about the specific |
| 84 | + * query being _created_ is required. Once this is done, minimal changes in the view | ||
| 85 | * object should be required. | 85 | * object should be required. |
| 86 | - */ | ||
| 87 | - | 86 | + */ |
| 87 | + | ||
| 88 | // with batching. | 88 | // with batching. |
| 89 | function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } | 89 | function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } |
| 90 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } | 90 | function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } |
| @@ -106,7 +106,7 @@ class BrowseQuery extends PartialQuery{ | @@ -106,7 +106,7 @@ class BrowseQuery extends PartialQuery{ | ||
| 106 | $this->oUser = null; | 106 | $this->oUser = null; |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | - | 109 | + |
| 110 | function _getDocumentQuery($aOptions = null) { | 110 | function _getDocumentQuery($aOptions = null) { |
| 111 | $res = KTSearchUtil::permissionToSQL($this->oUser, $this->sPermissionName); | 111 | $res = KTSearchUtil::permissionToSQL($this->oUser, $this->sPermissionName); |
| 112 | if (PEAR::isError($res)) { | 112 | if (PEAR::isError($res)) { |
| @@ -176,16 +176,16 @@ class BrowseQuery extends PartialQuery{ | @@ -176,16 +176,16 @@ class BrowseQuery extends PartialQuery{ | ||
| 176 | if (strpos($sWhere,'WHERE') == 0) | 176 | if (strpos($sWhere,'WHERE') == 0) |
| 177 | { | 177 | { |
| 178 | $sWhere .= ' WHERE '; | 178 | $sWhere .= ' WHERE '; |
| 179 | - } | ||
| 180 | - else | 179 | + } |
| 180 | + else | ||
| 181 | $sWhere .= ' AND '; | 181 | $sWhere .= ' AND '; |
| 182 | - | 182 | + |
| 183 | $sWhere .= 'F.id NOT IN (' . implode(',',$this->exclude_folders) . ')'; | 183 | $sWhere .= 'F.id NOT IN (' . implode(',',$this->exclude_folders) . ')'; |
| 184 | // print $sWhere; | 184 | // print $sWhere; |
| 185 | } | 185 | } |
| 186 | - | ||
| 187 | - | ||
| 188 | - | 186 | + |
| 187 | + | ||
| 188 | + | ||
| 189 | $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id'); | 189 | $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id'); |
| 190 | 190 | ||
| 191 | $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . " AS F $sPermissionJoin $sWhere "; | 191 | $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . " AS F $sPermissionJoin $sWhere "; |
| @@ -194,19 +194,19 @@ class BrowseQuery extends PartialQuery{ | @@ -194,19 +194,19 @@ class BrowseQuery extends PartialQuery{ | ||
| 194 | $aParams[] = $this->folder_id; | 194 | $aParams[] = $this->folder_id; |
| 195 | return array($sQuery, $aParams); | 195 | return array($sQuery, $aParams); |
| 196 | } | 196 | } |
| 197 | - | ||
| 198 | - function getFolderCount() { | 197 | + |
| 198 | + function getFolderCount() { | ||
| 199 | $aOptions = array( | 199 | $aOptions = array( |
| 200 | 'select' => 'count(F.id) AS cnt', | 200 | 'select' => 'count(F.id) AS cnt', |
| 201 | ); | 201 | ); |
| 202 | $aQuery = $this->_getFolderQuery($aOptions); | 202 | $aQuery = $this->_getFolderQuery($aOptions); |
| 203 | if (PEAR::isError($aQuery)) { return 0; } | 203 | if (PEAR::isError($aQuery)) { return 0; } |
| 204 | - | 204 | + |
| 205 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); | 205 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| 206 | return $iRet; | 206 | return $iRet; |
| 207 | } | 207 | } |
| 208 | - | ||
| 209 | - function getDocumentCount() { | 208 | + |
| 209 | + function getDocumentCount() { | ||
| 210 | $aOptions = array( | 210 | $aOptions = array( |
| 211 | 'select' => 'count(D.id) AS cnt', | 211 | 'select' => 'count(D.id) AS cnt', |
| 212 | ); | 212 | ); |
| @@ -215,72 +215,66 @@ class BrowseQuery extends PartialQuery{ | @@ -215,72 +215,66 @@ class BrowseQuery extends PartialQuery{ | ||
| 215 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); | 215 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| 216 | return $iRet; | 216 | return $iRet; |
| 217 | } | 217 | } |
| 218 | - | ||
| 219 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 218 | + |
| 219 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | ||
| 220 | $res = $this->_getFolderQuery(); | 220 | $res = $this->_getFolderQuery(); |
| 221 | if (PEAR::isError($res)) { return array(); } | 221 | if (PEAR::isError($res)) { return array(); } |
| 222 | list($sQuery, $aParams) = $res; | 222 | list($sQuery, $aParams) = $res; |
| 223 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 223 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 224 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; | ||
| 224 | 225 | ||
| 225 | - $sQuery .= ' LIMIT ?, ?'; | ||
| 226 | - $aParams[] = $iBatchStart; | ||
| 227 | - $aParams[] = $iBatchSize; | ||
| 228 | - | ||
| 229 | $q = array($sQuery, $aParams); | 226 | $q = array($sQuery, $aParams); |
| 230 | - | ||
| 231 | - $res = DBUtil::getResultArray($q); | ||
| 232 | - | 227 | + |
| 228 | + $res = DBUtil::getResultArray($q); | ||
| 229 | + | ||
| 233 | return $res; | 230 | return $res; |
| 234 | } | 231 | } |
| 235 | - | ||
| 236 | - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 232 | + |
| 233 | + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | ||
| 237 | $this->sDocumentJoinClause = $sJoinClause; | 234 | $this->sDocumentJoinClause = $sJoinClause; |
| 238 | $this->aDocumentJoinParams = $aJoinParams; | 235 | $this->aDocumentJoinParams = $aJoinParams; |
| 239 | $res = $this->_getDocumentQuery(); | 236 | $res = $this->_getDocumentQuery(); |
| 240 | - if (PEAR::isError($res)) { return array(); } // no permissions | 237 | + if (PEAR::isError($res)) { return array(); } // no permissions |
| 241 | list($sQuery, $aParams) = $res; | 238 | list($sQuery, $aParams) = $res; |
| 242 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 239 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 240 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; | ||
| 243 | 241 | ||
| 244 | - $sQuery .= ' LIMIT ?, ?'; | ||
| 245 | - $aParams[] = $iBatchStart; | ||
| 246 | - $aParams[] = $iBatchSize; | ||
| 247 | - | ||
| 248 | $q = array($sQuery, $aParams); | 242 | $q = array($sQuery, $aParams); |
| 249 | - | ||
| 250 | - $res = DBUtil::getResultArray($q); | ||
| 251 | - | ||
| 252 | - | ||
| 253 | - | 243 | + |
| 244 | + $res = DBUtil::getResultArray($q); | ||
| 245 | + | ||
| 246 | + | ||
| 247 | + | ||
| 254 | return $res; | 248 | return $res; |
| 255 | } | 249 | } |
| 256 | } | 250 | } |
| 257 | 251 | ||
| 258 | // testing class - puts docs/folders into testdocs, testfolders. | 252 | // testing class - puts docs/folders into testdocs, testfolders. |
| 259 | class TestQuery extends PartialQuery{ | 253 | class TestQuery extends PartialQuery{ |
| 260 | - | 254 | + |
| 261 | var $testdocs; | 255 | var $testdocs; |
| 262 | var $testfolders; | 256 | var $testfolders; |
| 263 | 257 | ||
| 264 | - function TestQuery() { | 258 | + function TestQuery() { |
| 265 | $this->testdocs = array(array('id' => 2), array('id' => 3), | 259 | $this->testdocs = array(array('id' => 2), array('id' => 3), |
| 266 | ); | 260 | ); |
| 267 | $this->testfolders = array(array('id' => 3),); | 261 | $this->testfolders = array(array('id' => 3),); |
| 268 | } | 262 | } |
| 269 | - | 263 | + |
| 270 | function getFolderCount() { count($this->testfolders); } | 264 | function getFolderCount() { count($this->testfolders); } |
| 271 | function getDocumentCount() { count($this->testdocs); } | 265 | function getDocumentCount() { count($this->testdocs); } |
| 272 | - | 266 | + |
| 273 | // with batching. | 267 | // with batching. |
| 274 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) { | 268 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) { |
| 275 | return array_slice($this->testfolders, $iBatchStart, $iBatchSize); | 269 | return array_slice($this->testfolders, $iBatchStart, $iBatchSize); |
| 276 | } | 270 | } |
| 277 | - | ||
| 278 | - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) { | 271 | + |
| 272 | + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder) { | ||
| 279 | return array_slice($this->testdocs, $iBatchStart, $iBatchSize); | 273 | return array_slice($this->testdocs, $iBatchStart, $iBatchSize); |
| 280 | } | 274 | } |
| 281 | } | 275 | } |
| 282 | 276 | ||
| 283 | -class SimpleSearchQuery extends PartialQuery { | 277 | +class SimpleSearchQuery extends PartialQuery { |
| 284 | // FIXME cache permission lookups, etc. | 278 | // FIXME cache permission lookups, etc. |
| 285 | var $searchable_text; | 279 | var $searchable_text; |
| 286 | 280 | ||
| @@ -297,10 +291,10 @@ class SimpleSearchQuery extends PartialQuery { | @@ -297,10 +291,10 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 297 | return $res; | 291 | return $res; |
| 298 | } | 292 | } |
| 299 | list($sPermissionString, $aPermissionParams, $sPermissionJoin) = $res; | 293 | list($sPermissionString, $aPermissionParams, $sPermissionJoin) = $res; |
| 300 | - | 294 | + |
| 301 | $temp = str_replace('%', '', $this->searchable_text); | 295 | $temp = str_replace('%', '', $this->searchable_text); |
| 302 | $keywords = explode(' ', $temp); | 296 | $keywords = explode(' ', $temp); |
| 303 | - | 297 | + |
| 304 | for($i=0; $i<count($keywords); $i++){ | 298 | for($i=0; $i<count($keywords); $i++){ |
| 305 | if($keywords[$i] == ' ' or $keywords[$i] == ''){ | 299 | if($keywords[$i] == ' ' or $keywords[$i] == ''){ |
| 306 | continue; | 300 | continue; |
| @@ -309,7 +303,7 @@ class SimpleSearchQuery extends PartialQuery { | @@ -309,7 +303,7 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 309 | } | 303 | } |
| 310 | } | 304 | } |
| 311 | $keywords = $keywords_temp; | 305 | $keywords = $keywords_temp; |
| 312 | - | 306 | + |
| 313 | if(count($keywords) > 1){ | 307 | if(count($keywords) > 1){ |
| 314 | for($i=0; $i<count($keywords); $i++){ | 308 | for($i=0; $i<count($keywords); $i++){ |
| 315 | $keywords[$i] = '%'.$keywords[$i].'%'; | 309 | $keywords[$i] = '%'.$keywords[$i].'%'; |
| @@ -321,7 +315,7 @@ class SimpleSearchQuery extends PartialQuery { | @@ -321,7 +315,7 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 321 | }else{ | 315 | }else{ |
| 322 | $aPotentialWhereString = 'FST.folder_text LIKE ? '; | 316 | $aPotentialWhereString = 'FST.folder_text LIKE ? '; |
| 323 | } | 317 | } |
| 324 | - | 318 | + |
| 325 | $aPotentialWhere = array($sPermissionString, $aPotentialWhereString); | 319 | $aPotentialWhere = array($sPermissionString, $aPotentialWhereString); |
| 326 | $aWhere = array(); | 320 | $aWhere = array(); |
| 327 | foreach ($aPotentialWhere as $sWhere) { | 321 | foreach ($aPotentialWhere as $sWhere) { |
| @@ -340,24 +334,24 @@ class SimpleSearchQuery extends PartialQuery { | @@ -340,24 +334,24 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 340 | 334 | ||
| 341 | $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id'); | 335 | $sSelect = KTUtil::arrayGet($aOptions, 'select', 'F.id'); |
| 342 | 336 | ||
| 343 | - $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . ' AS F | ||
| 344 | - LEFT JOIN ' . KTUtil::getTableName('folder_searchable_text') . " AS FST ON (F.id = FST.folder_id) | 337 | + $sQuery = "SELECT $sSelect FROM " . KTUtil::getTableName('folders') . ' AS F |
| 338 | + LEFT JOIN ' . KTUtil::getTableName('folder_searchable_text') . " AS FST ON (F.id = FST.folder_id) | ||
| 345 | $sPermissionJoin $sWhere "; | 339 | $sPermissionJoin $sWhere "; |
| 346 | if(count($keywords) > 1){ | 340 | if(count($keywords) > 1){ |
| 347 | $aParams = $keywords; | 341 | $aParams = $keywords; |
| 348 | }else{ | 342 | }else{ |
| 349 | $aParams = array($this->searchable_text); | 343 | $aParams = array($this->searchable_text); |
| 350 | } | 344 | } |
| 351 | - | 345 | + |
| 352 | $aParams = kt_array_merge($aPermissionParams, $aParams); | 346 | $aParams = kt_array_merge($aPermissionParams, $aParams); |
| 353 | - | 347 | + |
| 354 | return array($sQuery, $aParams); | 348 | return array($sQuery, $aParams); |
| 355 | } | 349 | } |
| 356 | - | ||
| 357 | - function getFolderCount() { | 350 | + |
| 351 | + function getFolderCount() { | ||
| 358 | // use hack to get folders, if included. | 352 | // use hack to get folders, if included. |
| 359 | if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return 0; } | 353 | if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return 0; } |
| 360 | - | 354 | + |
| 361 | $aOptions = array( | 355 | $aOptions = array( |
| 362 | 'select' => 'count(F.id) AS cnt', | 356 | 'select' => 'count(F.id) AS cnt', |
| 363 | ); | 357 | ); |
| @@ -367,22 +361,19 @@ class SimpleSearchQuery extends PartialQuery { | @@ -367,22 +361,19 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 367 | return $iRet; | 361 | return $iRet; |
| 368 | } | 362 | } |
| 369 | 363 | ||
| 370 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 364 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 371 | if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return array(); } | 365 | if (!XXX_HARDCODE_SIMPLE_FOLDER_SEARCH) { return array(); } |
| 372 | - | 366 | + |
| 373 | $res = $this->_getFolderQuery(); | 367 | $res = $this->_getFolderQuery(); |
| 374 | if (PEAR::isError($res)) { return array(); } | 368 | if (PEAR::isError($res)) { return array(); } |
| 375 | list($sQuery, $aParams) = $res; | 369 | list($sQuery, $aParams) = $res; |
| 376 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 370 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 371 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; | ||
| 377 | 372 | ||
| 378 | - $sQuery .= ' LIMIT ?, ?'; | ||
| 379 | - $aParams[] = $iBatchStart; | ||
| 380 | - $aParams[] = $iBatchSize; | ||
| 381 | - | ||
| 382 | $q = array($sQuery, $aParams); | 373 | $q = array($sQuery, $aParams); |
| 383 | - | ||
| 384 | - $res = DBUtil::getResultArray($q); | ||
| 385 | - | 374 | + |
| 375 | + $res = DBUtil::getResultArray($q); | ||
| 376 | + | ||
| 386 | return $res; | 377 | return $res; |
| 387 | } | 378 | } |
| 388 | 379 | ||
| @@ -401,8 +392,8 @@ class SimpleSearchQuery extends PartialQuery { | @@ -401,8 +392,8 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 401 | $oUser = User::get($_SESSION['userID']); | 392 | $oUser = User::get($_SESSION['userID']); |
| 402 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); | 393 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); |
| 403 | } | 394 | } |
| 404 | - | ||
| 405 | - function getDocumentCount() { | 395 | + |
| 396 | + function getDocumentCount() { | ||
| 406 | $aOptions = array( | 397 | $aOptions = array( |
| 407 | 'select' => 'count(DISTINCT D.id) AS cnt', | 398 | 'select' => 'count(DISTINCT D.id) AS cnt', |
| 408 | ); | 399 | ); |
| @@ -411,13 +402,13 @@ class SimpleSearchQuery extends PartialQuery { | @@ -411,13 +402,13 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 411 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); | 402 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| 412 | return $iRet; | 403 | return $iRet; |
| 413 | } | 404 | } |
| 414 | - | ||
| 415 | - | 405 | + |
| 406 | + | ||
| 416 | // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing | 407 | // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing |
| 417 | // later. | 408 | // later. |
| 418 | // | 409 | // |
| 419 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. | 410 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. |
| 420 | - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 411 | + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 421 | $this->sDocumentJoinClause = $sJoinClause; | 412 | $this->sDocumentJoinClause = $sJoinClause; |
| 422 | $this->aDocumentJoinParams = $aJoinParams; | 413 | $this->aDocumentJoinParams = $aJoinParams; |
| 423 | $aOptions = array( | 414 | $aOptions = array( |
| @@ -428,14 +419,11 @@ class SimpleSearchQuery extends PartialQuery { | @@ -428,14 +419,11 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 428 | if (PEAR::isError($res)) { return array(); } | 419 | if (PEAR::isError($res)) { return array(); } |
| 429 | list($sQuery, $aParams) = $res; | 420 | list($sQuery, $aParams) = $res; |
| 430 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 421 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 431 | - $sQuery .= ' LIMIT ?, ?'; | ||
| 432 | - | ||
| 433 | - $aParams[] = $iBatchStart; | ||
| 434 | - $aParams[] = $iBatchSize; | 422 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; |
| 435 | 423 | ||
| 436 | $q = array($sQuery, $aParams); | 424 | $q = array($sQuery, $aParams); |
| 437 | 425 | ||
| 438 | - $res = DBUtil::getResultArray($q); | 426 | + $res = DBUtil::getResultArray($q); |
| 439 | 427 | ||
| 440 | return $res; | 428 | return $res; |
| 441 | } | 429 | } |
| @@ -443,7 +431,7 @@ class SimpleSearchQuery extends PartialQuery { | @@ -443,7 +431,7 @@ class SimpleSearchQuery extends PartialQuery { | ||
| 443 | 431 | ||
| 444 | class TypeBrowseQuery extends SimpleSearchQuery { | 432 | class TypeBrowseQuery extends SimpleSearchQuery { |
| 445 | var $iDocType; | 433 | var $iDocType; |
| 446 | - | 434 | + |
| 447 | function TypeBrowseQuery($oDocType) { | 435 | function TypeBrowseQuery($oDocType) { |
| 448 | $this->iDocType = $oDocType->getId(); | 436 | $this->iDocType = $oDocType->getId(); |
| 449 | } | 437 | } |
| @@ -463,17 +451,17 @@ class TypeBrowseQuery extends SimpleSearchQuery { | @@ -463,17 +451,17 @@ class TypeBrowseQuery extends SimpleSearchQuery { | ||
| 463 | $oUser = User::get($_SESSION['userID']); | 451 | $oUser = User::get($_SESSION['userID']); |
| 464 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); | 452 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); |
| 465 | } | 453 | } |
| 466 | - | 454 | + |
| 467 | // don't do folder searching | 455 | // don't do folder searching |
| 468 | function getFolderCount() { return 0; } | 456 | function getFolderCount() { return 0; } |
| 469 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } | 457 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } |
| 470 | } | 458 | } |
| 471 | 459 | ||
| 472 | class ValueBrowseQuery extends SimpleSearchQuery { | 460 | class ValueBrowseQuery extends SimpleSearchQuery { |
| 473 | var $sFieldNamespace; | 461 | var $sFieldNamespace; |
| 474 | var $sValueName; | 462 | var $sValueName; |
| 475 | - | ||
| 476 | - function ValueBrowseQuery($oField, $oValue) { | 463 | + |
| 464 | + function ValueBrowseQuery($oField, $oValue) { | ||
| 477 | $this->sFieldNamespace = $oField->getNamespace(); | 465 | $this->sFieldNamespace = $oField->getNamespace(); |
| 478 | $this->sValueName = $oValue->getName(); | 466 | $this->sValueName = $oValue->getName(); |
| 479 | } | 467 | } |
| @@ -493,24 +481,24 @@ class ValueBrowseQuery extends SimpleSearchQuery { | @@ -493,24 +481,24 @@ class ValueBrowseQuery extends SimpleSearchQuery { | ||
| 493 | $oUser = User::get($_SESSION['userID']); | 481 | $oUser = User::get($_SESSION['userID']); |
| 494 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); | 482 | return KTSearchUtil::criteriaToQuery($aCriteriaSet, $oUser, 'ktcore.permissions.read', $aOptions); |
| 495 | } | 483 | } |
| 496 | - | 484 | + |
| 497 | // don't do folder searching | 485 | // don't do folder searching |
| 498 | function getFolderCount() { return 0; } | 486 | function getFolderCount() { return 0; } |
| 499 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } | 487 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { return array(); } |
| 500 | } | 488 | } |
| 501 | 489 | ||
| 502 | -class BooleanSearchQuery extends PartialQuery { | 490 | +class BooleanSearchQuery extends PartialQuery { |
| 503 | // FIXME cache permission lookups, etc. | 491 | // FIXME cache permission lookups, etc. |
| 504 | var $datavars; | 492 | var $datavars; |
| 505 | 493 | ||
| 506 | function BooleanSearchQuery($datavars) { $this->datavars = $datavars; } | 494 | function BooleanSearchQuery($datavars) { $this->datavars = $datavars; } |
| 507 | - | ||
| 508 | - function getFolderCount() { | 495 | + |
| 496 | + function getFolderCount() { | ||
| 509 | // never any folders, given the current fulltext environ. | 497 | // never any folders, given the current fulltext environ. |
| 510 | return 0; | 498 | return 0; |
| 511 | } | 499 | } |
| 512 | 500 | ||
| 513 | - function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 501 | + function getFolders($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 514 | return array(); | 502 | return array(); |
| 515 | } | 503 | } |
| 516 | 504 | ||
| @@ -518,8 +506,8 @@ class BooleanSearchQuery extends PartialQuery { | @@ -518,8 +506,8 @@ class BooleanSearchQuery extends PartialQuery { | ||
| 518 | $oUser = User::get($_SESSION['userID']); | 506 | $oUser = User::get($_SESSION['userID']); |
| 519 | return KTSearchUtil::criteriaToQuery($this->datavars, $oUser, 'ktcore.permissions.read', $aOptions); | 507 | return KTSearchUtil::criteriaToQuery($this->datavars, $oUser, 'ktcore.permissions.read', $aOptions); |
| 520 | } | 508 | } |
| 521 | - | ||
| 522 | - function getDocumentCount() { | 509 | + |
| 510 | + function getDocumentCount() { | ||
| 523 | $aOptions = array( | 511 | $aOptions = array( |
| 524 | 'select' => 'count(DISTINCT D.id) AS cnt', | 512 | 'select' => 'count(DISTINCT D.id) AS cnt', |
| 525 | ); | 513 | ); |
| @@ -528,13 +516,13 @@ class BooleanSearchQuery extends PartialQuery { | @@ -528,13 +516,13 @@ class BooleanSearchQuery extends PartialQuery { | ||
| 528 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); | 516 | $iRet = DBUtil::getOneResultKey($aQuery, 'cnt'); |
| 529 | return $iRet; | 517 | return $iRet; |
| 530 | } | 518 | } |
| 531 | - | ||
| 532 | - | 519 | + |
| 520 | + | ||
| 533 | // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing | 521 | // search needs some special stuff... this should probably get folded into a more complex criteria-driven thing |
| 534 | // later. | 522 | // later. |
| 535 | // | 523 | // |
| 536 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. | 524 | // we also leak like ---- here, since getting the score is ... fiddly. and expensive. |
| 537 | - function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { | 525 | + function getDocuments($iBatchSize, $iBatchStart, $sSortColumn, $sSortOrder, $sJoinClause = null, $aJoinParams = null) { |
| 538 | $this->sDocumentJoinClause = $sJoinClause; | 526 | $this->sDocumentJoinClause = $sJoinClause; |
| 539 | $this->aDocumentJoinParams = $aJoinParams; | 527 | $this->aDocumentJoinParams = $aJoinParams; |
| 540 | $aOptions = array( | 528 | $aOptions = array( |
| @@ -545,14 +533,11 @@ class BooleanSearchQuery extends PartialQuery { | @@ -545,14 +533,11 @@ class BooleanSearchQuery extends PartialQuery { | ||
| 545 | if (PEAR::isError($res)) { return array(); } | 533 | if (PEAR::isError($res)) { return array(); } |
| 546 | list($sQuery, $aParams) = $res; | 534 | list($sQuery, $aParams) = $res; |
| 547 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 535 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 548 | - $sQuery .= ' LIMIT ?, ?'; | 536 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; |
| 549 | 537 | ||
| 550 | - $aParams[] = $iBatchStart; | ||
| 551 | - $aParams[] = $iBatchSize; | ||
| 552 | - | ||
| 553 | $q = array($sQuery, $aParams); | 538 | $q = array($sQuery, $aParams); |
| 554 | - $res = DBUtil::getResultArray($q); | ||
| 555 | - | 539 | + $res = DBUtil::getResultArray($q); |
| 540 | + | ||
| 556 | return $res; | 541 | return $res; |
| 557 | } | 542 | } |
| 558 | } | 543 | } |
lib/ktentity.inc
| @@ -8,31 +8,31 @@ | @@ -8,31 +8,31 @@ | ||
| 8 | * Document Management Made Simple | 8 | * Document Management Made Simple |
| 9 | * Copyright (C) 2008 KnowledgeTree Inc. | 9 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 10 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 10 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 11 | - * | 11 | + * |
| 12 | * This program is free software; you can redistribute it and/or modify it under | 12 | * This program is free software; you can redistribute it and/or modify it under |
| 13 | * the terms of the GNU General Public License version 3 as published by the | 13 | * the terms of the GNU General Public License version 3 as published by the |
| 14 | * Free Software Foundation. | 14 | * Free Software Foundation. |
| 15 | - * | 15 | + * |
| 16 | * This program is distributed in the hope that it will be useful, but WITHOUT | 16 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 18 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 19 | * details. | 19 | * details. |
| 20 | - * | 20 | + * |
| 21 | * You should have received a copy of the GNU General Public License | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | - * | ||
| 24 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | 23 | + * |
| 24 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 25 | * California 94120-7775, or email info@knowledgetree.com. | 25 | * California 94120-7775, or email info@knowledgetree.com. |
| 26 | - * | 26 | + * |
| 27 | * The interactive user interfaces in modified source and object code versions | 27 | * The interactive user interfaces in modified source and object code versions |
| 28 | * of this program must display Appropriate Legal Notices, as required under | 28 | * of this program must display Appropriate Legal Notices, as required under |
| 29 | * Section 5 of the GNU General Public License version 3. | 29 | * Section 5 of the GNU General Public License version 3. |
| 30 | - * | 30 | + * |
| 31 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 31 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 32 | * these Appropriate Legal Notices must retain the display of the "Powered by | 32 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 33 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 33 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 34 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 34 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 35 | - * must display the words "Powered by KnowledgeTree" and retain the original | 35 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 36 | * copyright notice. | 36 | * copyright notice. |
| 37 | * Contributor( s): ______________________________________ | 37 | * Contributor( s): ______________________________________ |
| 38 | */ | 38 | */ |
| @@ -456,12 +456,9 @@ class KTEntityUtil { | @@ -456,12 +456,9 @@ class KTEntityUtil { | ||
| 456 | $iLimit = $aOptions['limit']; | 456 | $iLimit = $aOptions['limit']; |
| 457 | 457 | ||
| 458 | if ($iOffset) { | 458 | if ($iOffset) { |
| 459 | - $aWhereClause[0] .= " LIMIT ?, ?"; | ||
| 460 | - $aWhereClause[1][] = $iOffset; | ||
| 461 | - $aWhereClause[1][] = $iLimit; | 459 | + $aWhereClause[0] .= " LIMIT $iOffset, $iLimit"; |
| 462 | } else { | 460 | } else { |
| 463 | - $aWhereClause[0] .= " LIMIT ?"; | ||
| 464 | - $aWhereClause[1][] = $iLimit; | 461 | + $aWhereClause[0] .= " LIMIT $iLimit"; |
| 465 | } | 462 | } |
| 466 | } | 463 | } |
| 467 | 464 |
plugins/tagcloud/TagCloudUtil.inc.php
| @@ -7,31 +7,31 @@ | @@ -7,31 +7,31 @@ | ||
| 7 | * Document Management Made Simple | 7 | * Document Management Made Simple |
| 8 | * Copyright (C) 2008 KnowledgeTree Inc. | 8 | * Copyright (C) 2008 KnowledgeTree Inc. |
| 9 | * Portions copyright The Jam Warehouse Software (Pty) Limited | 9 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 10 | - * | 10 | + * |
| 11 | * This program is free software; you can redistribute it and/or modify it under | 11 | * This program is free software; you can redistribute it and/or modify it under |
| 12 | * the terms of the GNU General Public License version 3 as published by the | 12 | * the terms of the GNU General Public License version 3 as published by the |
| 13 | * Free Software Foundation. | 13 | * Free Software Foundation. |
| 14 | - * | 14 | + * |
| 15 | * This program is distributed in the hope that it will be useful, but WITHOUT | 15 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 17 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 17 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 18 | * details. | 18 | * details. |
| 19 | - * | 19 | + * |
| 20 | * You should have received a copy of the GNU General Public License | 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | - * | ||
| 23 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | 22 | + * |
| 23 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 24 | * California 94120-7775, or email info@knowledgetree.com. | 24 | * California 94120-7775, or email info@knowledgetree.com. |
| 25 | - * | 25 | + * |
| 26 | * The interactive user interfaces in modified source and object code versions | 26 | * The interactive user interfaces in modified source and object code versions |
| 27 | * of this program must display Appropriate Legal Notices, as required under | 27 | * of this program must display Appropriate Legal Notices, as required under |
| 28 | * Section 5 of the GNU General Public License version 3. | 28 | * Section 5 of the GNU General Public License version 3. |
| 29 | - * | 29 | + * |
| 30 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 30 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 31 | * these Appropriate Legal Notices must retain the display of the "Powered by | 31 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 32 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | 32 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the |
| 33 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 33 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 34 | - * must display the words "Powered by KnowledgeTree" and retain the original | 34 | + * must display the words "Powered by KnowledgeTree" and retain the original |
| 35 | * copyright notice. | 35 | * copyright notice. |
| 36 | * Contributor( s): ______________________________________ | 36 | * Contributor( s): ______________________________________ |
| 37 | * | 37 | * |
| @@ -234,10 +234,7 @@ class TagQuery extends PartialQuery | @@ -234,10 +234,7 @@ class TagQuery extends PartialQuery | ||
| 234 | if (PEAR::isError($res)) { return array(); } | 234 | if (PEAR::isError($res)) { return array(); } |
| 235 | list($sQuery, $aParams) = $res; | 235 | list($sQuery, $aParams) = $res; |
| 236 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; | 236 | $sQuery .= ' ORDER BY ' . $sSortColumn . ' ' . $sSortOrder . ' '; |
| 237 | - $sQuery .= ' LIMIT ?, ?'; | ||
| 238 | - | ||
| 239 | - $aParams[] = $iBatchStart; | ||
| 240 | - $aParams[] = $iBatchSize; | 237 | + $sQuery .= " LIMIT $iBatchStart, $iBatchSize"; |
| 241 | 238 | ||
| 242 | $q = array($sQuery, $aParams); | 239 | $q = array($sQuery, $aParams); |
| 243 | $res = DBUtil::getResultArray($q); | 240 | $res = DBUtil::getResultArray($q); |