From 488931fac1ccc2b0c5e278bc7498cd42ed2835a8 Mon Sep 17 00:00:00 2001 From: rurban Date: Sat, 20 Nov 2004 17:49:39 +0000 Subject: [PATCH] add fast exclude support to SQL get_all_pages git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@4160 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/WikiDB/backend/ADODB.php | 15 +++++++++++---- lib/WikiDB/backend/PearDB.php | 16 +++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/WikiDB/backend/ADODB.php b/lib/WikiDB/backend/ADODB.php index 0da3e4a2a..4a9d0a938 100644 --- a/lib/WikiDB/backend/ADODB.php +++ b/lib/WikiDB/backend/ADODB.php @@ -1,5 +1,5 @@ page_tbl_field_list); } - function get_all_pages($include_empty=false, $sortby=false, $limit=false, $exclude='') { + function get_all_pages($include_empty=false, $sortby=false, $limit=false, $exclude=false) { $dbh = &$this->_dbh; extract($this->_table_names); $orderby = $this->sortby($sortby, 'db'); if ($orderby) $orderby = 'ORDER BY ' . $orderby; - //TODO: convert comma-sep glob to sql-style: _sql_match_clause - if ($exclude) $exclude = "pagename not like ".$this->_dbh->qstr($exclude); + if ($exclude) // array of pagenames + $exclude = " AND $page_tbl.pagename NOT IN ".$this->_sql_set($exclude); //$dbh->SetFetchMode(ADODB_FETCH_ASSOC); if (strstr($orderby, 'mtime ')) { // was ' mtime' if ($include_empty) { @@ -1240,6 +1240,13 @@ extends WikiDB_backend_ADODB_generic_iter } // $Log: not supported by cvs2svn $ +// Revision 1.53 2004/11/20 17:35:58 rurban +// improved WantedPages SQL backends +// PageList::sortby new 3rd arg valid_fields (override db fields) +// WantedPages sql pager inexact for performance reasons: +// assume 3 wantedfrom per page, to be correct, no getTotal() +// support exclude argument for get_all_pages, new _sql_set() +// // Revision 1.52 2004/11/17 20:07:17 rurban // just whitespace // diff --git a/lib/WikiDB/backend/PearDB.php b/lib/WikiDB/backend/PearDB.php index 767a92922..405e866cc 100644 --- a/lib/WikiDB/backend/PearDB.php +++ b/lib/WikiDB/backend/PearDB.php @@ -1,5 +1,5 @@ _dbh; extract($this->_table_names); - // Limit clause is NOT portable! - // if ($limit) $limit = "LIMIT $limit"; - // else $limit = ''; $orderby = $this->sortby($sortby, 'db'); if ($orderby) $orderby = 'ORDER BY ' . $orderby; + if ($exclude) // array of pagenames + $exclude = " AND $page_tbl.pagename NOT IN ".$this->_sql_set($exclude); if (strstr($orderby, 'mtime ')) { // multiple columns possible if ($include_empty) { $sql = "SELECT " @@ -1080,6 +1079,13 @@ extends WikiDB_backend_PearDB_generic_iter } // $Log: not supported by cvs2svn $ +// Revision 1.68 2004/11/20 17:35:58 rurban +// improved WantedPages SQL backends +// PageList::sortby new 3rd arg valid_fields (override db fields) +// WantedPages sql pager inexact for performance reasons: +// assume 3 wantedfrom per page, to be correct, no getTotal() +// support exclude argument for get_all_pages, new _sql_set() +// // Revision 1.67 2004/11/10 19:32:24 rurban // * optimize increaseHitCount, esp. for mysql. // * prepend dirs to the include_path (phpwiki_dir for faster searches) -- 2.45.0