From 0ecc7911d9d41086a766b5a4d834cd0eec61dd2d Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Thu, 14 May 2020 20:10:31 +0200 Subject: [PATCH] Also set column name from the table 'kara' when possible --- inc/lektor/uri.h | 1 + src/uri.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/inc/lektor/uri.h b/inc/lektor/uri.h index caf93425..bf73b9fc 100644 --- a/inc/lektor/uri.h +++ b/inc/lektor/uri.h @@ -16,6 +16,7 @@ enum lkt_uri_type { struct lkt_uri { enum lkt_uri_type type; + const char *column_name; union { void *value; size_t id; diff --git a/src/uri.c b/src/uri.c index 926dbd42..523a46f8 100644 --- a/src/uri.c +++ b/src/uri.c @@ -23,24 +23,31 @@ __prefix(char *str, struct lkt_uri *ret) return NULL; if (STR_NMATCH(str, "id", 2)) { + ret->column_name = LKT_DATABASE_NAME_KID; ret->type = uri_id; val = str + 2; } else if (STR_NMATCH(str, "playlist", 8)) { + ret->column_name = NULL; ret->type = uri_playlist; val = str + 3; } else if (STR_NMATCH(str, "type", 4)) { + ret->column_name = LKT_DATABASE_NAME_KTYPE; ret->type = uri_type; val = str + 4; } else if (STR_NMATCH(str, "author", 6)) { + ret->column_name = LKT_DATABASE_NAME_KAUTHOR; ret->type = uri_author; val = str + 6; } else if (STR_NMATCH(str, "category", 8)) { + ret->column_name = LKT_DATABASE_NAME_KCAT; ret->type = uri_category; val = str + 8; } else if (STR_NMATCH(str, "lang", 4)) { + ret->column_name = LKT_DATABASE_NAME_KLANG; ret->type = uri_language; val = str + 4; } else if (STR_NMATCH(str, "query", 5)) { + ret->column_name = LKT_DATABASE_KARA_ALL; ret->type = uri_query; val = str + 5; } else -- GitLab