virtualzone/landroid-bridge

Unhandled rejection: Error: SQLITE_RANGE: column index out of range

RolandRosenfeld opened this issue · 0 comments

If I set daysForTotalCut in config.json to 3, this results in the error message Unhandled rejection: Error: SQLITE_RANGE: column index out of range.
After some digging in the code, I found out, that this happens in function getPersistedDurationsSince() in the SQL query

db.all("SELECT * FROM schedule WHERE date IN (?)", dates, (e, rows) => {

where dates is not only one date but a list of dates.
The following ugly patch works around this issue:

-                db.all("SELECT * FROM schedule WHERE date IN (?)", dates, (e, rows) => {
+                db.all("SELECT * FROM schedule WHERE date IN ("+dates+")", (e, rows) => {

I'm not sure, whether there is a way to feed a list of dates to the questionmark syntax.