You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foxinni edited this page Oct 20, 2014
·
3 revisions
Here is how to load a database from your server using XMLHTTPRequest, and open it with sql.js
varxhr=newXMLHttpRequest();xhr.open('GET','/path/to/database.sqlite',true);xhr.responseType='arraybuffer';xhr.onload=function(e){varuInt8Array=newUint8Array(this.response);vardb=newSQL.Database(uInt8Array);varcontents=db.exec("SELECT * FROM my_table");// contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}]};xhr.send();