[Zope-dev] Zope 2.6 planning - call for contributors!

Andy Dustman andy@dustman.net
01 Mar 2002 14:45:38 -0500


On Fri, 2002-03-01 at 04:16, Dario Lopez-K=E4sten wrote:
> I'd like to see ZSQL methods altered so that bind variables could be used=
 in
> SQL queries.

+1, even though MySQL doesn't bind variables (yet, apparently in the
works for 4.0).

Another thing I would like (and could probably write) is an additional
skip_rows parameter (default 0) to Z SQL Methods to complement max_rows.
Since this needs to be passed to the DA's query(), and no DA's currently
accept this parameter, one of these things need to happen:

1) Trap the TypeError that results from calling a query() that doesn't
recognize skip_rows (used as a keyword parameter). In that case, fall
back to query(q, max_rows+skip_rows) and return result[skip_rows:] in
the Z SQL Method.

2) Add a new DA method query_range(q, skip_rows, max_rows); if
AttributeError, fall back like #1.

3) Simply require all DA's to implement it in query() as a keyword
parameter to maintain backwards compatibility with older Zopes.

Adding this would make Z SQL Methods work a bit more like <dtml-in ...
start=3Dskip_rows size=3Dmax_rows>. There may be issues with result caching=
,
but I don't think it'll be too much of a problem.

--=20
Andy Dustman         PGP: 0x930B8AB6
    @       .net     http://dustman.net/andy
You can have my keys when you pry them from my dead, cold neurons.