第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

WebSQL:SQLite 查詢返回事務(wù)錯誤

WebSQL:SQLite 查詢返回事務(wù)錯誤

胡子哥哥 2021-11-12 16:13:14
我正在嘗試使用 WebSQLite 執(zhí)行 SQL 事務(wù)。我遇到的問題是,每次運(yùn)行代碼時,都會收到一條 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', '', '', '')另外,這是我的代碼結(jié)構(gòu):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);                                });                            } 我的問題是我無法弄清楚錯誤是什么或如何解決它,現(xiàn)在我被困在該項(xiàng)目上,因?yàn)槌恰皠?chuàng)建”功能有效,否則我無法繼續(xù)網(wǎng)站的任何部分。任何幫助表示贊賞。提前致謝。
查看完整描述

1 回答

?
MMMHUHU

TA貢獻(xiàn)1834條經(jīng)驗(yàn) 獲得超8個贊

固定的。


表創(chuàng)建中“圖像文本”后的尾隨逗號阻止了創(chuàng)建。


transaction.executeSql(sql)(未引用 db)。


var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);

  db.transaction(tx => {

    tx.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

       )`

    );

  });


  let sql = `INSERT INTO propertiesList (reporterName, propertyType, bedrooms, datetime, furnitureTypes, monthlyRentPrice, notes, propertyLocation, images) 

        VALUES ('Israel', 'Flat', 'Studio', '1570494720000', 'Furnished', '150000', '', '', '')`;

  db.transaction(tx=>{

      tx.executeSql(sql)

  })

W3C 在 2010 年停止積極維護(hù) Web SQL 規(guī)范,并且沒有進(jìn)一步維護(hù)它的計劃。請參閱 Web SQL 數(shù)據(jù)庫。


我建議你使用,


IndexedDB API 很強(qiáng)大,但對于簡單的情況來說似乎太復(fù)雜了。如果您更喜歡簡單的 API,請嘗試使用 localForage、dexie.js、ZangoDB、PouchDB、idb、idb-keyval 和 JsStore 等庫,它們使 IndexedDB 對程序員更友好。


https://developers.google.com/web/tools/lighthouse/audits/web-sql


https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API


查看完整回答
反對 回復(fù) 2021-11-12
  • 1 回答
  • 0 關(guān)注
  • 541 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號