Re: DB_Pager doesnt work with MDB
| From: | Lorenzo Alberton | Date: | Tue, 04 Jan 2005 16:27:14 +0000 |
| Subject: | Re: DB_Pager doesnt work with MDB | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16588@lists.php.net to get a copy of this message | ||
Hi,
electroteque wrote:
On 04/01/2005, at 7:53 PM, Lorenzo Alberton wrote:originally, DB_Pager and Pager had different scopes/goals. The first was DB-oriented, the latter was array-oriented. Recently, I added the wrapper to show a possible way of efficiently using Pager with db results too.no need to alter anything: there's an example with each pear DBAL (DB, MDB and MDB2): http://cvs.php.net/co.php/pear/Pager/examples/Pager_Wrapper.phpThanks for the tip off, why the two different Pagers then?
Here is my modified proposal, its just noodlings
class Pager_Wrapper extends Pager
{
function Pager_Wrapper($driver,$db,$query, $pagerOptions)
{
require_once('Pager/Wrapper/'.$driver.'.php');
if (class_exists('Pager_Wrapper_'.$driver)) {
return new {'Pager_Wrapper' . $driver}($db,$query, $pagerOptions);
}
}
}
I put the wrappers in the /examples/ dir because
it's meant to be just a proposed implementation,
not TheUltimateWrapper(TM). YMMV => if you prefer
creating a class, then feel free to do so :)
Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo