Qt文档中有一个LocalStorage
示例
function findGreetings() {
var db = LocalStorage.openDatabaseSync("QQmlExampleDB", "1.0", "The Example QML SQL!", 1000000);
db.transaction(
function(tx) {
// Some other commands
// Show all added greetings
var rs = tx.executeSql('SELECT * FROM Greeting');
}
)
}
rs
的数据类型是什么?
答案 0 :(得分:3)
请参阅Quick Local Storage QML module documentation:
results = tx.executeSql(statement, values)
此方法执行SQL语句,将值列表绑定到 SQL位置参数(“?”)。
返回结果对象,其中包含以下属性:
| Type | Property | Value | Applicability |
-----------------------------------------------------------------------------------------
| int | rows.length | The number of rows in the result | SELECT |
-----------------------------------------------------------------------------------------
| var | rows.item(i) | Function that returns row i of the result | SELECT |
-----------------------------------------------------------------------------------------
| int | rowsAffected | The number of rows affected by a modification | UPDATE,DELETE |
-----------------------------------------------------------------------------------------
| string | insertId | The id of the row inserted | INSERT |
答案 1 :(得分:2)
results = tx.executeSql(statement,values)
此方法执行SQL语句,将值列表绑定到SQL位置参数("?")。 它返回一个结果对象,具有以下属性:link
如果您只想知道返回对象的类型,请执行以下操作:
var rs = tx.executeSql(...);
console.log(rs);
qml: [object Object]