'React Native - Sqlite Save database array in a variable
I use react native and sqlite (all expo). I want to save sql data inside a variable, but I do not know how.
return new Promise((resolve, reject) => {
db.transaction(tx => {
tx.executeSql(
'SELECT ID_user, username, nome_empresa FROM tb_user WHERE username = ?;',
[route.params.paramKey],
//-----------------------
(_, { rows }) => {
if (rows.length > 0){
resolve(rows._array)
}else{ reject("Obj not found");} // nenhum registro encontrado
},
(_, error) => reject(error) // Success
);
});
});
I want to save ID_user, username and company_name because I want to show it on screen
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
