title: Check if DB exists and dropping DB in SQLlite IOS
body: <p>I'm currently using phonegap to create and ios app.</p>
  
  <p>While getting familiar to the sql javascript interactions I seem to have created 10 versions of the same named database file.</p>
  
  <p>I'm currently using the following creation code (from the phonegap wiki)</p>
  
  <pre><code>var mydb=false;
  // initialise the database
  initDB = function() {
    try { 
      if (!window.openDatabase) { 
        alert('not supported'); 
      } else { 
        var shortName = 'phonegap'; 
        var version = '1.0'; 
        var displayName = 'PhoneGap Test Database'; 
        var maxSize = 65536; // in bytes 
        mydb = openDatabase(shortName, version, displayName, maxSize); 
       }
    } catch(e) { 
      // Error handling code goes here. 
      if (e == INVALID_STATE_ERR) { 
        // Version number mismatch. 
        alert("Invalid database version."); 
      } else { 
        alert("Unknown error "+e+"."); 
      } 
      return; 
    } 
  }
  // db error handler - prevents the rest of the transaction going ahead on failure
      errorHandler = function (transaction, error) { 
        // returns true to rollback the transaction
      return true;  
            } 
  // null db data handler
      nullDataHandler = function (transaction, results) { } 
  </code></pre>
  
  <p>my problem is that I'm unsure how to check if the database exists before creating it or how to create it only once per device?</p>
  
  <p>and secondly how can i drop all these databases that have been created. </p>
  
  <pre><code>transaction.executeSql('DROP DATABASE phonegap;'); 
  </code></pre>
  
  <p>does not seem to drop anything.</p>
  
  <p>Thanks</p>