sqlite中如何查询数据库中存在的所有表?(转自:http://topic.youkuaiyun.com/u/20081231/16/6aee6233-32c2-4f20-a3d7-0cb154974ce4.)...

SQLite查询数据库中所有表的方法
本文详细介绍了在SQLite数据库中使用.tables和.schema命令查询所有表及索引的方法,并提供了在C/C++程序中获取表和索引名称的SQL代码。
sqlite中如何查询数据库中存在的所有表? 请指教!!!

官方文档就有。 http://www.sqlite.org/faq.html (7) How do I list all tables/indices contained in an SQLite database If you are running the sqlite3 command-line access program you can type ".tables" to get a list of all tables. Or you can type ".schema" to see the complete database schema including all tables and indices. Either of these commands can be followed by a LIKE pattern that will restrict the tables that are displayed.
From within a C/C++ program (or a script using Tcl/Ruby/Perl/Python bindings) you can get access to table and index names by doing a SELECT on a special table named "SQLITE_MASTER". Every SQLite database has an SQLITE_MASTER table that defines the schema for the database. SQL code SELECT name FROM sqlite_master WHERE type='table' ORDER BY name; 如果你在sqlite行命令下,你可以直接使用 .tables 或 .schema 命令来得到完整的数据库集包括表s和索引s. 这两个命令支持匹配符。 如果在其它宿主程序中例如 C/C++等,你可以从一个特殊的表 "SQLITE_MASTER" 得到类似的信息

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值