mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add the anycollseq.c loadable extension in etc/misc
FossilOrigin-Name: d7b9813cb17615c3d00afd6994a4309d6d48c8e924b6cd813c543e1fa65c7719
This commit is contained in:
58
ext/misc/anycollseq.c
Normal file
58
ext/misc/anycollseq.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
** 2017-04-16
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** This file implements a run-time loadable extension to SQLite that
|
||||
** registers a sqlite3_collation_needed() callback to register a fake
|
||||
** collating function for any unknown collating sequence. The fake
|
||||
** collating function works like BINARY.
|
||||
**
|
||||
** This extension can be used to load schemas that contain one or more
|
||||
** unknown collating sequences.
|
||||
*/
|
||||
#include "sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT1
|
||||
#include <string.h>
|
||||
|
||||
static int anyCollFunc(
|
||||
void *NotUsed,
|
||||
int nKey1, const void *pKey1,
|
||||
int nKey2, const void *pKey2
|
||||
){
|
||||
int rc, n;
|
||||
n = nKey1<nKey2 ? nKey1 : nKey2;
|
||||
rc = memcmp(pKey1, pKey2, n);
|
||||
if( rc==0 ) rc = nKey1 - nKey2;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void anyCollNeeded(
|
||||
void *NotUsed,
|
||||
sqlite3 *db,
|
||||
int eTextRep,
|
||||
const char *zCollName
|
||||
){
|
||||
sqlite3_create_collation(db, zCollName, eTextRep, 0, anyCollFunc);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
int sqlite3_anycollseq_init(
|
||||
sqlite3 *db,
|
||||
char **pzErrMsg,
|
||||
const sqlite3_api_routines *pApi
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
SQLITE_EXTENSION_INIT2(pApi);
|
||||
rc = sqlite3_collation_needed(db, 0, anyCollNeeded);
|
||||
return rc;
|
||||
}
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C In\sthe\sskip-ahead-distinct\soptimization,\sfix\sa\sbug\sin\sthe\slogic\sthat\sdetermines\nwhen\sto\sinvoke\sthe\soptimization\sbased\son\ssqlite_stat1\sstatistics.
|
||||
D 2017-04-15T11:53:47.342
|
||||
C Add\sthe\sanycollseq.c\sloadable\sextension\sin\setc/misc
|
||||
D 2017-04-16T22:08:31.808
|
||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
|
||||
@ -209,6 +209,7 @@ F ext/icu/icu.c 84900472a088a3a172c6c079f58a1d3a1952c332
|
||||
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
|
||||
F ext/misc/README.md 8e008c8d2b02e09096b31dfba033253ac27c6c06a18aa5826e299fa7601d90b2
|
||||
F ext/misc/amatch.c 211108e201105e4bb0c076527b8cfd34330fc234
|
||||
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
||||
F ext/misc/carray.c 40c27641010a4dc67e3690bdb7c9d36ca58b3c2d
|
||||
F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704
|
||||
F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
|
||||
@ -1572,8 +1573,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d78355c85f49e139f1ac1a660563865350f0e442652b7bc50b684398f81cc602 e50fd48969f99bc988389c53ff46714603b1d11de12c71b55c00cbee037f073c
|
||||
R a0fc0755acaae22ae06336777dc36757
|
||||
T +closed e50fd48969f99bc988389c53ff46714603b1d11de12c71b55c00cbee037f073c
|
||||
P 89f9e4363aa19f306e55f749c442eae2f8994f6a47c65e645a79b308b450d5e5
|
||||
R 7e7a9c3544574aec28a263899284e68c
|
||||
U drh
|
||||
Z 7aacb0cf945619cb618007e65cb171f4
|
||||
Z ee9d941ffe6bc63689ac0fdb0270a043
|
||||
|
@ -1 +1 @@
|
||||
89f9e4363aa19f306e55f749c442eae2f8994f6a47c65e645a79b308b450d5e5
|
||||
d7b9813cb17615c3d00afd6994a4309d6d48c8e924b6cd813c543e1fa65c7719
|
Reference in New Issue
Block a user