title: io.litehelpers.cordova.sqlite sqliteplugin.js with Ripple
body: <p>I am working on cordova based hybrid mobile application using VS 2013, sqliteplugin.js (io.litehelpers.cordova.sqlite), angularjs, jquerymobile,  Ripple for running application during development. </p>
  
  <p>I have added sqliteplugin and here is my index.html file</p>
  
  
  
  <pre><code>&lt;script src="plugins/io.litehelpers.cordova.sqlite/Lawnchair-adapter/test-www/lib/qunit.js"&gt;&lt;/script&gt;
  &lt;script src="plugins/io.litehelpers.cordova.sqlite/Lawnchair-adapter/test-www/lib/json2.js"&gt;&lt;/script&gt;
  &lt;script src="plugins/io.litehelpers.cordova.sqlite/Lawnchair-adapter/test-www/lib/lawnchair.js"&gt;&lt;/script&gt;
  &lt;script src="plugins/io.litehelpers.cordova.sqlite/www/SQLitePlugin.js"&gt;&lt;/script&gt;
  &lt;script src="plugins/io.litehelpers.cordova.sqlite/Lawnchair-adapter/test-www/Lawnchair-sqlitePlugin.js"&gt;&lt;/script&gt;
  &lt;script src="plugins/io.litehelpers.cordova.sqlite/Lawnchair-adapter/test-www/lawnchair-spec.js"&gt;&lt;/script&gt;
  
  function onDeviceReady() {
      // Handle the Cordova pause and resume events
      document.addEventListener('pause', onPause.bind(this), false); //jshint ignore:line
      document.addEventListener('resume', onResume.bind(this), false); //jshint ignore:line
      appObj.spa.status.deviceReady = true;
      appObj.spa.status.cordovaReady = appObj.spa.api.cordova.cordovaReady();
      appObj.spa.api.angular.bootstrap();
  </code></pre>
  
  <p>Below is my code where i am creating database and then creating tables in it..</p>
  
  <pre><code>    // TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
      db = window.sqlitePlugin.openDatabase('vitaegodb', '1.0', 'VITAE_Go_Db', 200000);
      db.transaction(createTables, errorCB, successCB);
  
  }
  </code></pre>
  
  <p>function createTables(tx) {</p>
  
  <pre><code>    var createtblActivityCancel = "CREATE TABLE IF NOT EXISTS [tblActivityCancel]([ActivityId] [nvarchar](50) NOT NULL,[DayPlanId] [int] NOT NULL,[WorklistId] [nvarchar](255) NOT NULL,[ResourceId] [int] NOT NULL,[ReasonId] [int] NOT NULL,[Remark] [nvarchar](255) NULL,[ChangeState] [int] NOT NULL,[Synchronized] [bit] NOT NULL,CONSTRAINT [PK_tblActivityCancel] PRIMARY KEY([ActivityId],[DayPlanId]));";
  
  
      tx.executeSql(createtblActivityCancel);
  
  }
  </code></pre>
  
  <p>Now, i am getting a popup "I haz CheezBurger ??" in ripple saying "We seem to be missing some stuff :("</p>
  
  <p>Also in sqliteplugin.js file it is thorwing an exception in below function :</p>
  
  <pre><code> mycb = function(result) {
    var last, q, r, res, type, _i;
    last = result.length - 1;
    for (i = _i = 0; 0 &lt;= last ? _i &lt;= last : _i &gt;= last; i = 0 &lt;= last ? ++_i : --_i) {
      r = result[i];
      type = r.type;`enter code here`
      res = r.result;
      q = mycbmap[i];
      if (q) {
        if (q[type]) {
          q[type](res);
        }
      }
    }
  };
  </code></pre>
  
  <p>I found result is undefined and hence when its trying to find 
  last = result.length - 1;<br>
  it is thrwing exception can't find length of undefined.
  Ripple error
  ![Exception of SQLiteplugin.js file][1]</p>