From 8a889426506a7f5cec9dd25b897fda58ca0b1ee7 Mon Sep 17 00:00:00 2001 From: Meutel Date: Fri, 30 Dec 2016 11:26:26 +0100 Subject: [PATCH] Fix series index type --- db.c | 4 ++-- extern.h | 2 +- main.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db.c b/db.c index 091cc66..8b8e977 100644 --- a/db.c +++ b/db.c @@ -99,7 +99,7 @@ db_books_load(struct kreq *r, BookAdv **books, int limit) if ( ksql_stmt_isnull(stmt, 4) ) { books[i]->b.s.id = -1; } else { - books[i]->b.s_idx = ksql_stmt_int(stmt, 2); + books[i]->b.s_idx = ksql_stmt_double(stmt, 2); books[i]->b.s.name = kstrdup(ksql_stmt_str(stmt, 3)); books[i]->b.s.id = ksql_stmt_int(stmt, 4); } @@ -129,7 +129,7 @@ db_book_load(struct kreq *r, int64_t id) if ( ksql_stmt_isnull(stmt, 4) ) { book->s.id = -1; } else { - book->s_idx = ksql_stmt_int(stmt, 2); + book->s_idx = ksql_stmt_double(stmt, 2); book->s.name = kstrdup(ksql_stmt_str(stmt, 3)); book->s.id = ksql_stmt_int(stmt, 4); } diff --git a/extern.h b/extern.h index cbc94f7..d028ed0 100644 --- a/extern.h +++ b/extern.h @@ -33,7 +33,7 @@ typedef struct { int64_t id; char *title; - int s_idx; /* series index */ // FIXME pas un int + double s_idx; /* series index */ Series s; } Book; diff --git a/main.c b/main.c index 2c92934..a59bd04 100644 --- a/main.c +++ b/main.c @@ -104,7 +104,7 @@ putbook(struct kjsonreq *req, Book *b) kjson_objp_open(req, "series"); kjson_putintp(req, "id", b->s.id); kjson_putstringp(req, "name", b->s.name); - kjson_putintp(req, "idx", b->s_idx); + kjson_putdoublep(req, "idx", b->s_idx); kjson_obj_close(req); } kjson_obj_close(req);