commit 4b5eea23842388143bd97a3f4faad1f77cda01e2
parent e5b44abf728c5a5bf500527a30d80784c0c90872
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sun, 17 Mar 2024 17:33:54 -0700
Update database format to index from 1
This way I can use unsigned integers and have 0 mean the value is
unset.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stmt.c b/stmt.c
@@ -50,7 +50,7 @@ struct sqlbox_pstmt pstmts[] = {
*/
[StmtStartTime] = { .stmt =
"INSERT OR IGNORE INTO times (userid, entry, start)\n"
- " SELECT ?, IFNULL(max(entry) + 1, 0), ? FROM times\n"
+ " SELECT ?, IFNULL(max(entry) + 1, 1), ? FROM times\n"
" WHERE userid IS ? AND end IS NOT NULL"
},
[StmtStartBreakTime] = { .stmt =
@@ -74,7 +74,7 @@ struct sqlbox_pstmt pstmts[] = {
},
[StmtBreakTime] = { .stmt =
"UPDATE times SET period =\n"
- " (SELECT IFNULL(max(period) + 1, 0)\n"
+ " (SELECT IFNULL(max(period) + 1, 1)\n"
" FROM times WHERE userid IS ?)\n"
" WHERE userid IS ? AND period ISNULL"
}