1 回答

TA貢獻(xiàn)1784條經(jīng)驗 獲得超8個贊
可能是因為您提供的值run應(yīng)該位于單個數(shù)組中,而不是作為多個參數(shù)傳遞。
<script src="sql.js"></script>
<script>
var data;
config = {
locateFile: filename => `sql.js`
}
</script>
<script>
initSqlJs(config).then(function (SQL) {
var db = new SQL.Database();
db.run(`CREATE TABLE notes (
id integer primary key, /* 0 */
guid text not null, /* 1 */
mid integer not null, /* 2 */
mod integer not null, /* 3 */
usn integer not null, /* 4 */
tags text not null, /* 5 */
flds text not null, /* 6 */
sfld integer not null, /* 7 */
csum integer not null, /* 8 */
flags integer not null, /* 9 */
data text not null /* 10 */
);`)
db.run(
`INSERT INTO notes (id, guid, mid, mod, usn, tags, flds, sfld, csum, flags, data)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, 0, '')`,
[123,"abcdef", 12345, 56789, -1, "tags", "hi", 0]
);
});
</script>
添加回答
舉報