Comments (8)
I found that I can read DB raw data by:
const url = await db.getUrl();
const file = await Filesystem.readFile({
path: url.url!,
encoding: Encoding.ASCII
});
const time = dateFormat('yyyy-MM-dd-HH-mm-ss');
const r = await Filesystem.writeFile({
path: `db/backup-${time}.db`,
data: file.data,
directory: Directory.Documents,
recursive: true,
encoding: Encoding.ASCII
});
But after write to Documents and trying to read it by DB explorer, this file will corrupted and shows
Error encountered when performing Introspect schema main: [SQLITE_CORRUPT] The database disk image is malformed
Trying to compare it with the original db files in databases/
, they are totally same file size, and same line numbers.
Any idea about deal this issue?
from sqlite.
I still not understand why read and write the db file will cause corrupted.
But finally I can read the db file if I use copy method. This is my solution:
const url = await db.getUrl();
const time = dateFormat('yyyy-MM-dd-HH-mm-ss');
const r = await Filesystem.copy({
from: url.url!,
to: `db/backup-${time}.db`,
toDirectory: Directory.Documents
});
from sqlite.
@asika32764 Are you on Android 13 API 33
from sqlite.
on simulator with Android 11 API 30
from sqlite.
@asika32764 thanks for this for me using copy is the best as it is a deep copy. May be it is due to the Encoding.ASCII may be it would have work with Encoding.UTF8. In my tutorials, can i use your suggestion if ones wants also to backup their database
from sqlite.
@asika32764 which is the application DB explorer that you are using in iOS and Android to read the database
from sqlite.
@asika32764 No news from you so i close it
from sqlite.
I'm using webstorm / phpstorm database reader.
I tried to compare 2 files but it seems they are same, I think maybe due to some difference in the file metadata.
from sqlite.
Related Issues (20)
- Bug(Android): Calling `run` method with `BEGIN` statement throws StringOutOfBoundIndexException HOT 16
- WAL mode with typeorm stopped working from version 0.3.18 HOT 9
- Is this plugin still maintained in 2024? HOT 2
- "CapacitorSQLite" plugin is not implemented on ios HOT 4
- ionic7-angular-sqlite-app tutorial ionic.config.json type angular-standalone doesn't exist HOT 1
- ionic7-angular-sqlite-app tutorial fails on v5.7.1 HOT 6
- GetFromHTTPRequest not working HOT 3
- Multi Row Statement does not escape characters HOT 4
- Multiple Row Statement Values case insensitive HOT 3
- Multirow statements inserts wrong semicolon HOT 2
- foreign key ON DELETE CASCADE HOT 1
- Create CapacitorJS v6 package compatibility HOT 37
- ExecuteTransaction with values throws exception for statements performing no actual changes HOT 5
- Memory leak using .saveToStore() HOT 18
- Migration not working on iOS HOT 3
- executeSet not inserting rows HOT 8
- Multi Value Statement error with spaces inbetween ? HOT 1
- Multi row statement should fail if no values are replaced HOT 5
- Can I use this plugin inside the background runner capacitor plugin? HOT 2
- Update Capacitor dependencies to version >6 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlite.