[fpc-pascal] Documentation for sqldb
jszcmpr at netspace.net.au
Fri Jun 22 02:43:20 CEST 2007
Joost van der Sluis wrote:
> IN principle you can set ReadOnly to false and ParseSQL to true. That
> way sqldb tries to parse your query. If it's a simple 'select * from
> table' the TSQLQuery will be updateable. It automatically generates
> update/delete and insert queries. For the 'where' clause is uses by
> default the primary key of the table. (That's a setting, upWhereKeyOnly)
> For example: 'delete * from table where pk=:old_pk'
> If you edit some data, those changes will be stored in an updatebuffer.
> With TSQLQuery.CancelUpdates all those changes are lost. But if you
> call .ApplyUpdates, it will execute one query for every changed record.
> (That could be a insert, update or delete query)
So if I change some field values and post the record, that changed data
goes into the update buffer - of TBufDataset ? I should then be able to
accumulate a few changes of these, and then, in code, call
TSQLQuery.ApplyUpdate, and it should be sent to the database ? Should
this also commit at the database level, or do I have to do this ?
(I think I tried this, but didn't pursue it very far, because I wasn't
sure if it even should work)
Would it be feasible / sensible to call ApplyUpdate from an AfterPost
event handler ?
> Those are the basics. If you have questions, ask them here. And if you
> have any time, please document it somewhere on the wiki. ;)
I will, if I get to the point of thinking I understand it enough to not
make a fool of myself!
More information about the fpc-pascal