title: How to read .sql file & support CRUD operations using javascript?
body: <p>I am working on phonegap Android platform. I have mydatabase.sql file in assets folder. I dont know how to deal with that sql file. basically i have to load this sql file using javascript. 
  here is some data which is in mydatabase.sql:</p>
  
  <pre><code>SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  
  CREATE TABLE `media` (
    `Id` int(11) NOT NULL auto_increment,
    `Part` int(11) NOT NULL,
    `No` int(11) NOT NULL,
    `Title_EN` varchar(100) collate utf8_unicode_ci default NULL,
    `Year` int(24) default NULL,
    PRIMARY KEY  (`Id`)
    \\
    \\another values
  ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=649 ;
  
  --
  -- Dumping data for table `media`
  --
  
  INSERT INTO `media` (`Id`, `Part`, `No`, `Title_Hari`, `Type`,  `Artist_EN`,  `Track`, `Year`) VALUES
  (1, 1, 1,  'Sant Sangeet' 'Cassette', NULL, NULL, NULL, 7, NULL),
   \\
   \\
   \\ another values
  
  CREATE TABLE `media1` (
  
   \\ create another table
  
  INSERT INTO `media1`
  
   \\ insert data 
   \\ 
   \\
  </code></pre>
  
  <p>mydatabase.sql contains create table methods &amp; insert value to that tables.</p>
  
  <p>tried some methods in js:</p>
  
  <p>Demo.JS:</p>
  
  <pre><code>var db;
  
  function ReadFile() {
      console.log("call database");
      try
      {
          if (window.openDatabase)
          {
  
              db = openDatabase("../sql/mydatabase.sql", "1.0", " Database", 200000);
              console.log("open database");
              db.transaction (function (transaction) 
  
                      {
                  console.log("transaction database");
  
  
                              var sql = "SELECT * FROM media";
  
                              transaction.executeSql (sql, undefined, 
  
                              function (transaction, result)
  
                              {
  
                                  alert(JSON.stringify(result));
                                  console.log(JSON.stringify(result));
  
                              },  function(error){
                                  console.log("error");
                              });
  
                      });
          }
          else
          {
              console.log("else database");
              // Handle no database support
          }
      }
      catch(err)
      { 
          console.log("error database");
          // Handle error
      }
  }
  </code></pre>
  
  <p>OutPut:</p>
  
  <pre><code>  call database
    open database
    transaction database
    no such a tabke media
    error
  </code></pre>
  
  <p>So my problem is how to import it in my app or how to deal with this sql database &amp; after importing this database, how to perform CRUD operations &amp; pass the query to this. Please suggest some Tutorial. Any help would be appreciated!!</p>
  
  <p>Thanks.</p>