A recordset is a collection of “DatabaseRecord” objects? right?
if so, is there a way to access the actual DatabaseRecord for each row in a recordset?
NOT the fields within the record, but the WHOLE databaserecord, so it can be transfered to an array in order to be accessed in a random manner, since the Database cursor is limited to MoveFirst, MoveNext, MovePrevious, MoveLast
I want to emulate MoveTo
in fact only movenext is supported in any database plugin. the other are database dependant.
don’t try to emulate moveto, it will be too slow for any later database operation.
and to have a databaserecord, you will have to create it yourself, and iterate through the recordset to re-create it.
No
There is no “record” just the “current record” (which isn’t a DatabaseRecord)
And you access the current record via the field & idxfield accessors
DatabaseRecord is for INPUT only
[quote=328445:@Jean-Yves Pochez]in fact only movenext is supported in any database plugin. the other are database dependant.
don’t try to emulate moveto, it will be too slow for any later database operation.
and to have a databaserecord, you will have to create it yourself, and iterate through the recordset to re-create it.[/quote]
Which is why I was hoping to move the data into another type “container”
I cannot use OFFSET and LIMIT due to the fact I have no control over the SQL statement being processed, so simply tacking those statements on the end might result in a Syntax Error in the SQL …
But then (lightbulb coming on!) this might work!
wrap the USERS SQL inside another Statement
SELECT * FROM (users sql statement) offset 100,limit 100
wouldn’t it?
do you have example(s) where appending offset and limit at the end of a select statement would get a syntax error ?
Yes, where the input sql already has offset or limit.
User inputs
SELECT * FROM myTABLE LIMIT 1000
I tack on my own Limit and end up with
SELECT * FROM myTABLE LIMIT 1000 LIMIT 2000
but I think (as above) that this will work
SELECT * FROM (select from mytable limit 1000) limit 2000
of course it will only return the lesser of the two limits but it remains a viable SQL statement
with some simple regex it’s easy to check for offset or limit already present in the select statement.
are there other bad select statements ?
Why bother… the solution I outlined is the better alternative.
Sure RegEx can find those options… but I need to apply a SPECIFIC offset and limit, regardless of what the user said
and in the case that they DID specifiy something, than what I append needs to be a SUBSET of their selection, not a replacement