sample.cs
// Application.persistentDataPath 取得したパス配下にDBファイルを作成する
var dbPath = System.IO.Path.Combine(Application.persistentDataPath, "test.db");
var db = new SQLiteDB();
db.Open(dbPath);
// 暗号化
db.Key("0x414243");
// CREATE TABLE
var qr = new SQLiteQuery(db, @"
CREATE TABLE IF NOT EXISTS test_data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
role TEXT
);");
qr.Step();
qr.Release();
qr = null;
// INSERT
qr = new SQLiteQuery(db, @"
INSERT INTO test_data (
name,
role
)
VALUES (
'taro',
'programmer'
);");
qr.Step();
qr.Release();
qr = null;
// SELECT
qr = new SQLiteQuery(db, "SELECT * FROM test_data");
while(qr.Step()) {
Debug.Log (string.Format ("{0}: {1} - {2}", query.GetInteger("id"), query.GetString("name"), query.GetString("role")));
}
qr.Release();
qr = null;
db.Close();
db = null;