Sqlite文件在ubunut的查看

Posted 未将对象引用设置到对象的实例

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Sqlite文件在ubunut的查看相关的知识,希望对你有一定的参考价值。

 

 

 

 

1.

How to list the tables in a SQLite database file that was opened with ATTACH?

 

The .tables, and .schema "helper" functions don\'t look into ATTACHed databases: they just query the SQLITE_MASTER table for the "main" database. Consequently, if you used

ATTACH some_file.db AS my_db;

then you need to do

SELECT name FROM my_db.sqlite_master WHERE type=\'table\';

Note that temporary tables don\'t show up with .tables either: you have to list sqlite_temp_masterfor that:

SELECT name FROM sqlite_temp_master WHERE type=\'table\';
  
  • 81
    Only "SELECT name FROM sqlite_master WHERE type=\'table\'" works for me – vladkras Dec 15 \'15 at 13:28
  • 2
    SELECT name FROM my_db.sqlite_master WHERE type=\'table\'; this does not work for me (for the attached DB) and it throws error as: no such table exist "my_db.sqlite_master" – kanika Jul 27 \'16 at 7:16
  •  
    what you meant by temporary tables? Are there any when I just opened SQLite db file? – Ewoks May 7 \'17 at 13:20
  •  
    Temporary tables are those created with CREATE TEMPORARY TABLE SQL commands. Their contents are dropped when the current database connection is closed, and they are never saved to a database file. – Anthony Williams May 8 \'17 at 14:37
  • 1
    Under sqlite3 command mode and run ATTACH "some_file.db" AS my_db; It worked! – John_J Dec 25 

 

 

 

 

2.You could attach another database file from the SQLite shell:

sqlite> attach database \'RelDb.sqlite\' as RelDb;

sqlite> .databases
main: /db/UserDb.sqlite
RelDb: /db/RelDb_1.sqlite

sqlite> .tables
RelDb.collectionRelationship  contentStatus               
RelDb.contentRelationship     genres                      
RelDb.leagueRelationship      recordingFilter             
RelDb.localizedString         syncedContentStatus         
accountLevelSettings          syncedThumbs                
collectionActivity            thumbs                      

The tables from this 2nd database will be accessible via prefix of the database:

sqlite> select count(*) from RelDb.localizedString;
2442

以上是关于Sqlite文件在ubunut的查看的主要内容,如果未能解决你的问题,请参考以下文章

Android 逆向使用 DB Browser 查看并修改 SQLite 数据库 ( 从 Android 应用数据目录中拷贝数据库文件 | 使用 DB Browser 工具查看数据块文件 )(代码片段

保存命令行输出信息到log的方法(ubunut下和arm-linux下有效)

如何在片段中访问 SQLite 数据到 ListView

如何在片段类的列表视图中显示 SQLite 数据库?

使用片段从数据库 SQLite 获取数据时出错

当我从用户获取数据并将其保存到 SQLite 数据库中时,我应该怎么做才能使列表视图在片段中工作