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