tidev / appcelerator.encrypteddatabase

An encrypted version of the Ti.Database namespace
https://titaniumsdk.com/api/modules/encrypteddatabase.html
Other
5 stars 2 forks source link

null values are read as 127 #269

Open cmtanko opened 2 years ago

cmtanko commented 2 years ago

Problem:

but same when I fetch from collection as

 var actionCollection = Alloy.createCollection("Action");
 unsyncActionCollection.fetch({
        query: "SELECT * FROM Action where id=22"
 });
console.warn(unsyncActionCollection.models);

I get this instead attributes: { uuid: '1f699926-68fc-4069-921d-873de4fcf93e', id: 22, application_id: 4, action_text: 'Action for regulatory notification 1', actionee_id: 1, due_date: '2028-04-28', closed_date: 127, status: 'Open', created_at: '2022-02-01 07:48:00', updated_at: '2022-02-01 07:48:00', created_by: 127, modified_by: 127, form_record_id: 127, form_record_uuid: 127, requires_sync: 127, deleted: 127, linked_form_version_id: 127, linked_form_record_id: 127, linked_form_record_uuid: 127, inform_question_uuid: 127, is_inform_inline_action: 127 }

So, there is conflict datas, Any thoughts whats the issue here ?

m1ga commented 2 years ago

it should be null according to https://github.com/tidev/appcelerator.encrypteddatabase/blob/master/android/src/appcelerator/encrypteddatabase/TiResultSetProxy.java#L108-L110

There is a test case at https://jira-archive.titaniumsdk.com/MOD/MOD-2598 and a workaround for other field types. But in that example the null value worked fine too. It would be interesting to know if the normal SQL/db way will return the correct results