Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3380] Android: PRAGMA statements that set data don't work

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-04-08T23:11:48.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 07 SDK, Release 3.3.0
ComponentsAndroid
Labelsexalture, module_database, qe-closed-3.3.0, qe-testadded
ReporterGrambo
AssigneeSunila
Created2011-04-15T03:43:34.000+0000
Updated2014-05-05T11:17:56.000+0000

Description

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.

Attachments

FileDateSize
titanium_pragma_fix.patch2011-04-15T03:43:34.000+00001044

Comments

  1. Mark Ruys 2013-05-29

    This is not an iOS, but Android issue. Attached patch seems to work.
  2. Sunila 2014-03-27

    Execute PRAGMA statements using execSQL if it has = https://github.com/appcelerator/titanium_mobile/pull/5540
  3. Sunila 2014-04-08

    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 ); }
  4. Priya Agarwal 2014-05-05

    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)
  5. Priya Agarwal 2014-05-05

    Used the above mentioned test code and getting the expected output.

JSON Source