| Platform | Since |
|---|---|
| Android | 0.1 |
| iPhone | 0.1 |
| iPad | 0.1 |
| Mobile Web | 1.8 |
Opens an SQLite database.
Opens an SQLite database and returns a reference to it. If the database does not exist, creates an empty database file and returns a reference to this opened database.
With Titanium 1.8.0.1 on iOS, the default database location changed in accordance
with Apple's guidelines. If a database file already exists in the old
location, open will automatically move it to the new location.
Always close the database after use.
A database, with a persistant name of mydb1Installed and located in the
default database location on internal storage, is opened.
var db = Ti.Database.open('mydb1Installed');
A file extension of sql is added, and the file is opened from the
following location.
On simulator
/Users/<user name>/Library/Application Support/iPhone Simulator/<iOS version>/Applications/<apple app id>/Library/Private Documents/mydb1Installed.sql (Titanium 1.8.0.1)/Users/<user name>/Library/Application Support/iPhone Simulator/<iOS version>/Applications/<apple app id>/Library/Application Support/database/mydb1Installed.sql (earlier versions)On device
/Applications/<apple app id>/Library/Private Documents/mydb1Installed.sql (Titanium 1.8.0.1)/Applications/<apple app id>/Library/Application Support/database/mydb1Installed.sql (earlier versions)A database, with a persistant name of mydb1Installed and located in the
default database location on internal storage, is opened.
var db1 = Ti.Database.open('mydb1Installed');
Unlike on iOS, no file extension is added. The file is opened in the following location.
file:///data/data/appID/databases/mydb1InstalledA database, with a filename of mydb2Installed and located at the
absolute path provided, is opened.
if (Ti.Platform.name === 'android' && Ti.Filesystem.isExternalStoragePresent()) { var db2 = Ti.Database.open(Ti.Filesystem.externalStorageDirectory + 'path' + Ti.Filesystem.separator + 'to' + Ti.Filesystem.separator + 'mydb2Installed'); }
Unlike on iOS, no file extension is added. The file is copied to the absolute path, as follows.
file:///sdcard/path/to/mydb2Installed| Name | Type | Summary |
|---|---|---|
| dbName | String |
The dbname previously passed to |