im creating a React Native application using Expo platform. I have SQLite database connected to be able to work with app without internet connection.
Here is my code: (you can use my github link to test program)
downloadDB = () => {
let fileUri = `${FileSystem.documentDirectory}SQLite/qr.db`; //The place I download my .db file to
const uri = "https://github.com/iliapnmrv/iliapnmrv.github.io/blob/02dfac2080ec9d7efdc0f131abfb52de36f88c2d/inventory/qr.db" // An external link
FileSystem.downloadAsync(uri, fileUri)
.then(({ uri, status }) => {
console.log(`Download status: ${status}`) // code always displays status code 200
db.transaction(
tx => {
tx.executeSql(
'SELECT * FROM qr',
[],
(_, result) => {
console.log(`QR table has ${result.rows.lengs} rows`)
},
(_, error) => {
console.log(`Error code 1: ${error}`)
}
);
}
);
})
.catch(err => {
console.error(`Error code 7: ${err}`);
});
}
And here are all consoles, app returns:
Download status: 200
Error code 1: Error: no such table: qr (code 1 SQLITE_ERROR[1]): , while compiling: SELECT * FROM qr
Please help me solve this problem.