jaydata
jaydata copied to clipboard
Regular Expression Parse Error on SqLiteProvider.js
JayData: 1.1.1 Android: 2.3.4
The first time the application executes fine. But the second time, it throws a javascript error and hangs. We track the error to a database creation strategy.
Basically, the RegEx.exec(...) javascript function was returning "null", not matter if the regular expression was right. It must be an Android bug, but we had to fix it to make it work on the actual Android device.
Until now, we didn't notice, because we were developing and testing in Chrome.
So, to fix the error we changed the .exec() function by the .match() function. This way, the provider works well on desktop Chrome and the Android device.
Hope this can help. By the way, is there a roadmap or some information about the next stable release?
Thanks and keep up the good work!
SqLiteProvider.js:619
@@ -614,12 +614,12 @@ $data.Class.define('$data.dbClient.DbCommand', null, null,
var data = regEx.exec(that.SqlCommands[i]);
if (data) {
var tableName = data[1];
var tableDef = data[2];
if (existObjectInDB[tableName.slice(1, tableName.length - 1)]) {
- var existsRegEx = /^CREATE TABLE ([^ ]*) (\(.*\))/g;
- var existTableDef = existsRegEx.exec(existObjectInDB[tableName.slice(1, tableName.length - 1)].sql)[2];
+ var existsRegExMatches = existObjectInDB[tableName.slice(1, tableName.length - 1)].sql.match(/\([\s\S]*\)/g);
+ var existTableDef = existsRegExMatches[0];
if (tableDef.toLowerCase() != existTableDef.toLowerCase()) {
deleteCmd.push("DROP TABLE IF EXISTS [" + existObjectInDB[tableName.slice(1, tableName.length - 1)].tbl_name + "];");
}
}
}
Thank you so much for resolving this. I am running your change through the tests and then merge it to the dev brench if all is well.
A short roadmap is as follows: we are releasing 1.2 at the 10th of Sept. This have a couple of important SqLite fixes (include expression on navProperties has broken since v2 of the ModelBinder). but is generally an OData and server side release, also has many fixes around the core.
After the 1.2 release, a massive update to SqLite provider is scheduled - released as 1.2.1. This will contain better 1-n querying and some limited mapping capabilities (so that you could use JayData with existing models) plus at least a hundred man hour of use case tests and device tests. So 24th the Sept will give you a much improved SqLite provider. Also 1.2.1 will have stress on the SqLite provider server side usage and that will surely bring up the concurrency issues if there's still any.
Again, we thank you your efforst on making JayData better, please contact us or me directly if any further issues arise, or post the issue here as before.
best Peter
Hi @PeterAronZentai, @PeterAronZentai , Could you please confirm if this issue has been resolved by merging the fix dev branch? Thank, R
Hi @francovitali any updates? can we close this issue?