[TIMOB-2328] Android: Database - ResultSet.fieldCount method on iOS (as per APIDOCs) but property on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2014-05-02T20:22:10.000+0000 |
Affected Version/s | Release 1.6.0, Release 1.8.0.1, Release 3.0.0 |
Fix Version/s | n/a |
Components | TiAPI |
Labels | api, parity, qe-port |
Reporter | Deniss Fedotovs |
Assignee | Hieu Pham |
Created | 2011-04-15T03:16:52.000+0000 |
Updated | 2017-03-23T18:04:19.000+0000 |
Description
1. Run this code on both iOS/Android and make sure there's no error on both platforms.
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("fieldCount: " + rows.getFieldCount());
Ti.API.info("fieldCount: " + rows.fieldCount);
rows.close();
db.close();
Issue persists in Mobile SDK 1.5.1 as well.
Looks like we need to API scrub the database module.
There are multiple reports of this, so it's clearly a very problematic parity issue for folks. We need to choose whether this should be a method or a property and fix it.
Tested on a Samsung Galaxy S2 and on the iOS simulator using TiSDK 2.2.0v20120821095711, issue still valid.
fieldCount should be a read-only property across all platforms. We will modify iOS current behavior and update the doc. Appropriate uses of fieldCount: 1. x.fieldCount. 2. x.getFieldCount().
Verified on: SDK:2.2.0.v20120828153312 Studio:2.1.2.201208281351 Devices: LG-p970(v 2.2.2)
We need to revisit this issue as the original fix for this breaks almost all of our existing modules, which led to reverting the fix in PR [3575](https://github.com/appcelerator/titanium_mobile/pull/3575)
Closing ticket as duplicate with reference to the linked issues above.