Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-940] ResultSet should not point to the first row

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2011-04-15T02:39:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsresultset
ReporterHwerglmir
AssigneeReggie Seagraves
Created2011-04-15T02:39:42.000+0000
Updated2017-03-09T21:22:44.000+0000

Description

If I execute a SELECT it returns a ResultSet which is already pointing to the first row. So a while(rs.next()) loop is always skipping the first row. with a do while I'm eventually accessing an invalid row (if I don't check with isValidRow). Wouldn't it be better to point the ResultSet pointer to the "beforeFirst" row , like the ResultSet in java?

Comments

  1. Jeff Haynie 2011-04-15

    We modeled this after the Google Gears DB API (see http://code.google.com/apis/gears/api_database.html#ResultSet)">http://code.google.com/apis/gears/api_database.html#ResultSet).

    The code should be something like:

       var rows = db.execute('SELECT * FROM DATABASETEST');
       while (rows.isValidRow())
       {
           Titanium.API.info('ID: ' + rows.field(0) + ' NAME: ' + rows.fieldByName('name'));
           rows.next();
       }
       rows.close();
       

    This effectively is the same as JDBC as long as you're using isValidRow() as your loop condition.

  2. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source