Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12012] SQLite fieldCount() Crashes on iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-12-11T20:55:24.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 25, 2012 Sprint 25 API
ComponentsCore, iOS
Labelsdatabase, qe-testadded, triage
ReporterRick Blalock
AssigneeIngo Muschenetz
Created2012-12-10T12:54:37.000+0000
Updated2014-06-19T12:42:50.000+0000

Description

In 3.0 RC2 iOS crashes when trying to use fieldCount(). If changed to just fieldCount (the property) it works. Previously fieldCount as a property wasn't supported in iOS but I see it's available now (http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Database.ResultSet-property-fieldCount). Probably was a parity issue that was fixed but in the process causes this crash. The code that makes it crash (from the Joli ORM lib on github): if (Titanium.Platform.name !== 'android') { fieldCount = rows.fieldCount; } else { fieldCount = rows.fieldCount(); }

Comments

  1. Vishal Duggal 2012-12-11

    PR's https://github.com/appcelerator/titanium_mobile/pull/3575 https://github.com/appcelerator/titanium_mobile/pull/3576 Reverted fixes for ticket TIMOB-2328
  2. Sabil Rahim 2013-01-14

    TESTING CODE

       var win = Ti.UI.createWindow();
       win.open();
         
       var db = Titanium.Database.open('testdb');
         
       db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST (ID INTEGER, NAME TEXT)');
         
       db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',1,'Name 1');
       db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',2,'Name 2');
       db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',3,'Name 3');
       db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)',4,'Name 4');
         
       var rows = db.execute('SELECT * FROM DATABASETEST');
         
       Ti.API.info("If this didnot crash then you r fine !! fieldCount: " + rows.fieldCount);
       Titanium.API.info('ROW COUNT = ' + rows.getRowCount());
       
  3. Olga Romero 2013-01-15

    Closing as fixed. Tested and verified with: Titanium Studio, build: 3.0.1.201212181159 Titanium SDK, build: 3.1.0.v20130114171802 Titanium SDK, build: 3.0.1.v20130114133207 iPhone Simulator 6.0 iPhone 5 iOS 6.0 iPhone 4 iOS 4.3.5

JSON Source