GitHub Issue | n/a |
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-04-08T23:11:48.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2014 Sprint 07 SDK, Release 3.3.0 |
Components | Android |
Labels | exalture, module_database, qe-closed-3.3.0, qe-testadded |
Reporter | Grambo |
Assignee | Sunila |
Created | 2011-04-15T03:43:34.000+0000 |
Updated | 2014-05-05T11:17:56.000+0000 |
On android, when running the following select statement: "PRAGMA user_version=5;" the user_version is never updated. The same statement works fine when manually ran through sqlite3.
I've looked into the code in TiDatabaseProxy.java and it seems that any pragma statements are automatically put through the rawQuery function, which shouldn't be used for queries that insert data.
Seems that the fix for ticket TIMOB-2147 probably introduced this issue.
I've attached a patch that I think should fix the issue, although I've not tested it yet as I don't have a proper build environment set up for titanium mobile.
This is not an iOS, but Android issue. Attached patch seems to work.
Execute PRAGMA statements using execSQL if it has = https://github.com/appcelerator/titanium_mobile/pull/5540
Test case After executing the code, TITLE should have value 5 var db = Ti.Database.open('mydb'); db.execute("PRAGMA user_version=5;"); var user_version = db.execute("PRAGMA user_version;"); if(user_version.getRowCount()){ do{ Ti.API.info("##### TITLE: "+user_version.field(0)); var user_version = user_version.next(); Ti.API.info('## Next: '+user_version); }while( user_version ); }
Verified with: Appc-Studio:3.3.0.201405011408 sdk:3.3.0.v20140502133323 acs:1.0.14 alloy:1.4.0-dev npm:1.3.2 titanium:3.3.0-dev titanium-code-processor:1.1.1 xcode:5.1.1 Device:Iphone5(7.1),LG-P970(V4.0.4)
Used the above mentioned test code and getting the expected output.