最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - get existing tables from websql database - Stack Overflow

programmeradmin2浏览0评论

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 badges
Add a ment  | 

2 Answers 2

Reset to default 8

Link 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);
});
发布评论

评论列表(0)

  1. 暂无评论