[dev] [patch] sizelimit in turba sql driver.

Marko Djukic marko at oblo.com
Mon May 26 15:12:08 PDT 2003


matthieu,

thanks for the patch, but i feel like this would be going the wrong way.

i believe the paging would have to be done at the php level and not at the
backend level, for two reasons:
a) to avoid multiple queries to the backend (total results, then the section we
are interested)
b) discrepancies with how different backends would handle paging, so i would
rather have consistent results and handle it at the php level.

and since we are getting the total results anyway, then i'd say it makes more
sense just use php to slice that to the needed page of data.

another thought, php level could perhaps allow us to use Horde_Cache in some way
to speed up queries....?

marko


Quoting Matthieu Foillard <mgf at iota-online.com>:

> This patch add sizelimit just like the ldap driver do.
> It maybe needs some corrections since i'm still not very familiar w/ horde
> dev.
> This patch will allow me to begin the work on the turba paging.
>
> Regards,
> mgf
>
>
> Index: lib/Driver/sql.php
> ===================================================================
> RCS file: /repository/turba/lib/Driver/sql.php,v
> retrieving revision 1.32
> diff -u -3 -p -r1.32 sql.php
> --- lib/Driver/sql.php  25 Apr 2003 03:13:44 -0000      1.32
> +++ lib/Driver/sql.php  16 May 2003 10:11:49 -0000
> @@ -117,6 +117,13 @@ class Turba_Driver_sql extends Turba_Dri
>          $query .= 'FROM ' . $this->_table;
>          $query .= $where;
>
> +        /* Add a sizelimit, if specified. Default is 0, which means no
> limit.
> */
> +        $sizelimit = 0;
> +        if (!empty($this->params['sizelimit'])) {
> +            $sizelimit = $this->params['sizelimit'];
> +           $query = $this->_db->modifyLimitQuery($query, 0, $sizelimit);
> +        }
> +
>          /* Log the query at a DEBUG log level. */
>          Horde::logMessage(sprintf('SQL search by %s: table = %s; query =
> "%s"',
>                                    Auth::getAuth(), $this->_table, $query),
>
> --
> Horde developers mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>




More information about the dev mailing list