You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off: thanks for the wonderful work on this project. It is practically magic watching it work. I am using sqlite_crdt in a yet-to-be-released notes app with a specific workflow for people working on a number of creative projects at once.
I encountered a problem with my implementation (not in the framework itself) that didn't seem obvious to me so I figured I would make a post to explain and/or confirm that this is the behavior I was experiencing.
TL;DR: Is it correct to say: use .execute for operations which update data so that the modified field is updated. Using .query to update data does not change the modified field and so changes will not be merged as expected.
Long version:
I converted existing code from using sqflite and therefore had to convert a lot of .insert and .update statements to using either .execute or .query. I incorrectly assumed the two were essentially interchangeable and didn't pay too much attention to which one was used in each case. Most operations worked as expected and it was like magic watching notes sync between devices. However one particular operation -- moving notes from one notebook to another -- just didn't seem to work right.
After ensuring that I was awaiting everything correctly (per warnings in the docs) and that the logic in the implementation was the same as pre-conversion I did a lot of testing to confirm that everything was updating as expected in every other case except this one. I eventually found that the only difference was that other operations to modify data were using .execute but for no real reason this one operation was using .query to perform a UPDATE notes SET notebookId=?1 WHERE... type of statement. The notebookId was getting updated, but the modified field -- which is controlled by the Crdt framework -- was not being updated. The result was that this type of change was not syncing as expected. Changing to using .execute worked to correct the issue and the app is now happily progressing towards release.
Just in case anyone is curious about my implementation: I'm uploading databases from multiple devices to a single folder in Google Drive and then pulling down all available databases and syncing individually on each device. This lets users of the app keep notes synced between devices without having to provide any backend infrastructure of my own. Future plans will allow for the storage backend to be completely agnostic so Dropbox, S3, P2P or whatever could be used.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
First off: thanks for the wonderful work on this project. It is practically magic watching it work. I am using
sqlite_crdtin a yet-to-be-released notes app with a specific workflow for people working on a number of creative projects at once.I encountered a problem with my implementation (not in the framework itself) that didn't seem obvious to me so I figured I would make a post to explain and/or confirm that this is the behavior I was experiencing.
TL;DR: Is it correct to say: use
.executefor operations which update data so that themodifiedfield is updated. Using.queryto update data does not change themodifiedfield and so changes will not be merged as expected.Long version:
I converted existing code from using
sqfliteand therefore had to convert a lot of.insertand.updatestatements to using either.executeor.query. I incorrectly assumed the two were essentially interchangeable and didn't pay too much attention to which one was used in each case. Most operations worked as expected and it was like magic watching notes sync between devices. However one particular operation -- moving notes from one notebook to another -- just didn't seem to work right.After ensuring that I was
awaiting everything correctly (per warnings in the docs) and that the logic in the implementation was the same as pre-conversion I did a lot of testing to confirm that everything was updating as expected in every other case except this one. I eventually found that the only difference was that other operations to modify data were using.executebut for no real reason this one operation was using.queryto perform aUPDATE notes SET notebookId=?1 WHERE...type of statement. The notebookId was getting updated, but themodifiedfield -- which is controlled by the Crdt framework -- was not being updated. The result was that this type of change was not syncing as expected. Changing to using.executeworked to correct the issue and the app is now happily progressing towards release.Just in case anyone is curious about my implementation: I'm uploading databases from multiple devices to a single folder in Google Drive and then pulling down all available databases and syncing individually on each device. This lets users of the app keep notes synced between devices without having to provide any backend infrastructure of my own. Future plans will allow for the storage backend to be completely agnostic so Dropbox, S3, P2P or whatever could be used.
All reactions