use-revolution digest, Vol 1 #1063 - 17 msgs

Yennie at aol.com Yennie at aol.com
Sun Jan 26 12:32:00 EST 2003


Hi,

This is true, but I don't think it really requires a SQL solution. 

Since RevDB supports buildling a database cursor (revdb_query), it doesn't 
make sense to me that it can't return a subset of rows. I can't even ask a 
cursor for the _current_ row without iterating through all of the columns. On 
the other hand, revdb_querylist returns rows- but always ALL of them. I can 
always manually trim the list afterwards, but this is also awfully 
inefficient in the case where I am forced to load 5,000 records and then trim 
them down to 50.

Shouldn't there be a simple revdb_getrows() function to go with 
revdb_getcolumnxxx()? Certainly revdb can do something more efficient than 
forcing the scripter to iterate columns with a cursor. Imagine fetching rows 
1000 to 1100 out of 2000 in a 20 column results. I would have to iterate over 
1,000 records, and fetch each of 20 columns 100 times- that's 3,000 calls to 
revdb!

Even if revdb couldn't do anything much more efficient internally (which I 
doubt), it would at least run much faster and save the scripter a lot of 
headaches.

Has anyone had this same problem, or found a reasonable workaround?

Regards,
Brian

Regards,
Brian

> Hi Brian,
> 
> Unfortunately, ANSI-SQL doesn't have a native solution
> for that: you get all the records that fall within the
> conditions of the WHERE-clause.
> 
> However, MySQL provides an extension to the standard
> syntax - 'LIMIT' - which will do what you want. Eg:
>   SELECT cust_id, cust_name FROM customer WHERE
>      cust_id >= theCurrentId LIMIT 100
> would get you the first 100 customers with an ID
> higher than or equal to the one in theCurrentID.
> 
> Other databases _may_ support the same syntax, or
> provide their own similar extension. But as they say:
> your mileage may vary...
> 
> Hope this helped,
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030126/1356e7e3/attachment.html>


More information about the use-livecode mailing list