我正在尝试使用 WebSQLite 执行 SQL 事务。我遇到的问题是,每次运行代码时,都会收到一条 SQL 错误,指出:SQLError {code: 5, message: "could not prepare statement (1 near ")": syntax error)"}
仅从外观上看,我无法弄清楚这个错误意味着什么,所以我尝试将我的 sql 查询打印到控制台并返回: INSERT INTO propertiesList (reporterName, propertyType, bedrooms, datetime, furnitureTypes, monthlyRentPrice, notes, propertyLocation, images)
VALUES ('Israel', 'Flat', 'Studio', '1570494720000', 'Furnished', '150000', '', '', '')
另外,这是我的代码结构:
db.transaction(transaction => {
transaction.executeSql(
`CREATE TABLE IF NOT EXISTS propertiesList (
id INTEGER PRIMARY KEY AUTOINCREMENT,
reporterName TEXT NOT NULL,
propertyType TEXT NOT NULL,
bedrooms TEXT NOT NULL,
datetime TEXT NOT NULL,
monthlyRentPrice TEXT NOT NULL,
furnitureTypes TEXT,
notes TEXT,
propertyLocation TEXT,
images TEXT,
)`
);
if (duplicate === true) {
msg = 'You have a property that have some similar details with this. Please check and update it instead';
} else {
const formData = new FormData();
imageArray.forEach(image => formData.append('file[]', image));
if (imageArray.length > 0) {
axios.post(`https://cors-anywhere.herokuapp.com/http://laratweet.me/upload_photos`, formData).then(response => {
console.log('from uploading image', response);
});
}
我的问题是我无法弄清楚错误是什么或如何解决它,现在我被困在该项目上,因为除非“创建”功能有效,否则我无法继续网站的任何部分。任何帮助表示赞赏。提前致谢。
MMMHUHU
相关分类