Hi, I’m using couchbase lite 2.0 for Android. Take a look at this, after these 3 lines:
Log.d(TAG, "insert: before " + newTask.getLong(myId));
mDatabase.save(newTask);
Log.d(TAG, “insert: after” + newTask.getLong(myId));
Outputs for example:
insert: before 11989091
insert: after -4788125
insert: before 231548688
insert: after 0
But there are many other long that works. Can you help with this?
jens
October 3, 2017, 4:21pm
2
That’s almost certainly an encoder bug that was fixed on August 23rd. I don’t know which version of CBL Android incorporates the fix, but I would think it’s fixed in the latest build. (@hideki ?) What build are you using?
hideki
October 3, 2017, 4:43pm
3
Hi @itai.shalom2 ,
What DB version of CBL 2.0.0 are you using? Latest build (DB017) is built with the latest litecore module which has this fix.
I added another unit test with the value you are using. Latest code can handle these large long values.
//https://www.couchbase.com/forums/t/long-value-on-document-changed-after-saved-to-db/14259/
@Test
public void testLargeLongValue2() throws CouchbaseLiteException {
MutableDocument doc = createDocument("test");
long num1 = 11989091L;
long num2 = 231548688L;
doc.setValue("num1", num1);
doc.setValue("num2", num2);
doc = save(doc).toMutable();
Log.i(TAG, "num1 long -> " + doc.getLong("num1"));
Log.i(TAG, "num2 long -> " + doc.getLong("num2"));
assertEquals(num1, doc.getLong("num1"));
assertEquals(num2, doc.getLong("num2"));
}
Thanks
jens
October 3, 2017, 6:56pm
4
The fix is already in DB16; I just verified this.