如何利用亚洲开发银行在Android的工作室,查看一个SQLite数据库 [英] How to use ADB in Android Studio to view an SQLite DB

查看:138
本文介绍了如何利用亚洲开发银行在Android的工作室,查看一个SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查看我的SQLite数据库,但我不知道该怎么做。我去了 http://www.sqlite.org/download.html 并下载了命令行shell我操作系统,但是当我运行该程序,然后键入亚行......我得到的错误。

我知道这是一个超级纽比的问题,但我只是不知道如何让亚行工作,所以我真的很希望有一些帮助......为了记录我GOOGLE了这个一吨,但没有一个答案我发现是不够彻底让我明白...

感谢您!

PS我使用的是Android的工作室,所以我假设我不需要安装任何额外的,因为我记得机器人工作室表示,它已全部SDK工具需要...

解决方案

最简单的方式:通过亚行外壳连接到SQLITE3

我还没有发现任何办法做到这一点在Android的工作室,但我获得的每一次拉动文件中的分贝与远程shell来代替。

找到所有的信息在这里: <一href="http://developer.android.com/tools/help/adb.html#sqlite">http://developer.android.com/tools/help/adb.html#sqlite

1 - 转到您的平台,工具,文件夹中的命令提示符

2 - 输入命令 ADB设备来让你的设备列表

  C:\的Andr​​oid \ ADT-束窗口-x86_64的\ SDK \平台工具&gt; ADB设备
设备名单附后
模拟器-XXXX设备
 

3的壳连接到设备:

  C:\的Andr​​oid \ ADT-束窗口-x86_64的\ SDK \平台工具&gt;亚行-s模拟器-XXXX壳
 

4-导航到包含您的数据库文件的文件夹:

  CD数据/数据​​/&lt;您-包名称&gt; /数据库/
 

5运行sqlite3的连接到你的数据库:

  sqlite3的&lt;您-DB-名称&gt; .db的
 

6运行sqlite3的命令,你喜欢的,例如:

  SELECT * FROM表1 WHERE ...;
 

  

注意:查找更多下面的命令来运行

的S​​QLite的cheatsheet

有几步看到一个SQLite数据库中的表:

  1. 在列出数据库中的表:

      .tables
     

  2. 如何列出表格的外观:

      .schema表名
     

  3. 打印整个表:

      SELECT * FROM表名;
     

  4. 列出所有可用的SQLite提示的命令:

     。帮助
     

I need to view my SQLite db but I don't know how to do it. I've gone to http://www.sqlite.org/download.html and downloaded the command line shell for my os, but when I run the program and type 'adb ...' I get errors.

I know this is a super newby question but I just don't know how to get ADB to work so I'm really hoping for some assistance...For the record I've googled this a ton but none of the answers I found were thorough enough for me to understand...

Thank you!

PS I'm using Android Studio so I'm assuming I don't need to install anything extra because I recall Android Studio said it had all the SDK tools needed ...

解决方案

Easiest Way: Connect to Sqlite3 via ADB Shell

I haven't found any way to do that in Android Studio, but I access the db with a remote shell instead of pulling the file each time.

Find all info here: http://developer.android.com/tools/help/adb.html#sqlite

1- Go to your platform-tools folder in a command prompt

2- Enter the command adb devices to get the list of your devices

C:\Android\adt-bundle-windows-x86_64\sdk\platform-tools>adb devices
List of devices attached
emulator-xxxx   device

3- Connect a shell to your device:

C:\Android\adt-bundle-windows-x86_64\sdk\platform-tools>adb -s emulator-xxxx shell

4- Navigate to the folder containing your db file:

cd data/data/<your-package-name>/databases/

5- run sqlite3 to connect to your db:

sqlite3 <your-db-name>.db

6- run sqlite3 commands that you like eg:

Select * from table1 where ...;

Note: Find more commands to run below.

SQLite cheatsheet

There are a few steps to see the tables in an SQLite database:

  1. List the tables in your database:

    .tables
    

  2. List how the table looks:

    .schema tablename
    

  3. Print the entire table:

    SELECT * FROM tablename;
    

  4. List all of the available SQLite prompt commands:

    .help
    

这篇关于如何利用亚洲开发银行在Android的工作室,查看一个SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆