Not yet rated

Problem

You want to connect to the SQLite database using single class with easy to use methods.

Solution

Create an instance of SQLite connector class (https://sourceforge.net/projects/windrotor/files/Clasess/DBConnectors/jlcSQLiteDBConnector.js/download).

Detailed explanation

    var CurDBConnector = new jlcSQLiteDBConnector();
    var tmpDBFile = air.File.applicationStorageDirectory.resolvePath('database\\main1.db');
    var tmpSQLQuery = '';
   
    var Counter1 = 0;
    
    try
      {
     CurDBConnector.CreateDBFile(tmpDBFile, true, 'update');
      }
    catch (usrError)
      {
      return false;
      }    
    
    try
      {
    
      tmpSQLQuery =     
    
      "CREATE TABLE IF NOT EXISTS deluxe_coachwork_link (" +  
      "    id INTEGER PRIMARY KEY AUTOINCREMENT, " +  
      "    sportsmenwork INTEGER, " +  
      "    coachwork INTEGER " +  
      ")";

      CurDBConnector.SetQuery(tmpSQLQuery);
      CurDBConnector.ExecuteQuery(tmpSQLQuery);

      }

    catch(usrError)
      {
      return false;
      }


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes