Sunil
Sunil

Reputation: 21406

window.sqlitePlugin.openDatabase command creates or opens a database

This is related to the PhoneGap sqlite plugin.

If the following code is executed on a mobile device, will it only try to open an existing database, OR it will also create a new database if the specified database does not exist?

var db = window.sqlitePlugin.openDatabase({  
         name : "TestDB"  
  });  

Upvotes: 1

Views: 6876

Answers (1)

Divesh Salian
Divesh Salian

Reputation: 1455

If there is no database with that name a new database would be created, If the database exist it will open the existing one (only if the version matched if you have specified at the time of creation)

You can have a look onto this example

Upvotes: 2

Related Questions