Summary: Adding missing semicolon. Added a missing semicolon in java code. ## Changelog Update documentation. Pull Request resolved: https://github.com/facebook/flipper/pull/4789 Test Plan: Does not require a test plan. Reviewed By: antonk52 Differential Revision: D46355062 Pulled By: passy fbshipit-source-id: 20c398018b1d2deffb9b1a755d2c5a1543e48c21
60 lines
1.9 KiB
Plaintext
60 lines
1.9 KiB
Plaintext
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
import Link from '@docusaurus/Link';
|
|
|
|
## Android
|
|
|
|
To use the <Link to={useBaseUrl("/docs/features/plugins/databases")}>Databases plugin</Link>, instantiate and add it in `FlipperClient`, as shown in the following code:
|
|
|
|
```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;
|
|
}
|
|
}));
|
|
```
|