1 History uses fts3 with an icu-based segmenter. These changes allow
2 building a sqlite3 binary which can read those files.
5 ===================================================================
6 --- src/shell.c 2009-09-04 13:37:43.000000000 -0700
7 +++ src/shell.c 2009-09-15 11:32:08.000000000 -0700
12 + /* Begin evanm patch. */
13 + extern int sqlite_shell_init_icu();
14 + if( !sqlite_shell_init_icu() ){
15 + fprintf(stderr, "%s: warning: couldn't find icudt38.dll; "
16 + "queries against ICU FTS tables will fail.\n", argv[0]);
18 + /* End evanm patch. */
22 stdin_is_interactive = isatty(0);
23 diff --git src/shell_icu_linux.c src/shell_icu_linux.c
25 index 0000000..4ad0e42
27 +++ src/shell_icu_linux.c
29 +/* Copyright 2007 Google Inc. All Rights Reserved.
34 +#include "unicode/putil.h"
35 +#include "unicode/udata.h"
38 +** This function attempts to load the ICU data tables from a data file.
39 +** Returns 0 on failure, nonzero on success.
40 +** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
42 +int sqlite_shell_init_icu() {
43 + char bin_dir[PATH_MAX + 1];
44 + int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
45 + if (bin_dir_size < 0 || bin_dir_size > PATH_MAX)
47 + bin_dir[bin_dir_size] = 0;;
49 + u_setDataDirectory(bin_dir);
50 + // Only look for the packaged data file;
51 + // the default behavior is to look for individual files.
52 + UErrorCode err = U_ZERO_ERROR;
53 + udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
54 + return err == U_ZERO_ERROR;
56 Index: src/shell_icu_win.c
57 ===================================================================
58 --- src/shell_icu_win.c 1969-12-31 16:00:00.000000000 -0800
59 +++ src/shell_icu_win.c 2011-03-03 14:29:11.000000000 -0700
61 +/* Copyright 2011 Google Inc. All Rights Reserved.
65 +#include "unicode/udata.h"
68 +** This function attempts to load the ICU data tables from a DLL.
69 +** Returns 0 on failure, nonzero on success.
70 +** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
73 +#define ICU_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
74 +int sqlite_shell_init_icu() {
79 + // Chrome dropped U_ICU_VERSION_SHORT from the icu data dll name.
80 + module = LoadLibrary(L"icudt.dll");
84 + addr = GetProcAddress(module, ICU_DATA_SYMBOL);
89 + udata_setCommonData(addr, &err);