aboutsummaryrefslogtreecommitdiffstats
path: root/src/sticker/StickerDatabase.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-12 22:26:04 +0100
committerMax Kellermann <max@duempel.org>2014-12-12 22:26:04 +0100
commit49968541fd1229a92e5eadbd037b051d3b6a87da (patch)
treeb9972ecf8f26b1d6f787433b9cb50cc3bc2d5399 /src/sticker/StickerDatabase.cxx
parentcc143105b884bfcaa188c6e9f93babec5958ea87 (diff)
downloadmpd-49968541fd1229a92e5eadbd037b051d3b6a87da.tar.gz
mpd-49968541fd1229a92e5eadbd037b051d3b6a87da.tar.xz
mpd-49968541fd1229a92e5eadbd037b051d3b6a87da.zip
sticker/Match: add inequality operators
Diffstat (limited to 'src/sticker/StickerDatabase.cxx')
-rw-r--r--src/sticker/StickerDatabase.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sticker/StickerDatabase.cxx b/src/sticker/StickerDatabase.cxx
index bd809c1d3..df6dc22dd 100644
--- a/src/sticker/StickerDatabase.cxx
+++ b/src/sticker/StickerDatabase.cxx
@@ -44,6 +44,8 @@ enum sticker_sql {
STICKER_SQL_DELETE_VALUE,
STICKER_SQL_FIND,
STICKER_SQL_FIND_VALUE,
+ STICKER_SQL_FIND_LT,
+ STICKER_SQL_FIND_GT,
};
static const char *const sticker_sql[] = {
@@ -64,6 +66,12 @@ static const char *const sticker_sql[] = {
//[STICKER_SQL_FIND_VALUE] =
"SELECT uri,value FROM sticker WHERE type=? AND uri LIKE (? || '%') AND name=? AND value=?",
+
+ //[STICKER_SQL_FIND_LT] =
+ "SELECT uri,value FROM sticker WHERE type=? AND uri LIKE (? || '%') AND name=? AND value<?",
+
+ //[STICKER_SQL_FIND_GT] =
+ "SELECT uri,value FROM sticker WHERE type=? AND uri LIKE (? || '%') AND name=? AND value>?",
};
static const char sticker_sql_create[] =
@@ -392,6 +400,16 @@ BindFind(const char *type, const char *base_uri, const char *name,
return BindAllOrNull(error,
sticker_stmt[STICKER_SQL_FIND_VALUE],
type, base_uri, name, value);
+
+ case StickerOperator::LESS_THAN:
+ return BindAllOrNull(error,
+ sticker_stmt[STICKER_SQL_FIND_LT],
+ type, base_uri, name, value);
+
+ case StickerOperator::GREATER_THAN:
+ return BindAllOrNull(error,
+ sticker_stmt[STICKER_SQL_FIND_GT],
+ type, base_uri, name, value);
}
assert(false);