Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-11322

iOS: Filesystem - Console output returns unexpected characters during DB migration ( iPad only)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Won't Fix
    • Affects Version/s: Release 3.0.0
    • Component/s: iOS
    • Environment:

      Tested on:
      Titanium Studio, build: 3.0.0.201210090117
      Titanium SDK, build:3.0.0.v20121009034227
      Xcode 4.5.1
      Device:
      iPad3 ios 5.1.1

      Description

      Description:
      While testing Filesystem Module I noticed a different output in console for iPad and iPhone.
      It is not a regression, exists on 2.1.3

      Test steps:
      1. Run this code below

      var win = Ti.UI.createWindow({
          title:'db testing',
      });
       
      var db = Titanium.Database.open('mydb');
       
      var l3 = Titanium.UI.createLabel({
          text:'unicode placeholder',
          width:300,
          height:40,
          top:160
      });
      win.add(l3);
       
      var l = Titanium.UI.createLabel({
          text:'See Log for output',
          top:10,
          left:10,
          height:'auto',
          width:'auto'
      });
      win.add(l);
       
      var b1 = Titanium.UI.createButton({
          title:'Create the DB',
          width:200,
          height:40,
          top:40
      });
      win.add(b1);
       
      b1.addEventListener('click', function()
      {   var l1 = Titanium.UI.createLabel({
              text:'2nd context test - see log.',
              color:'#fff',
              font:{fontSize:14},
              width:'auto',
              height:'auto'
          });
           
          win.add(l1);
      var db = Titanium.Database.open('mydb');
      db.execute('CREATE TABLE IF NOT EXISTS DATABASETEST  (ID INTEGER, NAME TEXT)');
      db.execute('DELETE FROM DATABASETEST');
       
      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');
      db.execute('INSERT INTO DATABASETEST (ID, NAME ) VALUES(?,?)', 5, '\u2070 \u00B9 \u00B2 \u00B3 \u2074 \u2075 \u2076 \u2077 \u2078 \u2079');
      var updateName = 'I was updated';
      var updateId = 4;
      db.execute('UPDATE DATABASETEST SET NAME = ? WHERE ID = ?', updateName, updateId);
       
      db.execute('UPDATE DATABASETEST SET NAME = "I was updated too" WHERE ID = 2');
       
      db.execute('DELETE FROM DATABASETEST WHERE ID = ?',1);
       
      Titanium.API.info('JUST INSERTED, rowsAffected = ' + db.rowsAffected);
      Titanium.API.info('JUST INSERTED, lastInsertRowId = ' + db.lastInsertRowId);
      db.close();
      });
       
      var b2 = Titanium.UI.createButton({
          title:'Select on the db',
          width:200,
          height:40,
          top:100
      });
      win.add(b2);
       
      b2.addEventListener('click', function()
      {
      var db = Titanium.Database.open('mydb');
      var rows = db.execute('SELECT * FROM DATABASETEST');
      Titanium.API.info('ROW COUNT = ' + rows.getRowCount());
      Titanium.API.info('ROW COUNT = ' + rows.getRowCount());
      Titanium.API.info('ROW COUNT = ' + rows.getRowCount());
       
      while (rows.isValidRow())
      {
          Titanium.API.info('ID: ' + rows.field(0) + ' NAME: ' + rows.fieldByName('name') + ' COLUMN NAME ' + rows.fieldName(0));
          if (rows.field(0)==5)
          {
              l3.text = rows.fieldByName('name');
          }
       
          rows.next();
      }
      rows.close();
      db.close(); // close db when you're done to save resources
          var l2= Titanium.UI.createLabel({
              text:'Check the select - see log.',
              color:'#fff',
              font:{fontSize:14},
              width:'auto',
              height:'auto',
              top:400,
          });
          win.add(l2);
      });
      var l3 = Titanium.UI.createLabel({
          text:'unicode placeholder',
          width:300,
          height:40,
          top:160
      });
       
      win.open();
      

      2. See log for output

      Expected result:

      You should see the following output:
      [INFO] ROW COUNT = 4
      [INFO] ROW COUNT = 4
      [INFO] ROW COUNT = 4
      [INFO] ID: 2 NAME: I was updated too COLUMN NAME ID
      [INFO] ID: 3 NAME: Name 3 COLUMN NAME ID
      [INFO] ID: 4 NAME: I was updated COLUMN NAME ID
      *[INFO] ID: 5 NAME: ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ COLUMN NAME ID*

      Actual result, for iPad only:
      [INFO] ROW COUNT = 4
      [INFO] ROW COUNT = 4
      [INFO] ROW COUNT = 4
      [INFO] ID: 2 NAME: I was updated too COLUMN NAME ID
      [INFO] ID: 3 NAME: Name 3 COLUMN NAME ID
      [INFO] ID: 4 NAME: I was updated COLUMN NAME ID
      *[INFO] ID: 5 NAME: ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ -C-O-L-U-M-N -N-A-M-E -I-D*

        Attachments

          Activity

            People

            • Assignee:
              srahim Sabil Rahim
              Reporter:
              oromero Olga Romero
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-14585
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration