1# Debugging Tools
2## Enable all verbose logs
3Running `./logging.sh` will enable all verbose logs for the queries in the provider.
4More details in the script itself.
5
6## Querying the database
7There are 2 different ways to easily query the database, `qc` and `contatcsproviderutils.sh`.
8
9### QC usage
10`qc` queries the deivce directly. For usage, append the query in single quotes after the command:
11
12e.g.
13```
14qc/qc 'select * from raw_contacts'
15```
16
17or to get all the tables
18```
19qc/qc '.tables'
20```
21QC support SQLite language, but it might have some limitations working with complex nested queries.
22
23### contactsproviderutils.sh usage
24
25This script downlaods the database locally and logins into a local version. It is also possible to push any change back to the device.
26
27* Add tools to path
28    ```
29    source contactsproviderutils.sh
30    ```
31* Pull `contacts2.db` and query:
32    ```
33    sqlite3-pull
34    ```
35    This will open a sql terminal with `rlwrap` which can be easily used for queries.
36* Pull `contacts2.db` and query with a graphical interface:
37    ```
38    sqlitebrowser-pull
39    ```
40* Push local updates to the device:
41    ```
42    sqlite3-push
43    ```
44
45