【发布时间】:2017-05-24 21:44:04
【问题描述】:
我有这个代码:
import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.LocalStorage 2.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
property var db // the database of this application
property string dbIdentifier: '/Users/cedo/desktop/test/DatabaseApplicationDB.db'
property string dbVersion: '1.0'
property string dbDescription: 'DatabaseApplicationDB'
property int dbEstimatedSize: 1000000
Component.onCompleted: {
db = LocalStorage.openDatabaseSync(dbIdentifier, dbVersion, dbDescription, dbEstimatedSize);
db.transaction(function(tx) {
var sql = "create table if not exists mytable(id integer)";
tx.executeSql(sql);
});
}
}
创建数据库时 dbIdentifier 有效,但是当我在桌面中搜索 db 文件时,该文件不存在。它在哪里?或者如何决定放在哪里?
【问题讨论】:
标签: javascript c++ qt mobile qml