Blockquote
I also created database with table and store it into android/app/src/main/assets/sqlite.db and also set createFromLocation to 1 or 2
useEffect(() => {
try {
db = SQLite.openDatabase({
name: "sqlite.db",
createFromLocation:"~sqlite.db"
},
sucessToOpen,
errorToOpen
)
}
catch (err) {
console.log(err)
}
}, [])
....
const sucessToOpen = async (data) => {
console.log("DB connected",data)
db.transaction(tx => {
tx.executeSql(
'SELECT * FROM hydro',[],
(tx, results) => {
let datalength = results.row.length
alert(datalength)
console.log("results",datalength)
},
)
});
}
This work for me
db.transaction(tx => {
tx.executeSql('SELECT * FROM TABLE_NAME', [], (tx, results) => {
var temp = [];
for (let i = 0; i < results.rows.length; ++i) {
temp.push(results.rows.item(i));
}
console.log('TABLE_NAME', temp)
});
});