mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Fix missing export db implementation
This commit is contained in:
parent
f531865a3a
commit
f34d56bae1
1 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,8 @@ import 'dart:io' as dart;
|
|||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:nc_photos/entity/sqlite/database.dart' as sql;
|
||||
import 'package:nc_photos_plugin/nc_photos_plugin.dart';
|
||||
import 'package:path/path.dart' as path_lib;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sqlite3/common.dart';
|
||||
|
@ -59,3 +61,13 @@ Future<CommonDatabase> openRawSqliteDbFromAsset(
|
|||
mode: isReadOnly ? OpenMode.readOnly : OpenMode.readWriteCreate,
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> exportSqliteDb(sql.SqliteDb db) async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final file = dart.File(path_lib.join(dir.path, "export.sqlite"));
|
||||
if (await file.exists()) {
|
||||
await file.delete();
|
||||
}
|
||||
await db.customStatement("VACUUM INTO ?", [file.path]);
|
||||
return MediaStore.copyFileToDownload(file.path);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue