I was wondering if it is possible to get the existing tables from a websql database. Is there some sort of query to find these?
I have already found several sqlite examples but these don't work in websql.
I was wondering if it is possible to get the existing tables from a websql database. Is there some sort of query to find these?
I have already found several sqlite examples but these don't work in websql.
Share Improve this question asked Apr 26, 2013 at 13:43 JerodevJerodev 33.2k11 gold badges94 silver badges112 bronze badges2 Answers
Reset to default 8Link seems to be dead from Kyaw Tun's answer - this worked for me, just wanted to share unless anyone else is looking for this.
SELECT tbl_name, sql from sqlite_master WHERE type = 'table'
It will show the original sql used to generate the table - not perfect but should be good enough.
You can query existing table schema from sqlite_master table.
For implementation, you can see detail on my open source library https://bitbucket/ytkyaw/ydn-db/src/master/js/ydn/db/conn/websql.js
Basically you can get your schema by
var db = new ydn.db.Storage('db name');
db.getSchema(function (schema) {
console.log(schema);
});