gpt4 book ai didi

javascript - 在 react native 中从 sqlite 存储返回查询结果时未定义

转载 作者:行者123 更新时间:2023-11-30 20:48:46 25 4
gpt4 key购买 nike

<分区>

我试图返回查询结果,但我总是得到未定义的结果。我不确定我在这里做错了什么。我正在使用带有 sqlite 存储插件的 react native。

let SQLite = require('react-native-sqlite-storage')
let db = SQLite.openDatabase({name : "db.v1.33", createFromLocation : "~db.db"});
let sqlResults;

export function GetQuestions(sqlType,questionsCount) {
let sqlQuestions = `SELECT * FROM Questions WHERE Type IN (${sqlType}) ORDER BY RANDOM() LIMIT ${questionsCount}`

db.transaction((tx) => {
tx.executeSql(sqlQuestions, [], (tx, results) => {
sqlSize = results.rows.length;
sqlResults = results;
});
});

return sqlResults;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com