有没有一种简单的方法可以从 Android 中的每个表中获取 CREATE 字符串,而不是在 onCreate 覆盖中重新定义它们。我很恼火,只能为每个表解析整个内容,但我希望有一种更简单的方法,我还没有找到。
问问题
52 次
1 回答
2
使用内置表sqlite_master
sqlite-3.7.2 e$ sqlite3
SQLite version 3.7.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t1 (a, b, c integer);
sqlite> create table t2 (d, e, f text);
sqlite> select * from sqlite_master;
table|t1|t1|2|CREATE TABLE t1 (a, b, c integer)
table|t2|t2|3|CREATE TABLE t2 (d, e, f text)
sqlite> select sql from sqlite_master;
CREATE TABLE t1 (a, b, c integer)
CREATE TABLE t2 (d, e, f text)
于 2010-08-25T18:48:07.407 回答