Files
flipper/docs/setup/databases-plugin.mdx
John Knox 5f1a0548f5 Migrate website to Docusaurus 2
Summary:
Docusaurus 2 is quite a lot more powerful than docu 1 it turns out.
This should convert the website fully.

* [done] Go through migration guide https://v2.docusaurus.io/docs/migrating-from-v1-to-v2
* [done] Convert landing page html
* [done] Convert all images to img tags
* [done] Convert all .md files to .mdx
* [done] Make sure ui-doc generation and including still works
* [done] Scan every page visually for sanity check
* [done] Make sure footer still works
* [done] Make sure search still works
* [done] Change all links/ to links/index
* [done] Change all links.md to links
* [done] Add some custom css to make the navbar look like the old one and darken the footer.

Reviewed By: passy

Differential Revision: D21158717

fbshipit-source-id: 5f45b711b1b6fd5ece4c5c15c55635c7ebbfb568
2020-04-27 04:05:01 -07:00

64 lines
1.9 KiB
Plaintext

---
id: databases-plugin
title: Databases Plugin Setup
sidebar_label: Databases
---
To use the databases plugin, you need to add the plugin to your Flipper client instance. The plugin is currently only available for Android.
## Android
Instantiate and add the plugin in `FlipperClient`.
```java
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
client.addPlugin(new DatabasesFlipperPlugin(context));
```
By default it will list all sqlite databases returned by the context. If you are storing a sqlite database somewhere else, you can specify a `File` to it:
```java
client.addPlugin(new DatabasesFlipperPlugin(new SqliteDatabaseDriver(context, new SqliteDatabaseProvider() {
@Override
public List<File> getDatabaseFiles() {
List<File> databaseFiles = new ArrayList<>();
for (String databaseName : context.databaseList()) {
databaseFiles.add(context.getDatabasePath(databaseName));
}
databaseFiles.add("...path_to_your_db...")
return databaseFiles;
}
})));
```
If you use a different type of database other than sqlite, you can implement a driver to be able to access it via Flipper.
```java
client.addPlugin(new DatabasesFlipperPlugin(new DatabaseDriver(context) {
@Override
public List getDatabases() {
return null;
}
@Override
public List<String> getTableNames(DatabaseDescriptor databaseDescriptor) {
return null;
}
@Override
public DatabaseGetTableDataResponse getTableData(DatabaseDescriptor databaseDescriptor, String table, String order, boolean reverse, int start, int count) {
return null;
}
@Override
public DatabaseGetTableStructureResponse getTableStructure(DatabaseDescriptor databaseDescriptor, String table) {
return null;
}
@Override
public DatabaseExecuteSqlResponse executeSQL(DatabaseDescriptor databaseDescriptor, String query) {
return null;
}
}));
```