js 读取sqlite 数据库
var xhr = new XMLHttpRequest(); xhr.open('GET', 'boss.db', true); xhr.responseType = 'arraybuffer'; xhr.onload = function(e) { var uInt8Array = new Uint8Array(this.response); var db = new SQL.Database(uInt8Array); var contents = db.exec("SELECT * FROM uuid"); var sqldb = contents[0].values; var uuid = 'null'; if(sqldb.length>0){ uuid = sqldb[0][1]; } console.log('uuid',uuid); }; xhr.send();
页面需要sqlite 的js 驱动方法 sql.js
链接: https://pan.baidu.com/s/1rEyH82avmXk6tTD8DRYCEA 提取码: 7867