|
|
@ -140,9 +140,14 @@ function parseResult(db_result, parseRow) { |
|
|
|
return warnings; |
|
|
|
} |
|
|
|
|
|
|
|
function isAvailable(dataBase) { |
|
|
|
return dataBase !== undefined && dataBase !== null; |
|
|
|
} |
|
|
|
|
|
|
|
function genericSelect(queriesToParsersMapper, dispatch, isFocused) { |
|
|
|
useEffect(() => { |
|
|
|
console.log("requesting data"); |
|
|
|
if (isAvailable(global.userDataBase)) { |
|
|
|
queriesToParsersMapper.forEach(([query, parser]) => { |
|
|
|
global.userDataBase.transaction((tx) => { |
|
|
|
tx.executeSql(query, [], (tx, results) => { |
|
|
@ -150,6 +155,7 @@ function genericSelect(queriesToParsersMapper, dispatch, isFocused) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, [isFocused]); |
|
|
|
} |
|
|
|
|
|
|
|