-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReactNative SQLite error: UNIQUE constraint failed: attach-store.digest #6037
Comments
My suspicion is that this is related to the ReactNative SQLite adapter and not PouchDB. The reason I suggest that is that we have run our full test suite using: - node-websql However react-native-sqlite-storage is based on Cordova-sqlite-storage which in my experience has had many bugs and has often failed our test suite (it's largely why I wrote cordova-plugin-sqlite-2). Could you please run your same test in another SQL-esque implementation (WebSQL, node-websql, cordova-plugin-sqlite-2) and see if the issue persists? If not, then I would guess it's related to react-native-sqlite-storage. Alternatively, if you can find a test that fails in regular WebSQL, then please provide that test and we will fix it in |
I made another SQLite module for react native which code base is borrowed from your cordova-plugin-sqlite-2. Thanks |
Hey, that's awesome! I was hoping it would be useful to extend and use in
other environments. :)
…-----
Nolan Lawson
http://nolanlawson.com
https://github.com/nolanlawson
On Mar 22, 2017 7:17 PM, "Takuya Matsuyama" ***@***.***> wrote:
I made another SQLite module for react native which code base is borrowed
from your cordova-plugin-sqlite-2
<https://github.com/nolanlawson/cordova-plugin-sqlite-2>.
It works pretty well!
https://github.com/noradaiko/react-native-sqlite-2
Thanks
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6037 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARUwjYkbqPkVWvvB6ipSl78AArBDiT9ks5rodZVgaJpZM4LR1I1>
.
|
I added a mention of your project to the node-websql readme. 😃 By the way, do you still consider it "unstable for storing PouchDB's attachments" (as you say in the readme?). I've run PouchDB's attachment test suite against node-websql and cordova-plugin-sqlite-2 (both Android and iOS) and it passes, so it may be something wrong with the React Native bindings? |
I'm glad! I mean that it's unstable with |
Hi, thanks for making such a great library!
I'd like to post an issue regarding
pouchdb-adapter-websql-core
.Issue
Can't store multiple documents with same attachment data.
The replication process retrieves docs from
_changes
feed so multiple attachments are potentially saved at once.If these have same md5 digest, it will produce an error:
UNIQUE constraint failed: attach-store.digest
.Seems like
saveAttachment
is ignoring existing attachment but not working in this case:https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-websql-core/src/bulkDocs.js#L302
I guess the reason is that attachments are stored in
forEach
loop where each process doesn't wait for storing the previous attachment:https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-websql-core/src/bulkDocs.js#L212
Info
Reproduce
Sync with multiple attachments with same md5digest.
I encountered this problem while making a SQLite adapter for ReactNative.
The text was updated successfully, but these errors were encountered: