Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From 1bd9de719b0944fd To 301df5c2beb08e8e
2024-12-01
| ||
14:02 | Export a clipped copy of sqlite370.eps as sqlite370.svg, based on discussion in forum post 1bbd6d17ca. (check-in: dd3a13c120 user: stephan tags: trunk) | |
2024-11-30
| ||
17:48 | At the end of the configure script ensure that none of the files which are filtered for @VARS@ contain any unresolved @VAR@ placeholders, failing fatally if any do. (check-in: 301df5c2be user: stephan tags: trunk) | |
14:13 | In sqlite_dbpage, cancel any pending truncate operation if there an error occurs later in the transaction. (check-in: 1abab10f85 user: drh tags: trunk) | |
2024-11-08
| ||
14:34 | Remove one dep from .tclenv.sh which is only valid for configure-driven builds, not static makefiles. (check-in: 22986767da user: stephan tags: trunk) | |
13:37 | Add 'tcl' makefile target which builds all but tclextension (which does not have a well-defined name and dependencies). Improve the deps for .tclenv.sh to avoid getting a stale tclsh when re-configuring with a different --with-tcl(sh). (check-in: 1bd9de719b user: stephan tags: trunk) | |
08:01 | Add missing CFLAGS.intree_includes to T.compile.tcl to fix build of tclsqlite3. (check-in: bb3c6dc126 user: stephan tags: trunk) | |
Changes to Makefile.in.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - | #!/usr/bin/make # ^^^^ help out editors which guess this file's type. # # Makefile for SQLITE # # This makefile is intended to be configured automatically using the # configure script. # # The docs for many of its variables are in the primary static # makefile, main.mk (which this one includes at runtime). # |
︙ | |||
38 39 40 41 42 43 44 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - - - - - - - - - + - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - | # # # The top-most directory of the source tree. This is the directory # that contains this "Makefile.in" and the "configure" script. # TOP = @abs_top_srcdir@ |
︙ | |||
125 126 127 128 129 130 131 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - + - - - + + - + + - - - - - - - - - - | # details. # # Historical note: the pre-3.48 build only honored CPPFLAGS at # configure-time, and expanded them into the generated Makefile. There # are, in that build, no uses of CPPFLAGS in the configure-expanded # Makefile. Ergo: if a client configures with CPPFLAGS=... and then # explicitly passes CFLAGS=... to make, the CPPFLAGS will be |
︙ | |||
253 254 255 256 257 258 259 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - + | # clients are not required to pass it at make-time, or set it in their # environment, to override it. # TCLLIBDIR = @TCLLIBDIR@ # # Additional options when running tests using testrunner.tcl |
︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + - + | # # Shell commands to re-run $(TOP)/configure with the same args it was # invoked with to produce this makefile. # AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@ USE_AMALGAMATION ?= @USE_AMALGAMATION@ LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@ AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@ # # CFLAGS for sqlite3$(T.exe) # SHELL_OPT ?= @OPT_SHELL@ Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF) $(AS_AUTORECONFIG) @touch $@ sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF) $(AS_AUTORECONFIG) @touch $@ install: install-pc # defined in main.mk |
︙ |
Changes to auto.def.
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | - + + - + + | # A very long story made short, autosetup's --flag handling has # some behaviors which make it impossible to implement 100% identical # flags compared to the historical autotools build. The differences # are documented here: # # 1) --debug is used by autosetup itself, so we have to rename it to # --with-debug. We cannot use --enable-debug because that is, for |
︙ | |||
60 61 62 63 64 65 66 | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + - - - + + - - - + + + - + - - - - - - - - + - - - - - - - - + + + + + + + - | # boolopt2=1 => "a boolean option which defaults to enabled" # stringopt: => "an option which takes an argument, e.g. --stringopt=value" # stringopt2:=value => "an option where the argument is optional and defaults to 'value'" # optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help" # # Autosetup does no small amount of specialized handling for flags, # especially booleans. Each bool-type --FLAG implicitly gets |
︙ | |||
143 144 145 146 147 148 149 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | + - - + + - - - - - - - - - - - + + + + + + + + + + + + - | update-limit => {Enable the UPDATE/DELETE LIMIT clause} geopoly => {Enable the GEOPOLY extension} rtree => {Enable the RTREE extension} session => {Enable the SESSION extension} all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions} # </lib-feature> # <tcl> with-tcl:DIR => |
︙ | |||
178 179 180 181 182 183 184 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | + + - + + + + + + + + + + + + + - + - - + + + + - - - + + + + - + - + - + | => {Full path to readline.h, from which --with-readline-cflags will be derived} with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h} editline=0 => {Enable BSD editline support} # </line-editing> # <icu> with-icu-ldflags:LDFLAGS => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} with-icu-cflags:CFLAGS => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} |
︙ | |||
291 292 293 294 295 296 297 | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | - - - + + + + + + + + + + + - - + + - + + + | } } proj-file-extensions if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_UNIX 0 define SQLITE_OS_WIN 1 |
︙ | |||
387 388 389 390 391 392 393 394 395 396 397 398 399 400 | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | + + + + + | define CC "${wasiSdkDir}/bin/clang" define LD "${wasiSdkDir}/bin/wasm-ld" define AR "${wasiSdkDir}/bin/ar" #define STRIP "${wasiSdkDir}/bin/strip" return 1 }; # sqlite-check-wasi-sdk sqlite-check-wasi-sdk ######################################################################## # --dynlink-tools tells the build to dynamically link certain binaries # to libsqlite3.so instead of embedding a copy of the amalgamation. define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] # # Enable large file support (if special flags are necessary) define HAVE_LFS 0 if {[opt-bool largefile]} { cc-check-lfs } |
︙ | |||
431 432 433 434 435 436 437 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | - - - - - - - - - - + + + + - + + + + + - + - - - + + + + + - + + + + - - + + + + + + - + - - + - - + - + - + - + - + - + - + | define HAVE_ZLIB 0 define LDFLAGS_ZLIB "" } proj-check-rpath ; # Determine proper rpath-handling flag ######################################################################## |
︙ | |||
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | + - - + + - + | # components. # # If --tcl or --with-tcl are provided but no TCL is found, this # function fails fatally. If they are not explicitly provided then # failure to find TCL is not fatal but a loud warning will be emitted. # proc sqlite-check-tcl {} { rename sqlite-check-tcl "" define TCLSH_CMD false ; # Significant is that it exits with non-0 define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search define TCLLIBDIR "" ; # Installation dir for TCL extension lib define TCL_CONFIG_SH ""; # full path to tclConfig.sh file delete -force ".tclenv.sh"; # ensure no stale state from previous configures. if {![opt-bool tcl]} { proj-indented-notice { NOTE: TCL is disabled via --disable-tcl. This means that none |
︙ | |||
626 627 628 629 630 631 632 | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | - + - + - - + + | msg-result "Using tclConfig.sh: $cfg" break } define TCL_CONFIG_SH $cfg # Export a subset of tclConfig.sh to the current TCL-space. If $cfg # is an empty string, this emits empty-string entries for the # various options we're interested in. |
︙ | |||
682 683 684 685 686 687 688 689 690 691 692 693 | 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | + + + + - + - - + - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + - + - + - - + | if {$cfg ne ""} { define HAVE_TCL 1 } else { proj-warn "Found tclsh but no tclConfig.sh." } } show-notices # If TCL is not found: if it was explicitly requested then fail # fatally, else just emit a warning. If we can find the APIs needed # to generate a working JimTCL then that will suffice for build-time # TCL purposes (see: proc sqlite-determine-codegen-tcl). if {![get-define HAVE_TCL] && ([proj-opt-was-provided tcl] || [proj-opt-was-provided with-tcl])} { proj-fatal "TCL support was requested but no tclConfig.sh could be found." } if {"" eq $cfg} { |
︙ | |||
869 870 871 872 873 874 875 876 877 878 879 880 881 882 | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | + | # # 4) Default to automatic search for optional readline # # 5) Try to find readline or editline. If it's not found AND the # corresponding --FEATURE flag was explicitly given, fail fatally, # else fail silently. proc sqlite-check-line-editing {} { rename sqlite-check-line-editing "" msg-result "Checking for line-editing capability..." define HAVE_READLINE 0 define HAVE_LINENOISE 0 define HAVE_EDITLINE 0 define LDFLAGS_READLINE "" define CFLAGS_READLINE "" set failIfNotFound 0 ; # Gets set to 1 for explicit --FEATURE requests |
︙ | |||
1038 1039 1040 1041 1042 1043 1044 | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | - - + + | libedit. } } set rlLib [join $rlLib] set rlInc [join $rlInc] define LDFLAGS_READLINE $rlLib define CFLAGS_READLINE $rlInc |
︙ | |||
1104 1105 1106 1107 1108 1109 1110 | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | - + + + + + + + + + + + + - - - + + + - - - + + + + - + - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + + + + + - + - + - - - - - + + + + + + + | ######################################################################## # ICU - International Components for Unicode # # Handles these flags: # # --with-icu-ldflags=LDFLAGS |
︙ | |||
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | + | if {[opt-bool memsys5]} { proj-warn "not enabling memsys3 because memsys5 is enabled." expr 0 } else { sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3 } } scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {} } { proj-if-opt-truthy $boolFlag { sqlite-add-feature-flag $featureFlag if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} { msg-result " + $boolFlag" } } { |
︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | - + - + - - - - - - - - - - - - - + + + + + + + - | sqlite-add-feature-flag $featureFlag msg-result " - $boolFlag" } } ######################################################################### # Show the final feature flag sets: |
︙ | |||
1324 1325 1326 1327 1328 1329 1330 | 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | + + + + + + + + + + + + + + + + + + + + + + + | } lappend dumpDefsOpt -none * proj-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt undefine OPT_FEATURE_FLAGS.list undefine OPT_SHELL.list } } ######################################################################## # Perform some high-level validation on the generated files... # # 1) Ensure that no unresolved @VAR@ placeholders are in files which # use those. # # 2) TBD apply {{} { # Check #1: ensure that files which get filtered for @VAR@ do not # contain any unresolved @VAR@ refs. That may indicate an # unexported/unused var or a typo. foreach f "Makefile sqlite3.pc $::srcdir/tool/emcc.sh" { if {![file exists $f]} continue set lnno 1 foreach line [proj-file-content-list $f] { if {[regexp {(@[A-Za-z_]+@)} $line match]} { error "Unresolved reference to $match at line $lnno of $f" } incr lnno } } }} |
Changes to autosetup/README.md.
︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + | - [Autosetup API Reference](#apiref) - [API Tips](#apitips) - [Ensuring TCL Compatibility](#tclcompat) - [Design Conventions](#conventions) - Symbolic Names of Feature Flags - Do Not Update Global Shared State - [Updating Autosetup](#updating) - [Patching Autosetup for Project-local changes](#patching) ------------------------------------------------------------------------ <a name="apiref"></a> Autosetup API Reference ======================================================================== |
︙ | |||
51 52 53 54 55 56 57 | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - + - - - - + + + + - - + - - + + | scattered around [the TCL files in ./autosetup](/dir/autosetup). In (mostly) alphabetical order: - **`file-isexec filename`**\ Should be used in place of `[file executable]`, as it will also check for `${filename}.exe` on Windows platforms. However, on such |
︙ | |||
108 109 110 111 112 113 114 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - - - - - + + + + + + - + + + | of "truthy." - **`proj-warn msg`**\ Emits `$msg` to stderr. Closely-related is autosetup's `user-notice` (described below). - **`sqlite-add-feature-flag ?-shell? FLAG...`**\ |
︙ | |||
164 165 166 167 168 169 170 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - - + + - - - + + + - + | 2. Manually build `./jimsh0` in the top of the checkout with:\ `cc -o jimsh0 autosetup/jimsh0.c`\ With that in place, the configure script will prefer to use that before looking for a system-level `tclsh`. Be aware, though, that `make distclean` will remove that file. |
︙ | |||
239 240 241 242 243 244 245 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | - + | in a specific order so that the resulting flags get applied at the correct time and/or in the correct order.\ (A real-life example: before the approach described below was taken to collecting build-time flags, the test for `-rpath` had to come _after_ the test for zlib because the results of the `-rpath` test implicitly modified global state which broke the zlib feature test. Because the feature tests no longer (intentionally) modify |
︙ | |||
300 301 302 303 304 305 306 | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - + + + + + + + + + + + + + + + + + + | > ``` $ /path/to/autosetup-checkout/autosetup --install . $ fossil status # show the modified files ``` Unless the upgrade made any incompatible changes (which is exceedingly |
Changes to autosetup/autosetup.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | #!/bin/sh # Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # vim:se syntax=tcl: # \ dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@" # Note that the version has a trailing + on unreleased versions set autosetup(version) 0.7.2 # Can be set to 1 to debug early-init problems |
︙ | |||
94 95 96 97 98 99 100 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + | #"=Core Options:" options-add { help:=all => "display help and options. Optional: module name, such as --help=system" licence license => "display the autosetup license" version => "display the version of autosetup" ref:=text manual:=text reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'" |
︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - + | # autosetup --conf=alternate-auto.def if {[opt-str conf o]} { set autosetup(autodef) $o } # Debugging output (set this early) |
︙ | |||
2526 2527 2528 2529 2530 2531 2532 | 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 | - + | if {$autosetup(debug)} { main $argv } if {[catch {main $argv} msg opts] == 1} { show-notices autosetup-full-error [error-dump $msg $opts $autosetup(debug)] if {!$autosetup(debug)} { |
Deleted autosetup/default.auto.
| - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Changes to autosetup/proj.tcl.
︙ | |||
73 74 75 76 77 78 79 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - - - + + + + + - + + - - + + + + + | puts stderr "ERROR: $msg" exit 1 } ######################################################################## # @proj-assert script # |
︙ | |||
128 129 130 131 132 133 134 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | + + + + - + + | default { break } } } set lines [split [join $args] \n] foreach line $lines { set line [string trimleft $line] if {"" eq $line} { $outFunc $line } else { |
︙ | |||
301 302 303 304 305 306 307 | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - - - - + + + + + - | } return $rc } ######################################################################## # @proj-opt-was-provided key # |
︙ | |||
382 383 384 385 386 387 388 | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | - + - + | uplevel 1 $thenScript } else { uplevel 1 $elseScript } } ######################################################################## |
︙ | |||
936 937 938 939 940 941 942 | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | - + | } ######################################################################## # @proj-check-soname ?libname? # # Checks whether CC supports the -Wl,soname,lib... flag. If so, it # returns 1 and defines LDFLAGS_SONAME_PREFIX to the flag's prefix, to |
︙ | |||
1196 1197 1198 1199 1200 1201 1202 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | - - - - + + + | # use FOO if exec_prefix is not overridden at make-time. Without this # post-processing, libdir would be cemented in as FOO/lib at # configure-time, so could be tedious to override properly via a make # invocation. proc proj-remap-autoconf-dir-vars {} { set prefix [get-define prefix] set exec_prefix [get-define exec_prefix $prefix] |
︙ |
Deleted autosetup/tmake.auto.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Deleted autosetup/tmake.tcl.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Changes to ext/expert/sqlite3expert.c.
︙ | |||
1487 1488 1489 1490 1491 1492 1493 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | - + | if( zType[0]=='v' || zType[1]=='r' || bVirtual ){ /* A view. Or a trigger on a view. */ if( zSql ) rc = expertSchemaSql(p->dbv, zSql, pzErrmsg); }else{ IdxTable *pTab; rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg); |
︙ |
Changes to ext/fts3/fts3.c.
︙ | |||
2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | + + + + + | /* Never set both isSaveLeft and isExact for the same invocation. */ assert( isSaveLeft==0 || isExact==0 ); assert_fts3_nc( p!=0 && *p1!=0 && *p2!=0 ); if( *p1==POS_COLUMN ){ p1++; p1 += fts3GetVarint32(p1, &iCol1); /* iCol1==0 indicates corruption. Column 0 does not have a POS_COLUMN ** entry, so this is actually end-of-doclist. */ if( iCol1==0 ) return 0; } if( *p2==POS_COLUMN ){ p2++; p2 += fts3GetVarint32(p2, &iCol2); /* As above, iCol2==0 indicates corruption. */ if( iCol2==0 ) return 0; } while( 1 ){ if( iCol1==iCol2 ){ char *pSave = p; sqlite3_int64 iPrev = 0; sqlite3_int64 iPos1 = 0; |
︙ |
Changes to ext/fts3/fts3_expr.c.
︙ | |||
315 316 317 318 319 320 321 | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | - - - + + + + - - - - + + + + + - - - - - - - + + - - - + + + + + | const char *zByte; int nByte = 0, iBegin = 0, iEnd = 0, iPos = 0; rc = pModule->xNext(pCursor, &zByte, &nByte, &iBegin, &iEnd, &iPos); if( rc==SQLITE_OK ){ Fts3PhraseToken *pToken; p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken)); |
︙ |
Changes to ext/fts5/fts5.h.
︙ | |||
294 295 296 297 298 299 300 | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | - - - + + + + + + + + + + + + + + + + + + - + | ** ** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken) ** This is used to access token iToken of phrase hit iIdx within the ** current row. If iIdx is less than zero or greater than or equal to the ** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise, ** output variable (*ppToken) is set to point to a buffer containing the ** matching document token, and (*pnToken) to the size of that buffer in |
︙ |
Changes to ext/fts5/fts5Int.h.
︙ | |||
243 244 245 246 247 248 249 | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + + | int nAutomerge; /* 'automerge' setting */ int nCrisisMerge; /* Maximum allowed segments per level */ int nUsermerge; /* 'usermerge' setting */ int nHashSize; /* Bytes of memory for in-memory hash */ char *zRank; /* Name of rank function */ char *zRankArgs; /* Arguments to rank function */ int bSecureDelete; /* 'secure-delete' */ |
︙ | |||
500 501 502 503 504 505 506 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | - + + + + + + + + | void *sqlite3Fts5StructureRef(Fts5Index*); void sqlite3Fts5StructureRelease(void*); int sqlite3Fts5StructureTest(Fts5Index*, void*); /* ** Used by xInstToken(): */ |
︙ |
Changes to ext/fts5/fts5_config.c.
︙ | |||
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | + + + + + + + + + + + + + | bVal = sqlite3_value_int(pVal); } if( bVal<0 ){ *pbBadkey = 1; }else{ pConfig->bSecureDelete = (bVal ? 1 : 0); } } else if( 0==sqlite3_stricmp(zKey, "insttoken") ){ int bVal = -1; if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ bVal = sqlite3_value_int(pVal); } if( bVal<0 ){ *pbBadkey = 1; }else{ pConfig->bPrefixInsttoken = (bVal ? 1 : 0); } }else{ *pbBadkey = 1; } return rc; } /* |
︙ |
Changes to ext/fts5/fts5_expr.c.
︙ | |||
3042 3043 3044 3045 3046 3047 3048 | 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 | - + | for(pT=&pExpr->apExprPhrase[i]->aTerm[0]; pT; pT=pT->pSynonym){ if( (pT->nQueryTerm==nQuery || (pT->nQueryTerm<nQuery && pT->bPrefix)) && memcmp(pT->pTerm, pToken, pT->nQueryTerm)==0 ){ int rc = sqlite3Fts5PoslistWriterAppend( &pExpr->apExprPhrase[i]->poslist, &p->aPopulator[i].writer, p->iOff ); |
︙ | |||
3235 3236 3237 3238 3239 3240 3241 | 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 | - - - - - - - - + + + + + + + + - | return SQLITE_RANGE; } pPhrase = pExpr->apExprPhrase[iPhrase]; if( iToken<0 || iToken>=pPhrase->nTerm ){ return SQLITE_RANGE; } pTerm = &pPhrase->aTerm[iToken]; |
︙ |
Changes to ext/fts5/fts5_index.c.
︙ | |||
6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 | 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + - - - + + - - - - + + + + - + - + - + - - - - - - - - - - - + - - - - - - - - - - - - + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + - - + - - + + - - - + + + + + + + + + + - + | fts5BufferFree(p1); fts5BufferFree(&tmp); memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING); *p1 = out; } /* ** Iterate through a range of entries in the FTS index, invoking the xVisit ** callback for each of them. ** ** Parameter pToken points to an nToken buffer containing an FTS index term ** (i.e. a document term with the preceding 1 byte index identifier - ** FTS5_MAIN_PREFIX or similar). If bPrefix is true, then the call visits ** all entries for terms that have pToken/nToken as a prefix. If bPrefix ** is false, then only entries with pToken/nToken as the entire key are ** visited. ** ** If the current table is a tokendata=1 table, then if bPrefix is true then ** each index term is treated separately. However, if bPrefix is false, then ** all index terms corresponding to pToken/nToken are collapsed into a single ** term before the callback is invoked. ** ** The callback invoked for each entry visited is specified by paramter xVisit. ** Each time it is invoked, it is passed a pointer to the Fts5Index object, ** a copy of the 7th paramter to this function (pCtx) and a pointer to the ** iterator that indicates the current entry. If the current entry is the ** first with a new term (i.e. different from that of the previous entry, ** including the very first term), then the final two parameters are passed ** a pointer to the term and its size in bytes, respectively. If the current ** entry is not the first associated with its term, these two parameters ** are passed 0. ** ** If parameter pColset is not NULL, then it is used to filter entries before ** the callback is invoked. */ static int fts5VisitEntries( Fts5Index *p, /* Fts5 index object */ Fts5Colset *pColset, /* Columns filter to apply, or NULL */ u8 *pToken, /* Buffer containing token */ int nToken, /* Size of buffer pToken in bytes */ int bPrefix, /* True for a prefix scan */ void (*xVisit)(Fts5Index*, void *pCtx, Fts5Iter *pIter, const u8*, int), void *pCtx /* Passed as second argument to xVisit() */ ){ const int flags = (bPrefix ? FTS5INDEX_QUERY_SCAN : 0) | FTS5INDEX_QUERY_SKIPEMPTY | FTS5INDEX_QUERY_NOOUTPUT; Fts5Iter *p1 = 0; /* Iterator used to gather data from index */ int bNewTerm = 1; Fts5Structure *pStruct = fts5StructureRead(p); fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1); fts5IterSetOutputCb(&p->rc, p1); for( /* no-op */ ; fts5MultiIterEof(p, p1)==0; fts5MultiIterNext2(p, p1, &bNewTerm) ){ Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ]; int nNew = 0; const u8 *pNew = 0; p1->xSetOutputs(p1, pSeg); if( p->rc ) break; if( bNewTerm ){ nNew = pSeg->term.n; pNew = pSeg->term.p; if( nNew<nToken || memcmp(pToken, pNew, nToken) ) break; } xVisit(p, pCtx, p1, pNew, nNew); } fts5MultiIterFree(p1); fts5StructureRelease(pStruct); return p->rc; } /* ** Usually, a tokendata=1 iterator (struct Fts5TokenDataIter) accumulates an ** array of these for each row it visits (so all iRowid fields are the same). ** Or, for an iterator used by an "ORDER BY rank" query, it accumulates an ** array of these for the entire query (in which case iRowid fields may take ** a variety of values). ** ** Each instance in the array indicates the iterator (and therefore term) ** associated with position iPos of rowid iRowid. This is used by the ** xInstToken() API. ** ** iRowid: ** Rowid for the current entry. ** ** iPos: ** Position of current entry within row. In the usual ((iCol<<32)+iOff) ** format (e.g. see macros FTS5_POS2COLUMN() and FTS5_POS2OFFSET()). ** ** iIter: ** If the Fts5TokenDataIter iterator that the entry is part of is ** actually an iterator (i.e. with nIter>0, not just a container for ** Fts5TokenDataMap structures), then this variable is an index into ** the apIter[] array. The corresponding term is that which the iterator ** at apIter[iIter] currently points to. ** ** Or, if the Fts5TokenDataIter iterator is just a container object ** (nIter==0), then iIter is an index into the term.p[] buffer where ** the term is stored. ** ** nByte: ** In the case where iIter is an index into term.p[], this variable ** is the size of the term in bytes. If iIter is an index into apIter[], ** this variable is unused. */ struct Fts5TokenDataMap { i64 iRowid; /* Row this token is located in */ i64 iPos; /* Position of token */ int iIter; /* Iterator token was read from */ int nByte; /* Length of token in bytes (or 0) */ }; /* ** An object used to supplement Fts5Iter for tokendata=1 iterators. ** ** This object serves two purposes. The first is as a container for an array ** of Fts5TokenDataMap structures, which are used to find the token required ** when the xInstToken() API is used. This is done by the nMapAlloc, nMap and ** aMap[] variables. */ struct Fts5TokenDataIter { int nMapAlloc; /* Allocated size of aMap[] in entries */ int nMap; /* Number of valid entries in aMap[] */ Fts5TokenDataMap *aMap; /* Array of (rowid+pos -> token) mappings */ /* The following are used for prefix-queries only. */ Fts5Buffer terms; /* The following are used for other full-token tokendata queries only. */ int nIter; int nIterAlloc; Fts5PoslistReader *aPoslistReader; int *aPoslistToIter; Fts5Iter *apIter[1]; }; /* ** The two input arrays - a1[] and a2[] - are in sorted order. This function ** merges the two arrays together and writes the result to output array ** aOut[]. aOut[] is guaranteed to be large enough to hold the result. ** ** Duplicate entries are copied into the output. So the size of the output ** array is always (n1+n2) entries. */ static void fts5TokendataMerge( Fts5TokenDataMap *a1, int n1, /* Input array 1 */ Fts5TokenDataMap *a2, int n2, /* Input array 2 */ Fts5TokenDataMap *aOut /* Output array */ ){ int i1 = 0; int i2 = 0; assert( n1>=0 && n2>=0 ); while( i1<n1 || i2<n2 ){ Fts5TokenDataMap *pOut = &aOut[i1+i2]; if( i2>=n2 || (i1<n1 && ( a1[i1].iRowid<a2[i2].iRowid || (a1[i1].iRowid==a2[i2].iRowid && a1[i1].iPos<=a2[i2].iPos) ))){ memcpy(pOut, &a1[i1], sizeof(Fts5TokenDataMap)); i1++; }else{ memcpy(pOut, &a2[i2], sizeof(Fts5TokenDataMap)); i2++; } } } /* ** Append a mapping to the token-map belonging to object pT. */ static void fts5TokendataIterAppendMap( Fts5Index *p, Fts5TokenDataIter *pT, int iIter, int nByte, i64 iRowid, i64 iPos ){ if( p->rc==SQLITE_OK ){ if( pT->nMap==pT->nMapAlloc ){ int nNew = pT->nMapAlloc ? pT->nMapAlloc*2 : 64; int nAlloc = nNew * sizeof(Fts5TokenDataMap); Fts5TokenDataMap *aNew; aNew = (Fts5TokenDataMap*)sqlite3_realloc(pT->aMap, nAlloc); if( aNew==0 ){ p->rc = SQLITE_NOMEM; return; } pT->aMap = aNew; pT->nMapAlloc = nNew; } pT->aMap[pT->nMap].iRowid = iRowid; pT->aMap[pT->nMap].iPos = iPos; pT->aMap[pT->nMap].iIter = iIter; pT->aMap[pT->nMap].nByte = nByte; pT->nMap++; } } /* ** Sort the contents of the pT->aMap[] array. ** ** The sorting algorithm requries a malloc(). If this fails, an error code ** is left in Fts5Index.rc before returning. */ static void fts5TokendataIterSortMap(Fts5Index *p, Fts5TokenDataIter *pT){ Fts5TokenDataMap *aTmp = 0; int nByte = pT->nMap * sizeof(Fts5TokenDataMap); aTmp = (Fts5TokenDataMap*)sqlite3Fts5MallocZero(&p->rc, nByte); if( aTmp ){ Fts5TokenDataMap *a1 = pT->aMap; Fts5TokenDataMap *a2 = aTmp; i64 nHalf; for(nHalf=1; nHalf<pT->nMap; nHalf=nHalf*2){ int i1; for(i1=0; i1<pT->nMap; i1+=(nHalf*2)){ int n1 = MIN(nHalf, pT->nMap-i1); int n2 = MIN(nHalf, pT->nMap-i1-n1); fts5TokendataMerge(&a1[i1], n1, &a1[i1+n1], n2, &a2[i1]); } SWAPVAL(Fts5TokenDataMap*, a1, a2); } if( a1!=pT->aMap ){ memcpy(pT->aMap, a1, pT->nMap*sizeof(Fts5TokenDataMap)); } sqlite3_free(aTmp); #ifdef SQLITE_DEBUG { int ii; for(ii=1; ii<pT->nMap; ii++){ Fts5TokenDataMap *p1 = &pT->aMap[ii-1]; Fts5TokenDataMap *p2 = &pT->aMap[ii]; assert( p1->iRowid<p2->iRowid || (p1->iRowid==p2->iRowid && p1->iPos<=p2->iPos) ); } } #endif } } /* ** Delete an Fts5TokenDataIter structure and its contents. */ static void fts5TokendataIterDelete(Fts5TokenDataIter *pSet){ if( pSet ){ int ii; for(ii=0; ii<pSet->nIter; ii++){ fts5MultiIterFree(pSet->apIter[ii]); } fts5BufferFree(&pSet->terms); sqlite3_free(pSet->aPoslistReader); sqlite3_free(pSet->aMap); sqlite3_free(pSet); } } /* ** fts5VisitEntries() context object used by fts5SetupPrefixIterTokendata() ** to pass data to prefixIterSetupTokendataCb(). */ typedef struct TokendataSetupCtx TokendataSetupCtx; struct TokendataSetupCtx { Fts5TokenDataIter *pT; /* Object being populated with mappings */ int iTermOff; /* Offset of current term in terms.p[] */ int nTermByte; /* Size of current term in bytes */ }; /* ** fts5VisitEntries() callback used by fts5SetupPrefixIterTokendata(). This ** callback adds an entry to the Fts5TokenDataIter.aMap[] array for each ** position in the current position-list. It doesn't matter that some of ** these may be out of order - they will be sorted later. */ static void prefixIterSetupTokendataCb( Fts5Index *p, void *pCtx, Fts5Iter *p1, const u8 *pNew, int nNew ){ TokendataSetupCtx *pSetup = (TokendataSetupCtx*)pCtx; int iPosOff = 0; i64 iPos = 0; if( pNew ){ pSetup->nTermByte = nNew-1; pSetup->iTermOff = pSetup->pT->terms.n; fts5BufferAppendBlob(&p->rc, &pSetup->pT->terms, nNew-1, pNew+1); } while( 0==sqlite3Fts5PoslistNext64( p1->base.pData, p1->base.nData, &iPosOff, &iPos ) ){ fts5TokendataIterAppendMap(p, pSetup->pT, pSetup->iTermOff, pSetup->nTermByte, p1->base.iRowid, iPos ); } } /* ** Context object passed by fts5SetupPrefixIter() to fts5VisitEntries(). */ typedef struct PrefixSetupCtx PrefixSetupCtx; struct PrefixSetupCtx { void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*); void (*xAppend)(Fts5Index*, u64, Fts5Iter*, Fts5Buffer*); i64 iLastRowid; int nMerge; Fts5Buffer *aBuf; int nBuf; Fts5Buffer doclist; TokendataSetupCtx *pTokendata; }; /* ** fts5VisitEntries() callback used by fts5SetupPrefixIter() */ static void prefixIterSetupCb( Fts5Index *p, void *pCtx, Fts5Iter *p1, const u8 *pNew, int nNew ){ PrefixSetupCtx *pSetup = (PrefixSetupCtx*)pCtx; const int nMerge = pSetup->nMerge; if( p1->base.nData>0 ){ if( p1->base.iRowid<=pSetup->iLastRowid && pSetup->doclist.n>0 ){ int i; for(i=0; p->rc==SQLITE_OK && pSetup->doclist.n; i++){ int i1 = i*nMerge; int iStore; assert( i1+nMerge<=pSetup->nBuf ); for(iStore=i1; iStore<i1+nMerge; iStore++){ if( pSetup->aBuf[iStore].n==0 ){ fts5BufferSwap(&pSetup->doclist, &pSetup->aBuf[iStore]); fts5BufferZero(&pSetup->doclist); break; } } if( iStore==i1+nMerge ){ pSetup->xMerge(p, &pSetup->doclist, nMerge, &pSetup->aBuf[i1]); for(iStore=i1; iStore<i1+nMerge; iStore++){ fts5BufferZero(&pSetup->aBuf[iStore]); } } } pSetup->iLastRowid = 0; } pSetup->xAppend( p, (u64)p1->base.iRowid-(u64)pSetup->iLastRowid, p1, &pSetup->doclist ); pSetup->iLastRowid = p1->base.iRowid; } if( pSetup->pTokendata ){ prefixIterSetupTokendataCb(p, (void*)pSetup->pTokendata, p1, pNew, nNew); } } static void fts5SetupPrefixIter( Fts5Index *p, /* Index to read from */ int bDesc, /* True for "ORDER BY rowid DESC" */ int iIdx, /* Index to scan for data */ u8 *pToken, /* Buffer containing prefix to match */ int nToken, /* Size of buffer pToken in bytes */ Fts5Colset *pColset, /* Restrict matches to these columns */ Fts5Iter **ppIter /* OUT: New iterator */ ){ Fts5Structure *pStruct; PrefixSetupCtx s; TokendataSetupCtx s2; |
︙ | |||
6589 6590 6591 6592 6593 6594 6595 | 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ** Ensure the segment-iterator passed as the only argument points to EOF. */ static void fts5SegIterSetEOF(Fts5SegIter *pSeg){ fts5DataRelease(pSeg->pLeaf); pSeg->pLeaf = 0; } |
︙ | |||
6657 6658 6659 6660 6661 6662 6663 | 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | pRet->apIter[pRet->nIter++] = pAppend; } assert( pRet==0 || pRet->nIter<=pRet->nIterAlloc ); return pRet; } |
︙ | |||
6745 6746 6747 6748 6749 6750 6751 | 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 | - + | pIter->base.bEof = 1; }else{ int eDetail = pIter->pIndex->pConfig->eDetail; pIter->base.bEof = 0; pIter->base.iRowid = iRowid; if( nHit==1 && eDetail==FTS5_DETAIL_FULL ){ |
︙ | |||
6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 | 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 | + - | } } if( p->rc==SQLITE_OK ){ pRet = fts5MultiIterAlloc(p, 0); } if( pRet ){ pRet->nSeg = 0; pRet->pTokenDataIter = pSet; if( pSet ){ fts5IterSetOutputsTokendata(pRet); }else{ pRet->base.bEof = 1; } }else{ fts5TokendataIterDelete(pSet); } fts5StructureRelease(pStruct); fts5BufferFree(&bSeek); return pRet; } |
︙ | |||
7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 | 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 | + + + + + | if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ int iIdx = 0; /* Index to search */ int iPrefixIdx = 0; /* +1 prefix index */ int bTokendata = pConfig->bTokendata; if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken); /* The NOTOKENDATA flag is set when each token in a tokendata=1 table ** should be treated individually, instead of merging all those with ** a common prefix into a single entry. This is used, for example, by ** queries performed as part of an integrity-check, or by the fts5vocab ** module. */ if( flags & (FTS5INDEX_QUERY_NOTOKENDATA|FTS5INDEX_QUERY_SCAN) ){ bTokendata = 0; } /* Figure out which index to search and set iIdx accordingly. If this ** is a prefix query for which there is no prefix index, set iIdx to ** greater than pConfig->nPrefix to indicate that the query will be |
︙ | |||
7068 7069 7070 7071 7072 7073 7074 | 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 | - + - + | int nIdxChar = pConfig->aPrefix[iIdx-1]; if( nIdxChar==nChar ) break; if( nIdxChar==nChar+1 ) iPrefixIdx = iIdx; } } if( bTokendata && iIdx==0 ){ |
︙ | |||
7117 7118 7119 7120 7121 7122 7123 | 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 | + - + | */ /* ** Move to the next matching rowid. */ int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; assert( pIter->pIndex->rc==SQLITE_OK ); if( pIter->nSeg==0 ){ |
︙ | |||
7154 7155 7156 7157 7158 7159 7160 | 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 | + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + + + + + + + + + + + | /* ** Move to the next matching rowid that occurs at or after iMatch. The ** definition of "at or after" depends on whether this iterator iterates ** in ascending or descending rowid order. */ int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; if( pIter->nSeg==0 ){ |
︙ | |||
7217 7218 7219 7220 7221 7222 7223 | 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 | + - - - + + + + + + + + - + + + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + | }else{ break; } } } if( i2>i1 ){ if( pIter->nSeg==0 ){ |
︙ |
Changes to ext/fts5/fts5_main.c.
︙ | |||
89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | + | /* ** Size of header on fts5_locale() values. And macro to access a buffer ** containing a copy of the header from an Fts5Config pointer. */ #define FTS5_LOCALE_HDR_SIZE ((int)sizeof( ((Fts5Global*)0)->aLocaleHdr )) #define FTS5_LOCALE_HDR(pConfig) ((const u8*)(pConfig->pGlobal->aLocaleHdr)) #define FTS5_INSTTOKEN_SUBTYPE 73 /* ** Each auxiliary function registered with the FTS5 module is represented ** by an object of the following type. All such objects are stored as part ** of the Fts5Global.pAux list. */ struct Fts5Auxiliary { |
︙ | |||
628 629 630 631 632 633 634 635 636 637 638 639 640 641 | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | + | if( p->op==SQLITE_INDEX_CONSTRAINT_MATCH || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol>=nCol) ){ /* A MATCH operator or equivalent */ if( p->usable==0 || iCol<0 ){ /* As there exists an unusable MATCH constraint this is an ** unusable plan. Return SQLITE_CONSTRAINT. */ idxStr[iIdxStr] = 0; return SQLITE_CONSTRAINT; }else{ if( iCol==nCol+1 ){ if( bSeenRank ) continue; idxStr[iIdxStr++] = 'r'; bSeenRank = 1; }else{ |
︙ | |||
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 | + | int bOrderByRank; /* True if ORDER BY rank */ sqlite3_value *pRank = 0; /* rank MATCH ? expression (or NULL) */ sqlite3_value *pRowidEq = 0; /* rowid = ? expression (or NULL) */ sqlite3_value *pRowidLe = 0; /* rowid <= ? expression (or NULL) */ sqlite3_value *pRowidGe = 0; /* rowid >= ? expression (or NULL) */ int iCol; /* Column on LHS of MATCH operator */ char **pzErrmsg = pConfig->pzErrmsg; int bPrefixInsttoken = pConfig->bPrefixInsttoken; int i; int iIdxStr = 0; Fts5Expr *pExpr = 0; assert( pConfig->bLock==0 ); if( pCsr->ePlan ){ fts5FreeCursorComponents(pCsr); |
︙ | |||
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 | + + + | char *zText = 0; int bFreeAndReset = 0; int bInternal = 0; rc = fts5ExtractExprText(pConfig, apVal[i], &zText, &bFreeAndReset); if( rc!=SQLITE_OK ) goto filter_out; if( zText==0 ) zText = ""; if( sqlite3_value_subtype(apVal[i])==FTS5_INSTTOKEN_SUBTYPE ){ pConfig->bPrefixInsttoken = 1; } iCol = 0; do{ iCol = iCol*10 + (idxStr[iIdxStr]-'0'); iIdxStr++; }while( idxStr[iIdxStr]>='0' && idxStr[iIdxStr]<='9' ); |
︙ | |||
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 | 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | + | rc = fts5NextMethod(pCursor); } } filter_out: sqlite3Fts5ExprFree(pExpr); pConfig->pzErrmsg = pzErrmsg; pConfig->bPrefixInsttoken = bPrefixInsttoken; return rc; } /* ** This is the xEof method of the virtual table. SQLite calls this ** routine to find out if it has reached the end of a result set. */ |
︙ | |||
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 | 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 | + + + + + + + + + + + + + | (*pCsr++) = 0x00; if( zText ) memcpy(pCsr, zText, nText); assert( &pCsr[nText]==&pBlob[nBlob] ); sqlite3_result_blob(pCtx, pBlob, nBlob, sqlite3_free); } } /* ** Implementation of fts5_insttoken() function. */ static void fts5InsttokenFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apArg /* Function arguments */ ){ assert( nArg==1 ); sqlite3_result_value(pCtx, apArg[0]); sqlite3_result_subtype(pCtx, FTS5_INSTTOKEN_SUBTYPE); } /* ** Return true if zName is the extension on one of the shadow tables used ** by this module. */ static int fts5ShadowName(const char *zName){ static const char *azName[] = { |
︙ | |||
3776 3777 3778 3779 3780 3781 3782 | 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 | - + + + + + + + + | SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS, p, fts5SourceIdFunc, 0, 0 ); } if( rc==SQLITE_OK ){ rc = sqlite3_create_function( db, "fts5_locale", 2, |
︙ |
Changes to ext/fts5/fts5_tcl.c.
︙ | |||
726 727 728 729 730 731 732 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | + - - + + | */ static int SQLITE_TCLAPI f5tTokenize( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ char *pCopy = 0; |
︙ | |||
773 774 775 776 777 778 779 780 781 782 783 784 | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | + + + + + + + + + + + - + - + + - | } rc = tokenizer.xCreate(pUserdata, &azArg[1], (int)(nArg-1), &pTok); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "error in tokenizer.xCreate()", (char*)0); return TCL_ERROR; } if( nText>0 ){ pCopy = sqlite3_malloc(nText); if( pCopy==0 ){ tokenizer.xDelete(pTok); Tcl_AppendResult(interp, "error in sqlite3_malloc()", (char*)0); return TCL_ERROR; }else{ memcpy(pCopy, zText, nText); } } pRet = Tcl_NewObj(); Tcl_IncrRefCount(pRet); ctx.bSubst = (objc==5); ctx.pRet = pRet; |
︙ |
Changes to ext/fts5/fts5_tokenize.c.
︙ | |||
1349 1350 1351 1352 1353 1354 1355 | 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | - - + + + - + + + + - | ){ TrigramTokenizer *p = (TrigramTokenizer*)pTok; int rc = SQLITE_OK; char aBuf[32]; char *zOut = aBuf; int ii; const unsigned char *zIn = (const unsigned char*)pText; |
︙ |
Changes to ext/fts5/test/fts5origintext.test.
︙ | |||
18 19 20 21 22 23 24 25 26 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + + + + + - + + - + - + - + - + | # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { foreach {tn insttoken} { 1 0 2 1 } { reset_db sqlite3_fts5_register_origintext db |
︙ | |||
84 85 86 87 88 89 90 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | - + + - + - + - + - + - + - + + - - - + + + - + + - - - + + + - + + + + + + + + - + + - + - + - + - + - + - + - + - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - + - + - + - + - + - + - + - + - + + | lappend doc [term] } set doc } db func document document sqlite3_fts5_register_origintext db |
Changes to ext/fts5/test/fts5origintext3.test.
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | + + + + + - + - - + + + + + + - + + + + + + + + + - + - + - + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + | # If SQLITE_ENABLE_FTS5 is not defined, omit this file. ifcapable !fts5 { finish_test return } foreach_detail_mode $testprefix { foreach {tn insttoken} { 1 0 2 1 } { reset_db sqlite3_fts5_register_origintext db fts5_aux_test_functions db proc insttoken {cmd iIdx iToken} { set txt [$cmd xInstToken $iIdx $iToken] string map [list "\0" "."] $txt } sqlite3_fts5_create_function db insttoken insttoken |
Added ext/fts5/test/fts5origintext6.test.