If no changes, yet do commit, does database get overwritten anyway? lazarus / 16-Databases ---------------------------------------------------------------------- Elmug · 2012-06-19 21:19 Hi everyone, Windows 7, PosgreSQL. I have a little learning-application, which reads data from a table into a grid box. I can make changes on any of the fields, and to commit the changes I have a Commit button, which does work and save the data as changed. I am wondering, though, if I don't edit the data, I just look at it, and I do press the commit button, does the database get updated, anyway, even if no changes were done? The table does have a primary key. Why I am asking is because I am not clear if the built-in intelligence updates only the fields that have changed. In other word, also, since the grid shows only like 3 rows, and if I only edit in one of them, then I push the Commit button, does only the modified row get updated in the database, or do all rows in the dataset get updated regardless? Thanks for helping clear this out. ---------------------------------------------------------------------- Lacak2 · 2012-06-20 05:25 Quote from: Elmug on June 19, 2012, 11:19:24 pmIn other word, also, since the grid shows only like 3 rows, and if I only edit in one of them, then I push the Commit button, does only the modified row get updated in the database, or do all rows in the dataset get updated regardless? What is behind your Commit button ? When you ApplyUpdates, then local updates are applied-"send" to database. It means, no unmodified rows are not handled. So if you change 1 row, then 1 SQL update is performed in background when you use ApplyUpdates. (which columns - fields are included in update SET ... depends on fields ProviderFlag, these which have pfInUpdate these are included) ---------------------------------------------------------------------- Elmug · 2012-06-20 05:37 Thanks for helping Lacak2, The button runs ApplyUpdates. And I gather from your reply that only the rows that have been locally modified are actually updated in the database, as part of the ApplyUpdates method. If not so, then please correct me. Thanks again. ---------------------------------------------------------------------- Lacak2 · 2012-06-21 05:46 Quote from: Elmug on June 20, 2012, 07:37:14 amAnd I gather from your reply that only the rows that have been locally modified are actually updated in the database, as part of the ApplyUpdates method. Right ---------------------------------------------------------------------- Elmug · 2012-06-21 14:14 Thanks, Lacak2. I've since also found documentation that the Lazarus DB mechanisms keep a log of what's modified,  and the commit is based on that log. I thank you for helping out.