Re: DB_Pager doesnt work with MDB

From: Date: Tue, 04 Jan 2005 19:32:18 +0000
Subject: Re: DB_Pager doesnt work with MDB
References: 1 2 3 4 5  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16599@lists.php.net to get a copy of this message
Well the code obviously doesnt work, but I am not up to speed on how pear code loads factory drivers etc .. All I did was put each function as a contructor in its own class and placed them in a directory structure like Pager/Wrapper/. Pager works well, DB_Pager doesnt, I still need to subclass it to add extra functionality like page statuses. This is just for paging non datagrid stuff, i am starting to use datagrid for datagrid stuff, so checking out the paging options in that too. On 05/01/2005, at 3:27 AM, Lorenzo Alberton wrote:
Hi, electroteque wrote:
On 04/01/2005, at 7:53 PM, Lorenzo Alberton wrote:
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.php
Thanks for the tip off, why the two different Pagers then?
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.
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 -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.general (#16599) next »