1) Eof() works in FWH1909.
2) You can also use the method Eval() in FWH1909, instead of writing do while loop.
oData:Eval( { |Self| ::state := "NY" } )
3) From your sample, I understand that you want to read a batch of records from the table, Edit, Modify, Delete. Append all in the memory only and finally, if decide to save, save all the changes at once or discard all changes.
This process is extremely simplified in FWH1909. You can read a query directly into TArrayData object without first reading into a RowSet,
Please build and test this sample:
#include "fivewin.ch"
function Main()
local oCn, oData, oRs
oCn := FW_DemoDB()
oData := TArrayData():New( oCn, "SELECT id, first, state, age from customer WHERE state = 'NY'" )
// Edit/Modify/Delete/Append
XBROWSER oData FASTEDIT
if MsgYesNo( "Save Changes?" )
oData:SaveData()
? "Changes saved"
else
? "Changes ignored"
endif
// Check the changes
oRs := oCn:RowSet( "SELECT id, first, state, age from customer WHERE state = 'NY'" )
XBROWSER oRs
return nil
You can directly read data from mysql/mariadb server into TArrayData using any of the following syntax:
oData := TArrayData():New( oCn, cTableName, [cWhere] )
//OR
oData := TArrayData():New( oCn, cSql, [aParams] )