LoginSignup
3
3

More than 5 years have passed since last update.

Titanium.Databaseの基本的な使い方

Last updated at Posted at 2013-11-27

sqliteのデータベースファイルの作成

install()を使いsqliteのデータベースファイルを内部ストレージにコピーする

データベースファイルのコピー先

  • iOS

/Applications/apple_app_id/Library/Private Documents/

  • Android

file:///data/data/appID/databases/

外部ストレージにコピーする場合(Android)

if (Ti.Platform.name === 'android' && Ti.Filesystem.isExternalStoragePresent()) {
  var db2 = Ti.Database.install('mydb2', Ti.Filesystem.externalStorageDirectory + 'path' + Ti.Filesystem.separator + 'to' + Ti.Filesystem.separator + 'mydb2Installed');
}

引用元

sqlite databaseの削除

var db = Ti.Database.open('myDB');
db.close();
db.remove();

引用元

sql文の実行例

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3