Fix series index type

This commit is contained in:
Meutel 2016-12-30 11:26:26 +01:00
parent 138a1b19b6
commit 8a88942650
3 changed files with 4 additions and 4 deletions

4
db.c
View File

@ -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);
}

View File

@ -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;

2
main.c
View File

@ -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);