Question

updated... trying to add static data into WebSQL and I throw no errors but I have an empty table. Not sure what I am missing here. Here is my static javascript code:

var db = openDatabase('semi33', '1.0', 'Test DB', 2 * 1024 * 1024);
db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS mtgs ( id INTEGER, dist INTEGER, sn INTEGER, name TEXT, loc TEXT, add TEXT, add2 TEXT, city TEXT, zip INTEGER, lat REAL, lng REAL, day INTEGER, time INTEGER, o INTEGER, c INTEGER, bb INTEGER, tw INTEGER, l INTEGER, s INTEGER, w INTEGER, m INTEGER, g INTEGER, b INTEGER, h INTEGER, n INTEGER, cc INTEGER, a INTEGER, addl TEXT, eda TEXT, eeda TEXT, etyp TEXT, etit TEXT, edesc TEXT, espkr TEXT, espkr_fr TEXT, edspy INTEGER, dsplyst INTEGER,  dsplyend INTEGER,  mes TEXT );")
});

db.transaction(function(tx) {
tx.executeSql("INSERT INTO mtgs (id,dist,sn,name,loc,add,add2,city,zip,lat,lng,day,time,o,c,bb,tw,l,s,w,m,g,b,h,n,cc,a,addl,eda,eeda,etyp,etit,edesc,espkr,espkr_fr,edspy,dsplyst,dsplyend,mes) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",[1,12,637280, 'Southgate A.A. Study Group','Calvery Reformed Church','14151 Trenton Rd','NULL','Southgate',48195,42.205124,-83.192635,5,1830,0,1,1,1,0,0,0,0,0,1,0,0,0,1,'NULL',0,0,'NULL','NULL','NULL','NULL','NULL',0,0,0,'NULL'])
});
Was it helpful?

Solution

I believe WebSQL was officially deprecated as a standard by W3C a couple of years ago which means that as a developer you are probably best to avoid it as the specification will no longer be updated and browser vendors are unlikely to continue to support their implementations.

I would suggest you look at IndexedDB which is the technology the W3C are pursuing for the storage of large amounts of structured data within the browser and which has reasonable support across the major modern browsers (no Safari though). There's a WebSQL to IndexedDB migration guide here which may be useful.

You might also want to consider localstorage which allows you to persist key/value pairs within the browser and has the advantage of near universal support in modern browsers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top