I am developing a mobile application that uses Sqlite and I would like to pull the .db file from the phone and view it in DB Browser for Sqlite.
The issue comes from the fact that when I run the adb commands the .db file I get is empty, even though I have creatd tables and added data to those tables in the database.
In the application I query the database for the inserted records and they are returned. Any thoughts?
adb command: adb exec-out run-as projectname cat databases/my.db > my.db
db creation code:
if(!Sqlite.exists("my.db")){
new Sqlite("my.db")
.then(
(db) => {
//create table here
db.execSQL("CREATE TABLE IF NOT EXISTS Times (Id INTEGER PRIMARY KEY AUTOINCREMENT, clockIn TEXT, clockOut TEXT)")
.then(
() => {
console.log("succcess")
db.execSQL("INSERT INTO Times (clockIn, clockOut) VALUES (?, ?)", ["Nic", "Raboy"]).then(() => {
db.all("SELECT * FROM Times").then((rows) => {
console.log(rows)
})
})
},
(error) => {
console.log('Error occurred creating table');
});
},
(error) => {
console.log("Error creating Database");
});
}