Your workflow is unique šØāš» - tell us how you use Dropbox here.
Forum Discussion
Raheel S.
11 years agoExplorer | Level 3
Offtopic: To Check or Not to check for duplication. (DBDatastores)
This is purely off topic. Not dropbox related at all, but really this is a sync design question. (if this is against the rules, My apologies to the mods).
I've been struggling with an idea to avoi...
Raheel S.
11 years agoExplorer | Level 3
Hey Steve!
Yea I fully utilise getOrInsert. It works okay. The above scenario is not really about Datastore handling but After I do receive those DBRecords. In essence its about handling duplication locally. I don't use LocalDatastores.
Heres what I do.
I have a local db where I store recordID and the text. ( yes i don't use localDatastores, aah, for some reasons).
For Incoming DBRecord: (At Sync)
- I check if recordID already exists, if yes, I update the
localDb.record.text = record[@"text"]. If it does not exist, I create a New row in mylocalDBwith thatrecordIDandtext. This is fine. The uniqueness of a DBRecord is therecord["text"]; thats it.
I save the recordID and text field on the localDB.
Ok great.
Now, I open up This very same DBRecord. I want to update the text of this very DBRecord. I don't want to create a new one. I want to update this DBRecord. I already know its recordID, because I stored it on my localDB.
I get that DBRecord using getOrInsert, and I update the record["text1"] field (text --> text1). And sure enough the record is updated with new data. BUT, it is here that the relationship between recordID and the text field has become invalid. When this DBRecord was created`, the recordID == md5("text"). NOW: md5("text1") != recordID.
Next time, When I create a new record with text1 (like importing from the same file) that is equal to the text1 from above; I potentially created a duplicate DBRecord.
- I know that text1 exists already in a DBRecord.
- But I cannot avoid duplication by looking for md5(text1).
- that DBRecord has an Older md5(text), but text was later updated to text1.
I want to be able to give my self a choice to avoid this kind of duplication. What would you guys do here?
Its way early morning right now. I hope what i wrote is understandable. This isn't a datastore problem. Its my problem :/
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!