lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Javier Guerra Giraldez wrote:

> If you can process your records stream-like (that is, a single record
> or a few contiguous records at a time) is to use multiple return
> values and local variables:
>
> for fldA, fldB, fldC, fldD in iterator(query) do
>   .....
> end
>
> where 'iterator(query)' is some iterator expression that returns the
> separate fields of each record as separate values, without creating a
> table.

You're quite right - I/O will swamp everything else. We'll end up with both an iterator (for both queries and cursors) and direct-access (only for queries).

There's a global that sets the number of records that will be returned with each fetch. Since every fetch is across the network, we're allowing that global to be overridden at the query level. The basic iterator will grab blocks of data behind the scenes. It will also work with cursors. Luckily, I don't know how to write an iterator in Lua that can go forwards and backwards, so I'm ignoring bi-directional cursors.

I have most of the backend written. When I started on the frontend, I bogged down, so I took some advice from the list and starting writing what that would look like. That's when I got stuck with the array access question. I'll keep playing with this until the frontend looks "right" and then I'll write the code for it.

Then I'll know if the backend has to change and only have to code this one more time.

Thanks,
Mike