mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-01-21 18:48:34 +08:00
Postgres-style ILIKE operator (with Unicode support) (#244)
Access's `LIKE` is actually case-insensitive, but to prevent breaking existing programs that rely on mdbtools' case-sensitive behavior, introduce a new `ILIKE` operator to perform a case-insensitive match. Use GLib's `g_utf8_casefold` to make the comparison UTF-8 aware. A "poor man's" version is implemented in fakeglib, which relies on `towlower`, and won't work with multi-grapheme case transformations (e.g. German Eszett). Fixes #233
This commit is contained in:
@@ -144,6 +144,7 @@ void g_printerr(const gchar *format, ...);
|
||||
gint g_unichar_to_utf8(gunichar c, gchar *dst);
|
||||
gchar *g_locale_to_utf8(const gchar *opsysstring, size_t len,
|
||||
size_t *bytes_read, size_t *bytes_written, GError **error);
|
||||
gchar *g_utf8_casefold(const gchar *str, gssize len);
|
||||
gchar *g_utf8_strdown(const gchar *str, gssize len);
|
||||
|
||||
/* GString */
|
||||
|
||||
@@ -129,7 +129,8 @@ enum {
|
||||
MDB_LTEQ,
|
||||
MDB_LIKE,
|
||||
MDB_ISNULL,
|
||||
MDB_NOTNULL
|
||||
MDB_NOTNULL,
|
||||
MDB_ILIKE,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
@@ -164,6 +165,7 @@ enum {
|
||||
x == MDB_GTEQ || \
|
||||
x == MDB_LTEQ || \
|
||||
x == MDB_LIKE || \
|
||||
x == MDB_ILIKE || \
|
||||
x == MDB_ISNULL || \
|
||||
x == MDB_NOTNULL )
|
||||
|
||||
@@ -611,6 +613,7 @@ void mdb_dump_stats(MdbHandle *mdb);
|
||||
|
||||
/* like.c */
|
||||
int mdb_like_cmp(char *s, char *r);
|
||||
int mdb_ilike_cmp(char *s, char *r);
|
||||
|
||||
/* write.c */
|
||||
void mdb_put_int16(void *buf, guint32 offset, guint32 value);
|
||||
|
||||
Reference in New Issue
Block a user