RevDB / fetching rows

Jan Schenkel janschenkel at yahoo.com
Mon Jan 27 02:23:00 EST 2003


Hi Brian,

In this case, I suggest you have a look at the
revdb_querylist() function. This will produce a list
of lines, and then you can select a series of lines to
work with.

  get revdb_querylist(return,comma,tConnectID,tQuery)
  put line 1 to 100 of it into tFirstResults

It ought to do the trick "when you want to obtain the
data for use but don’t need to retain a reference to
the records that the data came from." 

Hope this helped,

Jan Schenkel.

--- Yennie at aol.com wrote:
> 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,
> > 
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list