我想创建一个返回SQLite记录值的javascript函数。
但我该如何解决范围?
function LeeSQLite() {
var valor = "";
var myDB = window.sqlitePlugin.openDatabase({
name: 'myDB.db',
location: 'default'
});
myDB.transaction(function(transaction) {
var SQL = "SELECT desc FROM user_table WHERE id = 1";
transaction.executeSql(SQL, [], function(tx, results) {
valor = results.rows.item(0).desc;
}, null);
});
return valor;
}