diff options
author | 2014-03-24 01:37:28 +0000 | |
---|---|---|
committer | 2014-03-24 01:37:28 +0000 | |
commit | 29ebcee2452a131560f5220abaf585648f84ce40 (patch) | |
tree | 844ef4fe135beff619b9e7b632f3b6722d6367e4 /lib/libsqlite3/ext/misc/nextchar.c | |
parent | annotate some packed structures with the alignment the hardware (diff) | |
download | wireguard-openbsd-29ebcee2452a131560f5220abaf585648f84ce40.tar.xz wireguard-openbsd-29ebcee2452a131560f5220abaf585648f84ce40.zip |
Update sqlite to 3.8.4. A list of changes are available here:
http://sqlite.org/changes.html.
Tested in a bulk and ok landry@
Diffstat (limited to 'lib/libsqlite3/ext/misc/nextchar.c')
-rw-r--r-- | lib/libsqlite3/ext/misc/nextchar.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libsqlite3/ext/misc/nextchar.c b/lib/libsqlite3/ext/misc/nextchar.c index 6dcbd2dbc31..49dfd24f1f1 100644 --- a/lib/libsqlite3/ext/misc/nextchar.c +++ b/lib/libsqlite3/ext/misc/nextchar.c @@ -38,6 +38,19 @@ ** out) run the following query: ** ** SELECT next_char('cha','dictionary','word'); +** +** IMPLEMENTATION NOTES: +** +** The next_char function is implemented using recursive SQL that makes +** use of the table name and column name as part of a query. If either +** the table name or column name are keywords or contain special characters, +** then they should be escaped. For example: +** +** SELECT next_char('cha','[dictionary]','[word]'); +** +** This also means that the table name can be a subquery: +** +** SELECT next_char('cha','(SELECT word AS w FROM dictionary)','w'); */ #include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 @@ -231,9 +244,9 @@ static void nextCharFunc( zColl = ""; } zSql = sqlite3_mprintf( - "SELECT \"%w\" FROM \"%w\"" - " WHERE \"%w\">=(?1 || ?2) %s" - " AND \"%w\"<=(?1 || char(1114111)) %s" /* 1114111 == 0x10ffff */ + "SELECT %s FROM %s" + " WHERE %s>=(?1 || ?2) %s" + " AND %s<=(?1 || char(1114111)) %s" /* 1114111 == 0x10ffff */ " %s" " ORDER BY 1 %s ASC LIMIT 1", zField, zTable, zField, zColl, zField, zColl, zWhereClause, zColl |