如何显示整个数据库

时间:2021-09-12 01:10:58

I'm currently using SQlite, writing an application with TideSDK. All I'm after is to display an entire database (all tables) to a user, as it's an assessment tool a teacher needs to view. I'm using HTML5 and Javascript.

我目前正在使用SQlite,用TideSDK编写应用程序。我所追求的只是向用户显示整个数据库(所有表格),因为它是教师需要查看的评估工具。我正在使用HTML5和Javascript。

I was thinking of putting the entire database into a string or array like:

我想把整个数据库放到一个字符串或数组中,如:

var database = db.execute("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name");

Then some how render on screen using javascript/html.

然后一些如何使用javascript / html在屏幕上渲染。

Is this at all possible? Is there a plugin for this kind of stuff? It's been bugging me for weeks and I can't seem to get any help.

这是可能吗?这种东西有插件吗?它已经困扰了我几个星期,我似乎无法得到任何帮助。

Thanks you to anyone who can point me in the right direction.

感谢任何能指出我正确方向的人。

1 个解决方案

#1


3  

To list the tables, you should be able to do

要列出表格,您应该能够做到

SELECT name FROM sqlite_master 
    WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'
    UNION ALL 
    SELECT name FROM sqlite_temp_master 
    WHERE type IN ('table','view') 
    ORDER BY 1

Or use the shorter version

或者使用较短的版本

.tables

http://www.sqlite.org/sqlite.html. Go down to Querying the database schema

http://www.sqlite.org/sqlite.html。转到查询数据库架构

#1


3  

To list the tables, you should be able to do

要列出表格,您应该能够做到

SELECT name FROM sqlite_master 
    WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'
    UNION ALL 
    SELECT name FROM sqlite_temp_master 
    WHERE type IN ('table','view') 
    ORDER BY 1

Or use the shorter version

或者使用较短的版本

.tables

http://www.sqlite.org/sqlite.html. Go down to Querying the database schema

http://www.sqlite.org/sqlite.html。转到查询数据库架构