Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge updates from trunk. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | preRelease |
Files: | files | file ages | folders |
SHA1: |
24294cb2740ad38939772656825ba74b |
User & Date: | mistachkin 2015-08-18 19:24:10.561 |
Context
2015-08-18
| ||
19:24 | Update the release date. check-in: f44cbd25de user: mistachkin tags: preRelease | |
19:24 | Merge updates from trunk. check-in: 24294cb274 user: mistachkin tags: preRelease | |
03:04 | Update the included FTS5 extension to the latest trunk code. check-in: e3cb9d9023 user: mistachkin tags: trunk | |
2015-07-31
| ||
01:16 | Merge updates from trunk. check-in: e670692d90 user: mistachkin tags: preRelease | |
Changes
Changes to Doc/Extra/Provider/version.html.
︙ | ︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for <a href="https://system.data.sqlite.org/index.html/info/964063da16">[964063da16]</a>. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for <a href="https://system.data.sqlite.org/index.html/info/9d353b0bd8">[9d353b0bd8]</a>.</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/71bedaca19">[71bedaca19]</a>. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> | > > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Add support for creating custom SQL functions using delegates.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Prevent encrypted connections from being used with the connection pool. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/89d3a159f1">[89d3a159f1]</a>. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for <a href="https://system.data.sqlite.org/index.html/info/964063da16">[964063da16]</a>. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for <a href="https://system.data.sqlite.org/index.html/info/9d353b0bd8">[9d353b0bd8]</a>.</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/71bedaca19">[71bedaca19]</a>. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> |
︙ | ︙ |
Changes to Externals/Eagle/bin/Eagle.dll.
cannot compute difference between binary files
Changes to Externals/Eagle/bin/EagleShell.exe.
cannot compute difference between binary files
Changes to Externals/Eagle/bin/EagleShell32.exe.
cannot compute difference between binary files
Changes to Externals/Eagle/bin/x64/Spilornis.dll.
cannot compute difference between binary files
Changes to Externals/Eagle/bin/x86/Spilornis.dll.
cannot compute difference between binary files
Changes to Externals/Eagle/lib/Eagle1.0/init.eagle.
︙ | ︙ | |||
2033 2034 2035 2036 2037 2038 2039 | if {[llength $args] > 2} then { error "wrong # args: should be \"parray a ?pattern?\"" } upvar 1 $a array if {![array exists array]} { | | | 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 | if {[llength $args] > 2} then { error "wrong # args: should be \"parray a ?pattern?\"" } upvar 1 $a array if {![array exists array]} { error [appendArgs \" $a "\" isn't an array"] } set names [lsort [eval array names array $args]] set maxLength 0 foreach name $names { set length [string length $name] |
︙ | ︙ | |||
2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 | # NOTE: Old style test, use [test1] command. # set command test1 } return [uplevel 1 [list $command $name $description] $args] } proc unknown { name args } { # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > | > > > > | 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 | # NOTE: Old style test, use [test1] command. # set command test1 } return [uplevel 1 [list $command $name $description] $args] } proc isObjectHandle { value } { set pattern [string map [list \\ \\\\ \[ \\\[ \] \\\]] $value] set objects [info objects $pattern] if {[llength $objects] == 1 && [lindex $objects 0] eq $value} then { return true } return false } proc isManagedType { name } { if {[llength [info commands object]] > 0} then { if {![isObjectHandle $name]} then { if {[catch { object members -matchnameonly -nameonly -pattern Equals $name } result] == 0 && $result eq "Equals"} then { return true } } } return false } proc canGetManagedType { name {varName ""} } { if {[llength [info commands object]] > 0} then { if {![isObjectHandle $name]} then { set cultureInfo [object invoke Interpreter.GetActive CultureInfo] set type null set code [object invoke -create -alias -flags +NonPublic \ Value GetType "" $name null null None $cultureInfo type] if {[$code ToString] eq "Ok"} then { if {[string length $varName] > 0} then { upvar 1 $varName typeName } set typeName [$type AssemblyQualifiedName] if {[isManagedType $typeName]} then { return true } } } } return false } proc unknownObjectInvoke { level name args } { # # NOTE: This is an [unknown] procedure that attempts to lookup the # name as a CLR type and then attempts to use [object invoke] # with it, merging options and arguments as necessary. # if {[llength [info commands object]] > 0 && \ ([isManagedType $name] || [canGetManagedType $name name])} then { # # NOTE: Get possible options for the [object invoke] sub-command. # set options [object invoke Utility GetInvokeOptions Invoke] # # NOTE: Create argument list for the artificial [object invoke] # alias. This always has two arguments. # set arguments1 [object create ArgumentList object invoke] # # NOTE: Create argument list for the entire command being handled. # There may be options right after the command name itself. # set arguments2 [eval \ object create ArgumentList [concat [list $name] $args]] # # NOTE: Setup output arguments needed for the MergeArguments method. # set arguments3 null; set error null # # NOTE: Attempt to merge the option and non-option arguments into a # single list of arguments. # set code [object invoke -alias -flags +NonPublic \ Interpreter.GetActive MergeArguments $options $arguments1 \ $arguments2 2 1 false false arguments3 error] # # NOTE: Was the argument merging process successful? # if {$code eq "Ok"} then { # # NOTE: Jump up from our call frame (and optionally that of our # caller) and attempt to invoke the specified static object # method with the final list of merged arguments. # return [uplevel [expr {$level + 1}] [$arguments3 ToString]] } else { # # NOTE: Failed to merge the arguments, raise an error. # error [$error ToString] } } continue; # NOTE: Not handled. } proc unknown { name args } { # # NOTE: This is an [unknown] procedure that normally produces an # appropriate error message; however, it can optionally try # to invoke a static object method. # # TODO: Add support for auto-loading packages here in the future? # if {[hasRuntimeOption unknownObjectInvoke] && \ [llength [info commands object]] > 0} then { # # NOTE: In the context of the caller, attempt to invoke a static # object method using the specified arguments (which may # contain variable names). # if {[catch { eval unknownObjectInvoke 1 [list $name] $args } result] == 0} then { # # NOTE: The static object method was invoked successfully. # Return its result. # return -code ok $result } elseif {[string length $result] > 0} then { # # NOTE: Attempting to invoke the static object method raised # an error. Re-raise it now. If no error message was # provided, fallback on the default (below). # return -code error $result } } return -code error [appendArgs "invalid command name \"" $name \"] } namespace eval ::tcl::tm { # # NOTE: Ideally, this procedure should be created in the "::tcl::tm" # namespace. # |
︙ | ︙ | |||
2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 | proc tclLog { string } { # # NOTE: This should work properly in both Tcl and Eagle. # catch {puts stderr $string} } proc makeVariableFast { name fast } { # # NOTE: This should work properly in Eagle only. # catch { uplevel 1 [list object invoke -flags +NonPublic \ | > > > > > > > > > > | 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | proc tclLog { string } { # # NOTE: This should work properly in both Tcl and Eagle. # catch {puts stderr $string} } proc makeProcedureFast { name fast } { # # NOTE: This should work properly in Eagle only. # catch { uplevel 1 [list object invoke -flags +NonPublic \ Interpreter.GetActive MakeProcedureFast $name $fast] } } proc makeVariableFast { name fast } { # # NOTE: This should work properly in Eagle only. # catch { uplevel 1 [list object invoke -flags +NonPublic \ |
︙ | ︙ | |||
2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 | } } } foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \ /ahd /b [appendArgs \" [file nativename $pattern] \"]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] if {[lsearch -variable -exact -nocase result $dir] == -1} then { lappend result $dir } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | } } } foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \ /ahd /b [appendArgs \" [file nativename $pattern] \"]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] if {[lsearch -variable -exact -nocase result $dir] == -1} then { lappend result $dir } } } return $result } proc findDirectoriesRecursive { pattern } { # # NOTE: Block non-Windows platforms since this is Windows specific. # if {![isWindows]} then { error "not supported on this operating system" } # # NOTE: This should work properly in Eagle only. # set dir ""; set result [list] # # HACK: Optimize the variable access in this procedure to be # as fast as possible. # makeVariableFast dir true; makeVariableFast result true foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \ /ad /s /b [appendArgs \" [file nativename $pattern] \"]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] if {[lsearch -variable -exact -nocase result $dir] == -1} then { lappend result $dir } } } foreach dir [split [exec -unicode $::env(ComSpec) /u /c dir \ /ahd /s /b [appendArgs \" [file nativename $pattern] \"]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] if {[lsearch -variable -exact -nocase result $dir] == -1} then { lappend result $dir } |
︙ | ︙ | |||
2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 | [file normalize $pattern]] eval lappend result [glob -nocomplain -types {d hidden} \ [file normalize $pattern]] return $result } proc findFiles { pattern } { # # NOTE: This should work properly in Tcl only. # eval lappend result [glob -nocomplain -types {f} \ [file normalize $pattern]] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 | [file normalize $pattern]] eval lappend result [glob -nocomplain -types {d hidden} \ [file normalize $pattern]] return $result } proc findDirectoriesRecursive { pattern } { # # NOTE: Block non-Windows platforms since this is Windows specific. # if {![isWindows]} then { error "not supported on this operating system" } # # NOTE: This should work properly in Tcl only. # set result [list] catch { foreach dir [split [exec $::env(ComSpec) /c dir /ad /s /b \ [file nativename $pattern]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] # # HACK: The -nocase option to [lsearch] is only available # starting with Tcl 8.5. # if {$::tcl_version >= 8.5} then { if {[lsearch -exact -nocase $result $dir] == -1} then { lappend result $dir } } else { if {[lsearch -exact [string tolower $result] \ [string tolower $dir]] == -1} then { lappend result $dir } } } } } catch { foreach dir [split [exec $::env(ComSpec) /c dir /ahd /s /b \ [file nativename $pattern]] \n] { set dir [string trim $dir] if {[string length $dir] > 0} then { set dir [getDirResultPath $pattern $dir] # # HACK: The -nocase option to [lsearch] is only available # starting with Tcl 8.5. # if {$::tcl_version >= 8.5} then { if {[lsearch -exact -nocase $result $dir] == -1} then { lappend result $dir } } else { if {[lsearch -exact [string tolower $result] \ [string tolower $dir]] == -1} then { lappend result $dir } } } } } return $result } proc findFiles { pattern } { # # NOTE: This should work properly in Tcl only. # eval lappend result [glob -nocomplain -types {f} \ [file normalize $pattern]] |
︙ | ︙ | |||
2428 2429 2430 2431 2432 2433 2434 | foreach fileName [split [exec $::env(ComSpec) /c dir /a-d /s /b \ [file nativename $pattern]] \n] { set fileName [string trim $fileName] if {[string length $fileName] > 0} then { set fileName [getDirResultPath $pattern $fileName] | > > > > > | | > > > > > > > > > > > | | > > > > > > | 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | foreach fileName [split [exec $::env(ComSpec) /c dir /a-d /s /b \ [file nativename $pattern]] \n] { set fileName [string trim $fileName] if {[string length $fileName] > 0} then { set fileName [getDirResultPath $pattern $fileName] # # HACK: The -nocase option to [lsearch] is only available # starting with Tcl 8.5. # if {$::tcl_version >= 8.5} then { if {[lsearch -exact -nocase $result $fileName] == -1} then { lappend result $fileName } } else { if {[lsearch -exact [string tolower $result] \ [string tolower $fileName]] == -1} then { lappend result $fileName } } } } } catch { foreach fileName [split [exec $::env(ComSpec) /c dir /ah-d /s /b \ [file nativename $pattern]] \n] { set fileName [string trim $fileName] if {[string length $fileName] > 0} then { set fileName [getDirResultPath $pattern $fileName] # # HACK: The -nocase option to [lsearch] is only available # starting with Tcl 8.5. # if {$::tcl_version >= 8.5} then { if {[lsearch -exact -nocase $result $fileName] == -1} then { lappend result $fileName } } else { if {[lsearch -exact [string tolower $result] \ [string tolower $fileName]] == -1} then { lappend result $fileName } } } } } return $result } |
︙ | ︙ | |||
2510 2511 2512 2513 2514 2515 2516 | isSameFileName getEnvironmentVariable combineFlags getCompileInfo \ getPlatformInfo getPluginPath appendArgs lappendArgs \ getDictionaryValue getColumnValue getRowColumnValue tqputs tqlog \ readFile readSharedFile writeFile appendFile appendLogFile \ appendSharedFile appendSharedLogFile readAsciiFile writeAsciiFile \ readUnicodeFile writeUnicodeFile getDirResultPath addToPath \ removeFromPath execShell lshuffle ldifference filter map reduce \ | | | > | 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 | isSameFileName getEnvironmentVariable combineFlags getCompileInfo \ getPlatformInfo getPluginPath appendArgs lappendArgs \ getDictionaryValue getColumnValue getRowColumnValue tqputs tqlog \ readFile readSharedFile writeFile appendFile appendLogFile \ appendSharedFile appendSharedLogFile readAsciiFile writeAsciiFile \ readUnicodeFile writeUnicodeFile getDirResultPath addToPath \ removeFromPath execShell lshuffle ldifference filter map reduce \ getLengthModifier debug findDirectories findDirectoriesRecursive \ findFiles findFilesRecursive exportAndImportPackageCommands] false \ false ########################################################################### ############################## END Tcl ONLY ############################### ########################################################################### } # # NOTE: Provide the Eagle library package to the interpreter. # package provide Eagle.Library \ [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}] } |
Changes to Externals/Eagle/lib/Eagle1.0/shell.eagle.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 | ########################################################################### # # NOTE: Commands specific to initializing the Eagle interactive shell # environment should be placed here. # proc help { args } { eval lappend command #help $args; debug icommand $command | > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 142 143 144 145 | ########################################################################### # # NOTE: Commands specific to initializing the Eagle interactive shell # environment should be placed here. # proc help { args } { host result Break [appendArgs \ "\nFor interactive help please use: #help " $args \ "\nFor commercial support, please use: #support\n"] catch { object invoke Interpreter.GetActive Host.WriteLine \ "\nPlease press any key to continue...\n" set key null; object invoke Interpreter.GetActive \ Host.ReadKey true key } eval lappend command #help $args; debug icommand $command } proc #support {} { # <help> # Shows the requirements for obtaining commercial support and/or # redirects to the appropriate web site using the default browser. # </help> if {[catch { package require Licensing.Enterprise set fileName(1) [certificate current] if {[string length $fileName(1)] == 0} then { error "No certificate file is available." } set certificate [certificate import -alias $fileName(1)] if {[string length $certificate] == 0} then { error [appendArgs \ "No certificate is available, current file \"" \ $fileName(1) "\" could not be imported."] } if {[catch { certificate flags -hasflags S -hasall -strict $certificate } error(2)]} then { error [appendArgs \ "Support is not enabled for certificate \"" \ [$certificate Id] " - " [$certificate EntityName] \ "\", the original error message was: \{" $error(2) \ \}.] } set uri [$certificate -create -alias Support] if {[string length $uri] == 0} then { error [appendArgs \ "No support information found in certificate \"" \ [$certificate Id] " - " [$certificate EntityName] \".] } if {[$uri Scheme] ni [list http https]} then { error [appendArgs \ "Support URI scheme \"" [$uri Scheme] \ "\" in certificate \"" [$certificate Id] " - " \ [$certificate EntityName] "\" is not supported, " \ "must be \"http\" or \"https\"."] } exec -shell [$uri ToString] & } error(1)]} then { set fileName(2) [file tempname]; set fileData "" foreach varName [lsort [info vars]] { if {$varName in [list fileData]} then { continue } if {$varName eq "certificate" && \ [string length $certificate] > 0} then { append fileData [appendArgs \n \ [list array set certificate \ [$certificate -flags +NonPublic \ ToDictionary.KeysAndValuesToString \ null false]]] continue } if {[array exists $varName]} then { append fileData [appendArgs \n \ [list array set $varName [array get $varName]]] } else { append fileData [appendArgs \n \ [list set $varName [set $varName]]] } } append fileData \n; writeFile $fileName(2) $fileData set ::eagle_shell(errorFileName) $fileName(2) error [appendArgs \ "\n\nIn order to obtain commercial support, at least " \ "one of the\nfollowing requirements must be met:\n\n" \ "\t1. Valid, non-expired commercial license agreement\n" \ "\t for Eagle Enterprise Edition.\n\n" \ "\t2. Valid, non-expired commercial support contract\n" \ "\t for Eagle Standard Edition.\n\n" \ "The original error information was saved to the file:\n\n" \ [string repeat - 60] \n $fileName(2) \n [string repeat - 60] \ "\n\nPlease provide this file when contacting support."] } } ########################################################################### ############################# END Eagle ONLY ############################## ########################################################################### } else { ########################################################################### |
︙ | ︙ |
Changes to Externals/Eagle/lib/Eagle1.0/test.eagle.
︙ | ︙ | |||
233 234 235 236 237 238 239 240 241 242 243 244 245 246 | } } proc testArrayGet { varName {integer false} } { # # NOTE: Returns the results of [array get] in a well-defined order. # upvar 1 $varName array # # NOTE: Build the command that will sort the array names into order. # set command [list lsort] if {$integer} then {lappend command -integer} | > > > > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | } } proc testArrayGet { varName {integer false} } { # # NOTE: Returns the results of [array get] in a well-defined order. # if {[string length $varName] == 0} then { return [list] } upvar 1 $varName array # # NOTE: Build the command that will sort the array names into order. # set command [list lsort] if {$integer} then {lappend command -integer} |
︙ | ︙ | |||
477 478 479 480 481 482 483 | tputs $::test_channel [appendArgs \ "---- skipped " $type " file: \"" $fileName \ "\", it does not exist\n"] } } } | | > > > > > > | | | > | | | | | > | 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 | tputs $::test_channel [appendArgs \ "---- skipped " $type " file: \"" $fileName \ "\", it does not exist\n"] } } } proc processTestArguments { varName strict args } { # # NOTE: Initially, there are no unknown (i.e. unprocessed) arguments. # set result [list] # # NOTE: We are going to place the configured options in the variable # identified by the name provided by the caller. # if {[string length $varName] > 0} then { upvar 1 $varName array } # # TODO: Add more support for standard "tcltest" options here. # set options [list \ -breakOnLeak -configuration -constraints -exitOnComplete \ -file -logFile -machine -match -no -notFile -platform \ -postTest -preTest -postWait -preWait -randomOrder -skip \ -startFile -stopFile -stopOnFailure -stopOnLeak -suffix \ -suite -tclsh -threshold] set length [llength $args] for {set index 0} {$index < $length} {incr index} { # # NOTE: Grab the current list element, which should be the name of # the test option. |
︙ | ︙ | |||
535 536 537 538 539 540 541 | # NOTE: Is there another list element available for the value? If # not, it does not conform to the standard command line name # and value pattern. # if {$index + 1 < $length} then { incr index; set value [lindex $args $index] | > > > > | > > > > > > > | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > | | | > > | | > > > > > > > | | 547 548 549 550 551 552 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 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | # NOTE: Is there another list element available for the value? If # not, it does not conform to the standard command line name # and value pattern. # if {$index + 1 < $length} then { incr index; set value [lindex $args $index] if {!$strict && [lsearch -exact $options $value] != -1} then { incr index -1; # HACK: Resynchronize with valid test option. lappend result [list $name] tqputs $::test_channel [appendArgs \ "---- no value for unknown test option \"" $name \ "\", ignored, backing up one for test option \"" \ $value \"...\n] } else { lappend result [list $name $value] tqputs $::test_channel [appendArgs \ "---- unknown test option \"" $name "\" with value \"" \ $value "\", ignored\n"] } } else { lappend result [list $name] tqputs $::test_channel [appendArgs \ "---- no value for unknown test option \"" $name \ "\", ignored\n"] } } else { # # NOTE: Is there another list element available for the value? If # not, it does not conform to the standard command line name # and value pattern. # if {$index + 1 < $length} then { incr index; set value [lindex $args $index] if {!$strict && [lsearch -exact $options $value] != -1} then { incr index -1; # HACK: Resynchronize with valid test argument. lappend result [list $name] tqputs $::test_channel [appendArgs \ "---- no value for unknown argument \"" $name \ "\", ignored, backing up one for test option \"" \ $value \"...\n] } else { lappend result [list $name $value] tqputs $::test_channel [appendArgs \ "---- unknown argument \"" $name "\" with value \"" \ $value "\", ignored\n"] } } else { # # NOTE: This is not an option of *any* kind that we know about. # Ignore it and issue a warning. # lappend result [list $name] tqputs $::test_channel [appendArgs \ "---- unknown argument \"" $name "\", ignored\n"] } } } # # NOTE: Now, attempt to flush the test log queue, if available. # tlog "" # # NOTE: Return the nested list of unknown arguments, formatted as # name/value pairs, to the caller. # return $result } proc getTclShellFileName { automatic kits } { # # NOTE: Start out with an empty list of candiate Tcl shells. # set shells [list] # # NOTE: Check all environment variables we know about that # may contain the path where the Tcl shell is located. # foreach name [list Eagle_Tcl_Shell Tcl_Shell EAGLE_TCLSH TCLSH] { set value [getEnvironmentVariable $name] # # TODO: Possibly add a check if the file actually exists # here. # if {[string length $value] > 0} then { |
︙ | ︙ | |||
1292 1293 1294 1295 1296 1297 1298 | if {![info exists ::no(epilogue.eagle)] && [info exists ::path]} then { unset ::path } } proc hookPuts {} { # | | | | 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | if {![info exists ::no(epilogue.eagle)] && [info exists ::path]} then { unset ::path } } proc hookPuts {} { # # NOTE: This code was stolen from "tcltest" and heavily modified to # work with Eagle. # proc [namespace current]::testPuts { args } { switch [llength $args] { 1 { # # NOTE: Only the string to be printed is specified (stdout). # |
︙ | ︙ | |||
2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 | proc isTestSuiteRunning {} { # # NOTE: Return non-zero if the test suite appears to be running. # return [expr {[info exists ::test_suite_running] && \ $::test_suite_running}] } proc configureTcltest { match skip constraints imports force } { if {[isEagle]} then { # # HACK: Flag the "test" and "runTest" script library procedures so # that they use the script location of their caller and not # their own. # # BUGBUG: Even this does not yet fix the script location issues in # the test suite: # # debug procedureflags test +ScriptLocation # debug procedureflags runTest +ScriptLocation # # NOTE: Setup the necessary compatibility shims for the test suite. # namespace eval ::tcltest {}; # HACK: Force namespace creation now. setupTestShims true [expr {![isTestSuiteRunning]}] # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 | proc isTestSuiteRunning {} { # # NOTE: Return non-zero if the test suite appears to be running. # return [expr {[info exists ::test_suite_running] && \ $::test_suite_running}] } proc getTestChannelOrDefault {} { if {[info exists ::test_channel]} then { return $::test_channel } return stdout; # TODO: Good default? } proc checkForAndSetTestPath { whatIf {quiet false} } { # # NOTE: Everything in this procedure requires access to the file system; # therefore, it cannot be used in a stock "safe" interpreter. # if {![interp issafe] && ![info exists ::test_path]} then { # # NOTE: Grab the name of the current script file. If this is an empty # string, many test path checks will have to be skipped. # set script [info script] # # NOTE: Eagle and native Tcl have different requirements and possible # locations for the test path; therefore, handle them separately. # if {[isEagle]} then { # # NOTE: Grab the base directory and the library directory. Without # these, several test path checks will be skipped. # set library [getTestLibraryDirectory]; set base [info base] if {[string length $library] > 0} then { # # NOTE: Try the source release directory structure. For this # case, the final test path would be: # # $library/../../Library/Tests # set ::test_path [file normalize [file join [file dirname [file \ dirname $library]] Library Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #1 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $base] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Try the source release directory structure again; this # time, assume only the embedded script library was used. # For this case, the final test path would be: # # $base/Library/Tests # set ::test_path [file normalize [file join $base Library Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #2 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $script] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Try for the test package directory. For this case, the # final test path would be: # # $script/../Test1.0 # set ::test_path [file normalize [file join [file dirname [file \ dirname $script]] [appendArgs Test [info engine Version]]]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #3 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $base] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Try for the test package directory again; this time, use # the base path and assume the source release directory # structure. For this case, the final test path would be: # # $base/lib/Test1.0 # set ::test_path [file normalize [file join $base lib [appendArgs \ Test [info engine Version]]]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #4 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $base] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Try for the test package directory again; this time, use # the base path. For this case, the final test path would # be: # # $base/Test1.0 # set ::test_path [file normalize [file join $base [appendArgs \ Test [info engine Version]]]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #5 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $library] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: This must be a binary release, no "Library" directory # then. Also, binary releases have an upper-case "Tests" # directory name that originates from the "update.bat" # tool. This must match the casing used in "update.bat". # For this case, the final test path would be: # # $library/../../Tests # set ::test_path [file normalize [file join [file dirname [file \ dirname $library]] Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #6 for Eagle test path at \"" \ $::test_path \"...\n] } } if {[string length $base] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Fallback to using the base directory and checking for a # "Tests" directory beneath it. For this case, the final # test path would be: # # $base/Tests # set ::test_path [file normalize [file join $base Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #7 for Eagle test path at \"" \ $::test_path \"...\n] } } if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- final Eagle test path is \"" \ [expr {[info exists ::test_path] ? \ $::test_path : "<none>"}] \"\n] } } else { if {[string length $script] > 0} then { # # NOTE: Try the source release directory structure. For this # case, the final test path would be: # # $script/../../Library/Tests # set ::test_path [file normalize [file join [file dirname [file \ dirname [file dirname $script]]] Library Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #1 for Tcl test path at \"" \ $::test_path \"...\n] } } if {[string length $script] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: Try for the test package directory. For this case, the # final test path would be: # # $script/../Test1.0 # set ::test_path [file normalize [file join [file dirname [file \ dirname $script]] Test1.0]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #2 for Tcl test path at \"" \ $::test_path \"...\n] } } if {[string length $script] > 0 && ($whatIf || \ ![info exists ::test_path] || ![file exists $::test_path] || \ ![file isdirectory $::test_path])} then { # # NOTE: This must be a binary release, no "Library" directory # then. Also, binary releases have an upper-case "Tests" # directory name that originates from the "update.bat" # tool. This must match the casing used in "update.bat". # For this case, the final test path would be: # # $script/../../Tests # set ::test_path [file normalize [file join [file dirname [file \ dirname [file dirname $script]]] Tests]] if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- checking #3 for Tcl test path at \"" \ $::test_path \"...\n] } } if {!$quiet} then { tqputs [getTestChannelOrDefault] [appendArgs \ "---- final Tcl test path is \"" \ [expr {[info exists ::test_path] ? \ $::test_path : "<none>"}] \"\n] } } } } proc configureTcltest { match skip constraints imports force } { # # NOTE: Eagle and native Tcl have different configuration requirements # for the "tcltest" package. For Eagle, the necessary testing # functionality is built-in. In native Tcl, the package must be # loaded now and that cannot be done in a "safe" interpreter. # if {[isEagle]} then { # # HACK: Flag the "test" and "runTest" script library procedures so # that they use the script location of their caller and not # their own. # # BUGBUG: Even this does not yet fix the script location issues in # the test suite: # # debug procedureflags test +ScriptLocation # debug procedureflags runTest +ScriptLocation # # NOTE: Setup the necessary compatibility shims for the test suite. # namespace eval ::tcltest {}; # HACK: Force namespace creation now. setupTestShims true [expr {![isTestSuiteRunning]}] # # NOTE: Fake having the package as the functionality is built-in. # package provide tcltest 2.2.10; # Tcl 8.4 } elseif {![interp issafe]} then { # # NOTE: Attempt to detect if the package is already loaded. # set loaded [expr {[catch {package present tcltest}] == 0}] # # NOTE: Always attempt to load the package. # package require tcltest # # NOTE: Configure it for our use (only when it was not loaded). # if {!$loaded} then { ::tcltest::configure -verbose bpste } # # NOTE: We need to copy the Eagle test names to match over to Tcl. |
︙ | ︙ | |||
2527 2528 2529 2530 2531 2532 2533 | if {[info exists test_flags(-constraints)]} then { eval lappend eagle_tests(Constraints) $test_flags(-constraints) } } } | < < < < < < < < | 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 | if {[info exists test_flags(-constraints)]} then { eval lappend eagle_tests(Constraints) $test_flags(-constraints) } } } proc setupTestShims { setup {quiet false} } { if {$setup} then { # # HACK: Compatibility shim(s) for use with various tests in the Tcl # test suite. Make sure these commands do not already exist # prior to attempt to adding them. # |
︙ | ︙ | |||
3088 3089 3090 3091 3092 3093 3094 | object unimport -importpattern System.Windows.Forms.Layout object unimport -importpattern System.Windows.Forms.PropertyGridInternal object unimport -importpattern System.Windows.Forms.VisualStyles } proc getTestLibraryDirectory {} { # | | > < | | | | | | | | | | | | | | | < < < < < < < < < < < < | < < < < < < < < < < | | < < | < < < < < < < < < | < < < < < < < | | < < < | < < < < < < < < < < < | < < < < < < < < < < < < < | < < | < < < < < < < < < | < | | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | object unimport -importpattern System.Windows.Forms.Layout object unimport -importpattern System.Windows.Forms.PropertyGridInternal object unimport -importpattern System.Windows.Forms.VisualStyles } proc getTestLibraryDirectory {} { # # NOTE: First, query the location of the script library. This will # not work right in a "safe" interpreter. # if {[catch {info library} result] == 0} then { # # NOTE: Next, If the script library is embedded within the core # library itself (i.e. the script library location refers # to a file, not a directory), strip off the file name. # if {[file exists $result] && [file isfile $result]} then { set result [file dirname $result] } # # NOTE: Finally, return the resulting script library directory. # return $result } return "" } # # NOTE: Check for the test path in the various well-known locations # and set the associated variable. # if {![info exists ::no(checkForAndSetTestPath)]} then { checkForAndSetTestPath false [expr {![isTestSuiteRunning]}] } # # NOTE: Fake loading and configuring the "tcltest" package unless we # are prevented. # if {![info exists ::no(configureTcltest)]} then { configureTcltest [list] [list] [list] [list] false } ########################################################################### ############################# END Eagle ONLY ############################## |
︙ | ︙ | |||
3235 3236 3237 3238 3239 3240 3241 | double($::tcltest::numTests(Total)))}] } return 0; # no tests were run, etc. } # | | < < < < < < < | < < | < < < | < | < < < < < < < < < < | | | < | | | 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 | double($::tcltest::numTests(Total)))}] } return 0; # no tests were run, etc. } # # NOTE: Check for the test path in the various well-known locations # and set the associated variable. # if {![info exists ::no(checkForAndSetTestPath)]} then { checkForAndSetTestPath false [expr {![isTestSuiteRunning]}] } # # NOTE: Load and configure the "tcltest" package unless we are prevented. # if {![info exists ::no(configureTcltest)]} then { configureTcltest [list] [list] [list] [list test testConstraint] false } # # NOTE: We need several of our test related commands in the global # namespace as well. # |
︙ | ︙ | |||
3292 3293 3294 3295 3296 3297 3298 | getTestSuffix testExec testClrExec execTestShell isRandomOrder \ isBreakOnLeak isStopOnFailure isStopOnLeak isExitOnComplete \ returnInfoScript runTestPrologue runTestEpilogue hookPuts unhookPuts \ runTest testDebugBreak testArrayGet testShim tsource \ recordTestStatistics reportTestStatistics formatList formatListAsDict \ pathToRegexp inverseLsearchGlob removePathFromFileNames formatDecimal \ clearTestPercent reportTestPercent runAllTests isTestSuiteRunning \ | | | | 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 | getTestSuffix testExec testClrExec execTestShell isRandomOrder \ isBreakOnLeak isStopOnFailure isStopOnLeak isExitOnComplete \ returnInfoScript runTestPrologue runTestEpilogue hookPuts unhookPuts \ runTest testDebugBreak testArrayGet testShim tsource \ recordTestStatistics reportTestStatistics formatList formatListAsDict \ pathToRegexp inverseLsearchGlob removePathFromFileNames formatDecimal \ clearTestPercent reportTestPercent runAllTests isTestSuiteRunning \ getTestChannelOrDefault checkForAndSetTestPath configureTcltest \ machineToPlatform getPassPercentage getSkipPercentage] false false ########################################################################### ############################## END Tcl ONLY ############################### ########################################################################### } # # NOTE: Provide the Eagle test package to the interpreter. # package provide Eagle.Test \ [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}] } |
Changes to Externals/Eagle/lib/Test1.0/all.eagle.
︙ | ︙ | |||
38 39 40 41 42 43 44 45 | # # When using the above code snippet, the following code snippet may also # be used at the very end of the corresponding "all.eagle" file instead # of evaluating the "epilogue.eagle" file directly: # # runTestEpilogue # if {![info exists test_path]} then { | > > > > > | > > | | | | | 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 | # # When using the above code snippet, the following code snippet may also # be used at the very end of the corresponding "all.eagle" file instead # of evaluating the "epilogue.eagle" file directly: # # runTestEpilogue # if {![info exists test_all_path]} then { set test_all_path \ [file normalize [file dirname [info script]]] } if {![info exists test_path]} then { set test_path [file normalize [file join \ [file dirname [file dirname $test_all_path]] \ Library Tests]] } source [file join $test_all_path prologue.eagle] set no(prologue.eagle) true set no(epilogue.eagle) true set test_time [time { runAllTests $test_channel $test_path \ [getTestFiles [list $test_path] $test_flags(-file) \ $test_flags(-notFile)] \ [list [file tail [info script]] *.tcl \ epilogue.eagle prologue.eagle] \ $test_flags(-startFile) $test_flags(-stopFile) }] tputs $test_channel [appendArgs "---- all tests completed in " $test_time \n] unset test_time unset no(epilogue.eagle) unset no(prologue.eagle) if {[array size no] == 0} then {unset no} source [file join $test_all_path epilogue.eagle] |
Changes to Externals/Eagle/lib/Test1.0/constraints.eagle.
︙ | ︙ | |||
52 53 54 55 56 57 58 | # # NOTE: This job of this procedure is to return the list of "known" # versions of Mono supported by the test suite infrastructure. # return [list \ [list 2 0] [list 2 2] [list 2 4] [list 2 6] [list 2 8] [list 2 10] \ [list 2 11] [list 2 12] [list 3 0] [list 3 1] [list 3 2] [list 3 3] \ | | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # # NOTE: This job of this procedure is to return the list of "known" # versions of Mono supported by the test suite infrastructure. # return [list \ [list 2 0] [list 2 2] [list 2 4] [list 2 6] [list 2 8] [list 2 10] \ [list 2 11] [list 2 12] [list 3 0] [list 3 1] [list 3 2] [list 3 3] \ [list 3 4] [list 3 5] [list 3 6] [list 3 8] [list 3 10] [list 3 12] \ [list 4 0]] } # # NOTE: This procedure was adapted from the one listed on the Tcl Wiki page # at "http://wiki.tcl.tk/43". It is only intended to be used on very # small lists because of its heavy use of recursion and complexity on # the order of O(N!). |
︙ | ︙ | |||
99 100 101 102 103 104 105 | # # NOTE: If this Eagle version lacks [interp readylimit] -OR- it has # the default value (i.e. it always fully checks readiness), # return true. # return [expr { | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # # NOTE: If this Eagle version lacks [interp readylimit] -OR- it has # the default value (i.e. it always fully checks readiness), # return true. # return [expr { [catch {interp readylimit {}} readylimit] || $readylimit == 0 }] } # # NOTE: This procedure should return non-zero if the "whoami" command may # be executed by the test suite infrastructure outside the context # of any specific tests. |
︙ | ︙ | |||
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | # NOTE: If the test suite file exists, add it to the list of file # names to process. # if {[file exists $fileName]} then { lappend fileNames $fileName } } } # # NOTE: Check if the test package path is available. # if {[info exists ::test_path]} then { # # TODO: If additional test suite files are added within the test # package path, add them here as well. # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | 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 | # NOTE: If the test suite file exists, add it to the list of file # names to process. # if {[file exists $fileName]} then { lappend fileNames $fileName } } # # TODO: If additional test suite files are added within the base # package path, add them here as well. # foreach fileNameOnly [list \ all.eagle constraints.eagle epilogue.eagle pkgIndex.eagle \ pkgIndex.tcl prologue.eagle] { # # NOTE: First, check if the file resides in the Eagle-specific # package sub-directory. Failing that, fallback to using # the base package path itself. # set fileName [file join \ $::test_package_path Test1.0 $fileNameOnly] if {![file exists $fileName]} then { set fileName [file join $::test_package_path $fileNameOnly] } # # NOTE: If the test suite file exists, add it to the list of file # names to process. # if {[file exists $fileName]} then { lappend fileNames $fileName } } } # # NOTE: Check if the test package path is available. # if {[info exists ::test_path]} then { # # TODO: If additional test suite files are added within the test # package path, add them here as well. # foreach fileNameOnly [list all.eagle epilogue.eagle prologue.eagle] { # # NOTE: Check if the file resides in the test package directory. # set fileName [file join $::test_path $fileNameOnly] # # NOTE: If the test suite file exists, add it to the list of file |
︙ | ︙ | |||
1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | addConstraint timeIntensive tputs $channel yes\n } else { tputs $channel no\n } } proc checkForMemoryIntensive { channel } { tputs $channel "---- checking for memory intensive testing... " # # NOTE: Are we allowed to do memory intensive testing? # | > > > > > > > > > > > > > > > > | 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | addConstraint timeIntensive tputs $channel yes\n } else { tputs $channel no\n } } proc checkForFullTest { channel } { tputs $channel "---- checking for full testing... " # # NOTE: Are we allowed to do full testing (i.e. to run rarely # needed tests)? # if {![info exists ::no(fullTest)]} then { addConstraint fullTest tputs $channel yes\n } else { tputs $channel no\n } } proc checkForMemoryIntensive { channel } { tputs $channel "---- checking for memory intensive testing... " # # NOTE: Are we allowed to do memory intensive testing? # |
︙ | ︙ | |||
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 | addConstraint strongName tputs $channel yes\n } else { tputs $channel no\n } } proc checkForCertificate { channel } { tputs $channel "---- checking for certificate... " if {[catch { object invoke Interpreter.GetActive GetCertificate } certificate] == 0 && [string length $certificate] > 0} then { # # NOTE: Yes, it appears that the core library was signed with a # code-signing certificate. # addConstraint certificate # # NOTE: Attempt to query the subject from the certificate. # if {[catch { object invoke $certificate Subject | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 | addConstraint strongName tputs $channel yes\n } else { tputs $channel no\n } } proc checkForStrongNameKey { channel } { tputs $channel "---- checking for strong name key... " if {[catch {info engine PublicKeyToken} publicKeyToken] == 0 && \ [string length $publicKeyToken] > 0} then { # # NOTE: Add a test constraint for this specific strong name key. # addConstraint [appendArgs strongName. $publicKeyToken] # # NOTE: Show the strong name key that we found. # tputs $channel [appendArgs "yes (" $publicKeyToken ")\n"] # # BUGBUG: Tcl 8.4 does not seem to like this expression because it # contains the "ni" operator added in Tcl 8.5 (and Tcl 8.4 # tries to compile it even though it will only be evaluated # in Eagle). # set expr {$publicKeyToken ni \ "29c6297630be05eb 1e22ec67879739a2 358030063a832bc3"} if {[expr $expr]} then { # # NOTE: The Eagle core library is strong name signed with a key that # is not official. This is also not an error, per se; however, # it may cause some tests to fail and it should be reported to # the user and noted in the test suite log file. # addConstraint strongName.unofficial # # NOTE: Unless forbidden, issue and log a warning. # if {![info exists no(warningForStrongNameKey)] && \ ![haveConstraint quiet]} then { tputs $channel [appendArgs \ "==== WARNING: unofficial Eagle strong name signature " \ "detected: " $publicKeyToken \n] } } else { # # NOTE: Several tests require one of the official strong name keys to # be used in order for them to pass. # addConstraint strongName.official tputs $channel [appendArgs \ "---- official Eagle strong name signature detected: " \ $publicKeyToken \n] } } else { # # NOTE: The Eagle core library is not signed with a strong name key. # This is not an error, per se; however, it may cause selected # tests to fail and it should be reported to the user and noted # in the test suite log file. # addConstraint strongName.none # # NOTE: Show that we did not find a strong name key. # tputs $channel no\n # # NOTE: Unless forbidden, issue and log a warning. # if {![info exists no(warningForStrongNameKey)] && \ ![haveConstraint quiet]} then { tputs $channel \ "==== WARNING: no Eagle strong name signature detected...\n" } } } proc checkForCertificate { channel } { tputs $channel "---- checking for certificate... " if {[catch { object invoke Interpreter.GetActive GetCertificate } certificate] == 0 && [string length $certificate] > 0} then { # # NOTE: Yes, it appears that the core library was signed with a # code-signing certificate. # addConstraint certificate # # NOTE: Attempt to query the subject from the certificate. # if {[catch { object invoke $certificate Subject } subject] || [string length $subject] == 0} then { # # TODO: No certificate subject, better handling here? # set subject unknown } tputs $channel [appendArgs "yes (" $subject ")\n"] |
︙ | ︙ | |||
2065 2066 2067 2068 2069 2070 2071 | tputs $channel "---- checking for default application domain... " if {[catch { object invoke AppDomain CurrentDomain } appDomain] == 0 && [string length $appDomain] > 0} then { if {[catch { object invoke $appDomain IsDefaultAppDomain | | | | 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 | tputs $channel "---- checking for default application domain... " if {[catch { object invoke AppDomain CurrentDomain } appDomain] == 0 && [string length $appDomain] > 0} then { if {[catch { object invoke $appDomain IsDefaultAppDomain } default] || [string length $default] == 0} then { set default false } if {[catch {object invoke $appDomain Id} id] || \ [string length $id] == 0} then { set id unknown } if {$default} then { addConstraint defaultAppDomain |
︙ | ︙ | |||
2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 | tputs $channel [appendArgs $result ", " $::tcl_platform(processBits) \ -bit " " $::tcl_platform(machine) \n] } else { tputs $channel "no, unknown\n" } } proc checkForGarudaDll { channel } { # # NOTE: Skip automatic Tcl shell machine detection if we are not # allowed to execute external commands. # if {[canExecTclShell]} then { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 | tputs $channel [appendArgs $result ", " $::tcl_platform(processBits) \ -bit " " $::tcl_platform(machine) \n] } else { tputs $channel "no, unknown\n" } } proc checkForTestCallStack { channel } { tputs $channel "---- checking for test call stack... " # # NOTE: Search for a call frame with associated arguments. # At this point, there must be at least one such call # frame (this one). Therefore, this loop will always # terminate. # set index 0; set arguments [list] set script {info level [info level]} while {1} { set level [appendArgs ## $index] if {[catch {uplevel $level $script} arguments] == 0} then { break } incr index } # # NOTE: Grab the command name from the arguments, if any. # set command [expr { [llength $arguments] > 0 ? [lindex $arguments 0] : "" }] # # HACK: Make sure the call stack does not end up confusing # the tests that rely on absolute call frames. # if {$command in [list checkForTestCallStack]} then { addConstraint testCallStack tputs $channel [appendArgs "yes (\"" $command "\")\n"] # # NOTE: We are done here, return now. # return } tputs $channel [appendArgs "no (\"" $command "\")\n"] } proc checkForGarudaDll { channel } { # # NOTE: Skip automatic Tcl shell machine detection if we are not # allowed to execute external commands. # if {[canExecTclShell]} then { |
︙ | ︙ | |||
3218 3219 3220 3221 3222 3223 3224 | return } } tputs $channel no\n } | > > > > > > > > > > > > > > > > > | | | 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | return } } tputs $channel no\n } proc getFrameworkSetup46Value {} { # # NOTE: Check if we are running on Windows 10 or later. # if {[isWindows] && $::tcl_platform(osVersion) >= 10.0} then { # # NOTE: We are running on Windows 10, return the special value. # return 393295 } # # NOTE: We are not running on Windows 10, return the normal value. # return 393297 } proc checkForNetFx4x { channel } { tputs $channel "---- checking for .NET Framework 4.x... " # # NOTE: Platform must be Windows for this constraint to even be # checked (i.e. we require the registry). # if {[isWindows]} then { # |
︙ | ︙ | |||
3260 3261 3262 3263 3264 3265 3266 | # # NOTE: If the "release" value is greater than or equal to 378758 # (or 378675 for Windows 8.1), then the .NET Framework 4.5.1 # is installed. However, if the "release" value is also # greater than or equal to 379893, then the .NET Framework # 4.5.2 is installed, which is an in-place upgrade to 4.5.1 # (and 4.5). If the "release" value is also greater than or | | | < < | | > > > | 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 | # # NOTE: If the "release" value is greater than or equal to 378758 # (or 378675 for Windows 8.1), then the .NET Framework 4.5.1 # is installed. However, if the "release" value is also # greater than or equal to 379893, then the .NET Framework # 4.5.2 is installed, which is an in-place upgrade to 4.5.1 # (and 4.5). If the "release" value is also greater than or # equal to 393297 (393295 on Windows 10), then the .NET # Framework 4.6 is installed, which is an in-place upgrade # to 4.5.x. # if {$release >= [getFrameworkSetup46Value]} then { addConstraint dotNet451OrHigher addConstraint dotNet452OrHigher addConstraint dotNet46 addConstraint dotNet46OrHigher set version 4.6 } elseif {$release >= 379893} then { addConstraint dotNet451OrHigher addConstraint dotNet452 addConstraint dotNet452OrHigher set version 4.5.2 } elseif {$release >= 378675} then { addConstraint dotNet451 addConstraint dotNet451OrHigher |
︙ | ︙ | |||
3520 3521 3522 3523 3524 3525 3526 | checkForGaruda checkForShell checkForDebug checkForTk checkForVersion \ checkForCommand checkForNamespaces checkForTestExec \ checkForTestMachine checkForTestPlatform checkForTestConfiguration \ checkForTestSuffix checkForFile checkForPathFile checkForNativeCode \ checkForTip127 checkForTip194 checkForTip207 checkForTip241 \ checkForTip285 checkForTip405 checkForTip426 checkForTip429 \ checkForTiming checkForPerformance checkForBigLists \ | | | | | | 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 | checkForGaruda checkForShell checkForDebug checkForTk checkForVersion \ checkForCommand checkForNamespaces checkForTestExec \ checkForTestMachine checkForTestPlatform checkForTestConfiguration \ checkForTestSuffix checkForFile checkForPathFile checkForNativeCode \ checkForTip127 checkForTip194 checkForTip207 checkForTip241 \ checkForTip285 checkForTip405 checkForTip426 checkForTip429 \ checkForTiming checkForPerformance checkForBigLists \ checkForTimeIntensive checkForFullTest checkForMemoryIntensive \ checkForStackIntensive checkForInteractive checkForInteractiveCommand \ checkForUserInteraction checkForNetwork checkForCompileOption \ checkForKnownCompileOptions] false false ########################################################################### ############################## END Tcl ONLY ############################### ########################################################################### } # # NOTE: Provide the Eagle test constraints package to the interpreter. # package provide Eagle.Test.Constraints \ [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}] } |
Changes to Externals/Eagle/lib/Test1.0/epilogue.eagle.
︙ | ︙ | |||
21 22 23 24 25 26 27 | # # NOTE: Verify that the current call frame is correct and that the # interpreter call stack has not been imbalanced by previous # tests or other errors. This check only applies to Eagle. # if {[isEagle] && [llength [info commands object]] > 0} then { | < | | | | | | | | | < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # # NOTE: Verify that the current call frame is correct and that the # interpreter call stack has not been imbalanced by previous # tests or other errors. This check only applies to Eagle. # if {[isEagle] && [llength [info commands object]] > 0} then { # # NOTE: Check the name of the current call frame against the one # that should be used for evaluating this script file. # if {[object invoke -flags +NonPublic \ Interpreter.GetActive.CurrentFrame Name] ne \ [list source [file normalize [info script]]]} then { unset -nocomplain test_suite_running error "cannot run epilogue, current frame not for this script" } } # # NOTE: Make sure all the variables used by this epilogue are unset. # unset -nocomplain memory stack name count passedOrSkipped percent \ |
︙ | ︙ |
Changes to Externals/Eagle/lib/Test1.0/prologue.eagle.
︙ | ︙ | |||
19 20 21 22 23 24 25 | error "cannot run, current level is not global" } # # NOTE: Make sure all the variables used by this prologue are unset. # unset -nocomplain pkg_dir pattern dummy directory name value exec encoding \ | | | > > > > > > > | > | 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 | error "cannot run, current level is not global" } # # NOTE: Make sure all the variables used by this prologue are unset. # unset -nocomplain pkg_dir pattern dummy directory name value exec encoding \ host memory stack drive server database timeout user password percent \ checkout timeStamp loaded # # NOTE: Indicate that the test suite is currently running. # if {![info exists test_suite_running] || !$test_suite_running} then { set test_suite_running true } # # NOTE: Set the location of the test suite package, if necessary. # if {![info exists test_all_path]} then { set test_all_path [file normalize [file dirname [info script]]] } # # NOTE: Set the location of the test suite, if necessary. # if {![info exists test_path]} then { set test_path [file normalize [file join \ [file dirname [file dirname $test_all_path]] Library Tests]] } # # NOTE: Set the location of the test suite data, if necessary. # if {![info exists test_data_path]} then { set test_data_path [file join $test_path data] |
︙ | ︙ | |||
177 178 179 180 181 182 183 | # NOTE: Make sure our primary package path is part of the auto-path. # if {[lsearch -exact $auto_path $test_package_path] == -1} then { lappend auto_path $test_package_path } # | > > > > > | > > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | # NOTE: Make sure our primary package path is part of the auto-path. # if {[lsearch -exact $auto_path $test_package_path] == -1} then { lappend auto_path $test_package_path } # # NOTE: Make sure the test suite package is part of the auto-path. # if {[lsearch -exact $auto_path $test_all_path] == -1} then { lappend auto_path $test_all_path } # # NOTE: Make sure the test suite is part of the auto-path. This is # now done for legacy compatibility only. # if {[lsearch -exact $auto_path $test_path] == -1} then { lappend auto_path $test_path } ############################################################################# |
︙ | ︙ | |||
216 217 218 219 220 221 222 | # # NOTE: Verify that the current call frame is correct and that the # interpreter call stack has not been imbalanced by previous # tests or other errors. This check only applies to Eagle. # This block requires the "Eagle.Library" package. # if {[isEagle] && [llength [info commands object]] > 0} then { | < | | | | | | | | | < | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | # # NOTE: Verify that the current call frame is correct and that the # interpreter call stack has not been imbalanced by previous # tests or other errors. This check only applies to Eagle. # This block requires the "Eagle.Library" package. # if {[isEagle] && [llength [info commands object]] > 0} then { # # NOTE: Check the name of the current call frame against the one # that should be used for evaluating this script file. # if {[object invoke -flags +NonPublic \ Interpreter.GetActive.CurrentFrame Name] ne \ [list source [file normalize [info script]]]} then { unset -nocomplain test_suite_running error "cannot run prologue, current frame not for this script" } } ############################################################################# # # NOTE: Set the local root directory of the source checkout (i.e. of Eagle |
︙ | ︙ | |||
305 306 307 308 309 310 311 312 313 314 315 316 | set test_flags(-stopOnLeak) ""; # default to continue on leak. set test_flags(-exitOnComplete) ""; # default to not exit after complete. set test_flags(-preTest) ""; # default to not evaluating anything. set test_flags(-postTest) ""; # default to not evaluating anything. set test_flags(-preWait) ""; # default to not waiting. set test_flags(-postWait) ""; # default to not waiting. set test_flags(-tclsh) ""; # Tcl shell, default to empty. # # NOTE: Check for and process any command line arguments. # if {[info exists argv]} then { | > > | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | set test_flags(-stopOnLeak) ""; # default to continue on leak. set test_flags(-exitOnComplete) ""; # default to not exit after complete. set test_flags(-preTest) ""; # default to not evaluating anything. set test_flags(-postTest) ""; # default to not evaluating anything. set test_flags(-preWait) ""; # default to not waiting. set test_flags(-postWait) ""; # default to not waiting. set test_flags(-tclsh) ""; # Tcl shell, default to empty. set test_flags(-bad) [list]; # these are the unrecognized arguments. set test_flags(-no) [list]; # default to not having any restrictions. # # NOTE: Check for and process any command line arguments. # if {[info exists argv]} then { set test_flags(-bad) [eval processTestArguments test_flags false $argv] if {[info exists test_flags(-no)] && \ [string length $test_flags(-no)] > 0} then { # # NOTE: Set the test run restrictions based on the provided command line # argument value (which is assumed to be a "dictionary-style" list # containing name/value pairs to add to the global "no" array). |
︙ | ︙ | |||
728 729 730 731 732 733 734 735 736 737 738 739 740 741 | tputs $test_channel [appendArgs "---- executable: \"" \ $bin_file \"\n] tputs $test_channel [appendArgs "---- command line: " \ [expr {[info exists argv] && [string length $argv] > 0 ? \ $argv : "<none>"}] \n] tputs $test_channel [appendArgs "---- logging to: " \ [expr {[info exists test_log] && [string length $test_log] > 0 ? \ [appendArgs \" $test_log \"] : "<none>"}] \n] tputs $test_channel [appendArgs "---- pass threshold: " \ [expr {[info exists test_threshold] && \ | > > > > > | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | tputs $test_channel [appendArgs "---- executable: \"" \ $bin_file \"\n] tputs $test_channel [appendArgs "---- command line: " \ [expr {[info exists argv] && [string length $argv] > 0 ? \ $argv : "<none>"}] \n] tputs $test_channel [appendArgs "---- unrecognized arguments: " \ [expr {[info exists test_flags(-bad)] && \ [string length $test_flags(-bad)] > 0 ? \ $test_flags(-bad) : "<none>"}] \n] tputs $test_channel [appendArgs "---- logging to: " \ [expr {[info exists test_log] && [string length $test_log] > 0 ? \ [appendArgs \" $test_log \"] : "<none>"}] \n] tputs $test_channel [appendArgs "---- pass threshold: " \ [expr {[info exists test_threshold] && \ |
︙ | ︙ | |||
880 881 882 883 884 885 886 | # "debug-1.4", "glob-99.*", "object-10.*", "perf-2.2", # and various other places within the test suite code # itself. # checkForQuiet $test_channel false } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | # "debug-1.4", "glob-99.*", "object-10.*", "perf-2.2", # and various other places within the test suite code # itself. # checkForQuiet $test_channel false } # # NOTE: Has administrator detection support been disabled? We do # this check [nearly] first as it may [eventually] be used # to help determine if other constraints should be skipped. # if {![info exists no(administrator)]} then { checkForAdministrator $test_channel |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | if {![info exists no(machine)]} then { checkForMachine $test_channel 32 intel; # (i.e. x86) checkForMachine $test_channel 32 arm; # (i.e. arm) checkForMachine $test_channel 64 ia64; # (i.e. itanium) checkForMachine $test_channel 64 amd64; # (i.e. x64) } # # NOTE: Has culture detection support been disabled? # if {![info exists no(culture)]} then { checkForCulture $test_channel } | > > > > > > > | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | if {![info exists no(machine)]} then { checkForMachine $test_channel 32 intel; # (i.e. x86) checkForMachine $test_channel 32 arm; # (i.e. arm) checkForMachine $test_channel 64 ia64; # (i.e. itanium) checkForMachine $test_channel 64 amd64; # (i.e. x64) } # # NOTE: Has test suite call stack probing been disabled? # if {![info exists no(testCallStack)]} then { checkForTestCallStack $test_channel } # # NOTE: Has culture detection support been disabled? # if {![info exists no(culture)]} then { checkForCulture $test_channel } |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | # # NOTE: Has strong name detection support been disabled? # if {![info exists no(strongName)]} then { checkForStrongName $test_channel } # # NOTE: Has certificate detection support been disabled? # if {![info exists no(certificate)]} then { checkForCertificate $test_channel } | > > > > > > > | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | # # NOTE: Has strong name detection support been disabled? # if {![info exists no(strongName)]} then { checkForStrongName $test_channel } # # NOTE: Has strong name key detection been disabled? # if {![info exists no(strongNameKey)]} then { checkForStrongNameKey $test_channel } # # NOTE: Has certificate detection support been disabled? # if {![info exists no(certificate)]} then { checkForCertificate $test_channel } |
︙ | ︙ | |||
1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 | # # NOTE: For test "lpermute-1.3". # checkForObjectMember $test_channel Eagle._Tests.Default \ *TestPermute* } # # NOTE: Has DateTime testing support been disabled? # if {![info exists no(testDateTime)]} then { # # NOTE: For test "vwait-1.11". # | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 | # # NOTE: For test "lpermute-1.3". # checkForObjectMember $test_channel Eagle._Tests.Default \ *TestPermute* } if {![info exists no(testDynamicCallback)]} then { # # NOTE: For tests "object-8.1??". # checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallDynamicCallback0* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallDynamicCallback1* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallDynamicCallback2* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallDynamicCallback3* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestGetDynamicCallbacks* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallStaticDynamicCallback0* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallStaticDynamicCallback1* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallStaticDynamicCallback2* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestCallStaticDynamicCallback3* checkForObjectMember $test_channel Eagle._Tests.Default \ *TestGetStaticDynamicCallbacks* } # # NOTE: Has DateTime testing support been disabled? # if {![info exists no(testDateTime)]} then { # # NOTE: For test "vwait-1.11". # |
︙ | ︙ | |||
2115 2116 2117 2118 2119 2120 2121 | # # NOTE: For test "hash-1.1". # checkForNetFx20ServicePack $test_channel } # | | | | | 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 | # # NOTE: For test "hash-1.1". # checkForNetFx20ServicePack $test_channel } # # NOTE: Has .NET Framework 4.x testing support been disabled? # if {![info exists no(netFx4x)]} then { # # NOTE: For test "object-12.1.*". # checkForNetFx4x $test_channel } # # NOTE: Has target framework testing support been disabled? # if {![info exists no(targetFramework)]} then { checkForTargetFramework $test_channel |
︙ | ︙ | |||
2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 | # # NOTE: For tests "benchmark-1.3[89]" and "benchmark-1.40". # if {![info exists no(benchmark.txt)]} then { checkForFile $test_channel [file join $test_data_path benchmark.txt] } # # NOTE: For test "garuda-1.1". # if {![info exists no(pkgAll.tcl)]} then { checkForFile $test_channel [file join $base_path Native Package \ Tests all.tcl] pkgAll.tcl } # # NOTE: For tests "subst-1.*". # if {![info exists no(bad_subst.txt)]} then { checkForFile $test_channel [file join $test_data_path bad_subst.txt] } # # NOTE: This is not currently used by any tests. # if {![info exists no(evaluate.eagle)]} then { checkForFile $test_channel [file join $test_data_path evaluate.eagle] } | > > > > > > > > > > > > > > | 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 | # # NOTE: For tests "benchmark-1.3[89]" and "benchmark-1.40". # if {![info exists no(benchmark.txt)]} then { checkForFile $test_channel [file join $test_data_path benchmark.txt] } # # NOTE: For test "benchmark-1.42". # if {![info exists no(pngDump.txt)]} then { checkForFile $test_channel [file join $test_data_path pngDump.txt] } # # NOTE: For test "garuda-1.1". # if {![info exists no(pkgAll.tcl)]} then { checkForFile $test_channel [file join $base_path Native Package \ Tests all.tcl] pkgAll.tcl } # # NOTE: For tests "subst-1.*". # if {![info exists no(bad_subst.txt)]} then { checkForFile $test_channel [file join $test_data_path bad_subst.txt] } # # NOTE: For test "processIsolation-1.1". # if {![info exists no(isolated.eagle)]} then { checkForFile $test_channel [file join $test_data_path isolated.eagle] } # # NOTE: This is not currently used by any tests. # if {![info exists no(evaluate.eagle)]} then { checkForFile $test_channel [file join $test_data_path evaluate.eagle] } |
︙ | ︙ | |||
2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 | if {![info exists no(checkForBigLists)]} then { checkForBigLists $test_channel } if {![info exists no(checkForTimeIntensive)]} then { checkForTimeIntensive $test_channel } if {![info exists no(checkForMemoryIntensive)]} then { checkForMemoryIntensive $test_channel } if {![info exists no(checkForStackIntensive)]} then { checkForStackIntensive $test_channel | > > > > | 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 | if {![info exists no(checkForBigLists)]} then { checkForBigLists $test_channel } if {![info exists no(checkForTimeIntensive)]} then { checkForTimeIntensive $test_channel } if {![info exists no(checkForFullTest)]} then { checkForFullTest $test_channel } if {![info exists no(checkForMemoryIntensive)]} then { checkForMemoryIntensive $test_channel } if {![info exists no(checkForStackIntensive)]} then { checkForStackIntensive $test_channel |
︙ | ︙ |
Changes to SQLite.Interop/src/ext/fts5.c.
︙ | ︙ | |||
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 | ** ** Virtual table implementations may overload SQL functions by implementing ** the sqlite3_module.xFindFunction() method. */ typedef struct Fts5ExtensionApi Fts5ExtensionApi; typedef struct Fts5Context Fts5Context; typedef void (*fts5_extension_function)( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ sqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ sqlite3_value **apVal /* Array of trailing arguments */ ); /* ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): ** Return a copy of the context pointer the extension function was ** registered with. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken ** to the total number of tokens in the FTS5 table. Or, if iCol is ** non-negative but less than the number of columns in the table, return ** the total number of tokens in column iCol, considering all rows in ** the FTS5 table. ** ** If parameter iCol is greater than or equal to the number of columns ** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. ** an OOM condition or IO error), an appropriate SQLite error code is ** returned. ** | > > > > > > | | | > | > > > > > > > | 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 | ** ** Virtual table implementations may overload SQL functions by implementing ** the sqlite3_module.xFindFunction() method. */ typedef struct Fts5ExtensionApi Fts5ExtensionApi; typedef struct Fts5Context Fts5Context; typedef struct Fts5PhraseIter Fts5PhraseIter; typedef void (*fts5_extension_function)( const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ Fts5Context *pFts, /* First arg to pass to pApi functions */ sqlite3_context *pCtx, /* Context for returning result/error */ int nVal, /* Number of values in apVal[] array */ sqlite3_value **apVal /* Array of trailing arguments */ ); struct Fts5PhraseIter { const unsigned char *a; const unsigned char *b; }; /* ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): ** Return a copy of the context pointer the extension function was ** registered with. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken ** to the total number of tokens in the FTS5 table. Or, if iCol is ** non-negative but less than the number of columns in the table, return ** the total number of tokens in column iCol, considering all rows in ** the FTS5 table. ** ** If parameter iCol is greater than or equal to the number of columns ** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. ** an OOM condition or IO error), an appropriate SQLite error code is ** returned. ** ** xColumnCount(pFts): ** Return the number of columns in the table. ** ** xColumnSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken ** to the total number of tokens in the current row. Or, if iCol is ** non-negative but less than the number of columns in the table, set ** *pnToken to the number of tokens in column iCol of the current row. ** ** If parameter iCol is greater than or equal to the number of columns ** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g. ** an OOM condition or IO error), an appropriate SQLite error code is ** returned. ** ** xColumnText: ** This function attempts to retrieve the text of column iCol of the ** current document. If successful, (*pz) is set to point to a buffer ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, ** if an error occurs, an SQLite error code is returned and the final values |
︙ | ︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 | ** ** xRowCount(pFts5, pnRow) ** ** This function is used to retrieve the total number of rows in the table. ** In other words, the same value that would be returned by: ** ** SELECT count(*) FROM ftstable; */ struct Fts5ExtensionApi { int iVersion; /* Currently always set to 1 */ void *(*xUserData)(Fts5Context*); int (*xColumnCount)(Fts5Context*); | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ** ** xRowCount(pFts5, pnRow) ** ** This function is used to retrieve the total number of rows in the table. ** In other words, the same value that would be returned by: ** ** SELECT count(*) FROM ftstable; ** ** xPhraseFirst() ** This function is used, along with type Fts5PhraseIter and the xPhraseNext ** method, to iterate through all instances of a single query phrase within ** the current row. This is the same information as is accessible via the ** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient ** to use, this API may be faster under some circumstances. To iterate ** through instances of phrase iPhrase, use the following code: ** ** Fts5PhraseIter iter; ** int iCol, iOff; ** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff); ** iOff>=0; ** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff) ** ){ ** // An instance of phrase iPhrase at offset iOff of column iCol ** } ** ** The Fts5PhraseIter structure is defined above. Applications should not ** modify this structure directly - it should only be used as shown above ** with the xPhraseFirst() and xPhraseNext() API methods. ** ** xPhraseNext() ** See xPhraseFirst above. */ struct Fts5ExtensionApi { int iVersion; /* Currently always set to 1 */ void *(*xUserData)(Fts5Context*); int (*xColumnCount)(Fts5Context*); |
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 | int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken); int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData, int(*)(const Fts5ExtensionApi*,Fts5Context*,void*) ); int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*)); void *(*xGetAuxdata)(Fts5Context*, int bClear); }; /* ** CUSTOM AUXILIARY FUNCTIONS *************************************************************************/ /************************************************************************* | > > > | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken); int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData, int(*)(const Fts5ExtensionApi*,Fts5Context*,void*) ); int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*)); void *(*xGetAuxdata)(Fts5Context*, int bClear); void (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*); void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff); }; /* ** CUSTOM AUXILIARY FUNCTIONS *************************************************************************/ /************************************************************************* |
︙ | ︙ | |||
482 483 484 485 486 487 488 | char *zRankArgs; /* Arguments to rank function */ /* If non-NULL, points to sqlite3_vtab.base.zErrmsg. Often NULL. */ char **pzErrmsg; }; /* Current expected value of %_config table 'version' field */ | | | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | char *zRankArgs; /* Arguments to rank function */ /* If non-NULL, points to sqlite3_vtab.base.zErrmsg. Often NULL. */ char **pzErrmsg; }; /* Current expected value of %_config table 'version' field */ #define FTS5_CURRENT_VERSION 3 #define FTS5_CONTENT_NORMAL 0 #define FTS5_CONTENT_NONE 1 #define FTS5_CONTENT_EXTERNAL 2 |
︙ | ︙ | |||
635 636 637 638 639 640 641 | ** sqlite3Fts5IterNext(pIter) ** ){ ** i64 iRowid = sqlite3Fts5IterRowid(pIter); ** } */ /* | | | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | ** sqlite3Fts5IterNext(pIter) ** ){ ** i64 iRowid = sqlite3Fts5IterRowid(pIter); ** } */ /* ** Open a new iterator to iterate though all rowids that match the ** specified token or token prefix. */ static int sqlite3Fts5IndexQuery( Fts5Index *p, /* FTS index to query */ const char *pToken, int nToken, /* Token (or prefix) to query for */ int flags, /* Mask of FTS5INDEX_QUERY_X flags */ Fts5IndexIter **ppIter |
︙ | ︙ | |||
1931 1932 1933 1934 1935 1936 1937 | ** ** This is an SQLite module implementing full-text search. */ | | | 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 | ** ** This is an SQLite module implementing full-text search. */ #define FTS5_DEFAULT_PAGE_SIZE 4050 #define FTS5_DEFAULT_AUTOMERGE 4 #define FTS5_DEFAULT_CRISISMERGE 16 /* Maximum allowed page size */ #define FTS5_MAX_PAGE_SIZE (128*1024) static int fts5_iswhitespace(char x){ |
︙ | ︙ | |||
2810 2811 2812 2813 2814 2815 2816 | static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); static void sqlite3Fts5ParserFree(void*, void (*freeProc)(void*)); static void sqlite3Fts5Parser(void*, int, Fts5Token, Fts5Parse*); struct Fts5Expr { Fts5Index *pIndex; Fts5ExprNode *pRoot; | | | 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 | static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(u64)); static void sqlite3Fts5ParserFree(void*, void (*freeProc)(void*)); static void sqlite3Fts5Parser(void*, int, Fts5Token, Fts5Parse*); struct Fts5Expr { Fts5Index *pIndex; Fts5ExprNode *pRoot; int bDesc; /* Iterate in descending rowid order */ int nPhrase; /* Number of phrases in expression */ Fts5ExprPhrase **apExprPhrase; /* Pointers to phrase objects */ }; /* ** eType: ** Expression node type. Always one of: |
︙ | ︙ | |||
4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 | int i; const char **azConfig; /* Array of arguments for Fts5Config */ const char *zNearsetCmd = "nearset"; int nConfig; /* Size of azConfig[] */ Fts5Config *pConfig = 0; int iArg = 1; if( bTcl && nArg>1 ){ zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]); iArg = 2; } nConfig = 3 + (nArg-iArg); | > > > > > > > > > | 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 | int i; const char **azConfig; /* Array of arguments for Fts5Config */ const char *zNearsetCmd = "nearset"; int nConfig; /* Size of azConfig[] */ Fts5Config *pConfig = 0; int iArg = 1; if( nArg<1 ){ char *zErr = sqlite3_mprintf("wrong number of arguments to function %s", bTcl ? "fts5_expr_tcl" : "fts5_expr" ); sqlite3_result_error(pCtx, zErr, -1); sqlite3_free(zErr); return; } if( bTcl && nArg>1 ){ zNearsetCmd = (const char*)sqlite3_value_text(apVal[1]); iArg = 2; } nConfig = 3 + (nArg-iArg); |
︙ | ︙ | |||
4779 4780 4781 4782 4783 4784 4785 | return rc; } /* ** Return the number of phrases in expression pExpr. */ static int sqlite3Fts5ExprPhraseCount(Fts5Expr *pExpr){ | | | 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 | return rc; } /* ** Return the number of phrases in expression pExpr. */ static int sqlite3Fts5ExprPhraseCount(Fts5Expr *pExpr){ return (pExpr ? pExpr->nPhrase : 0); } /* ** Return the number of terms in the iPhrase'th phrase in pExpr. */ static int sqlite3Fts5ExprPhraseSize(Fts5Expr *pExpr, int iPhrase){ if( iPhrase<0 || iPhrase>=pExpr->nPhrase ) return 0; |
︙ | ︙ | |||
4944 4945 4946 4947 4948 4949 4950 | sqlite3_free(pSlot); } } memset(pHash->aSlot, 0, pHash->nSlot * sizeof(Fts5HashEntry*)); pHash->nEntry = 0; } | | | | 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 | sqlite3_free(pSlot); } } memset(pHash->aSlot, 0, pHash->nSlot * sizeof(Fts5HashEntry*)); pHash->nEntry = 0; } static unsigned int fts5HashKey(int nSlot, const u8 *p, int n){ int i; unsigned int h = 13; for(i=n-1; i>=0; i--){ h = (h << 3) ^ h ^ p[i]; } return (h % nSlot); } static unsigned int fts5HashKey2(int nSlot, u8 b, const u8 *p, int n){ int i; unsigned int h = 13; for(i=n-1; i>=0; i--){ h = (h << 3) ^ h ^ p[i]; } h = (h << 3) ^ h ^ b; return (h % nSlot); |
︙ | ︙ | |||
4981 4982 4983 4984 4985 4986 4987 | memset(apNew, 0, nNew*sizeof(Fts5HashEntry*)); for(i=0; i<pHash->nSlot; i++){ while( apOld[i] ){ int iHash; Fts5HashEntry *p = apOld[i]; apOld[i] = p->pHashNext; | | | 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 | memset(apNew, 0, nNew*sizeof(Fts5HashEntry*)); for(i=0; i<pHash->nSlot; i++){ while( apOld[i] ){ int iHash; Fts5HashEntry *p = apOld[i]; apOld[i] = p->pHashNext; iHash = fts5HashKey(nNew, (u8*)p->zKey, strlen(p->zKey)); p->pHashNext = apNew[iHash]; apNew[iHash] = p; } } sqlite3_free(apOld); pHash->nSlot = nNew; |
︙ | ︙ | |||
5021 5022 5023 5024 5025 5026 5027 | Fts5Hash *pHash, i64 iRowid, /* Rowid for this entry */ int iCol, /* Column token appears in (-ve -> delete) */ int iPos, /* Position of token within column */ char bByte, /* First byte of token */ const char *pToken, int nToken /* Token to add or remove to or from index */ ){ | | > | | | 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 | Fts5Hash *pHash, i64 iRowid, /* Rowid for this entry */ int iCol, /* Column token appears in (-ve -> delete) */ int iPos, /* Position of token within column */ char bByte, /* First byte of token */ const char *pToken, int nToken /* Token to add or remove to or from index */ ){ unsigned int iHash; Fts5HashEntry *p; u8 *pPtr; int nIncr = 0; /* Amount to increment (*pHash->pnByte) by */ /* Attempt to locate an existing hash entry */ iHash = fts5HashKey2(pHash->nSlot, (u8)bByte, (const u8*)pToken, nToken); for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){ if( p->zKey[0]==bByte && memcmp(&p->zKey[1], pToken, nToken)==0 && p->zKey[nToken+1]==0 ){ break; } } /* If an existing hash entry cannot be found, create a new one. */ if( p==0 ){ int nByte = FTS5_HASHENTRYSIZE + (nToken+1) + 1 + 64; if( nByte<128 ) nByte = 128; if( (pHash->nEntry*2)>=pHash->nSlot ){ int rc = fts5HashResize(pHash); if( rc!=SQLITE_OK ) return rc; iHash = fts5HashKey2(pHash->nSlot, (u8)bByte, (const u8*)pToken, nToken); } p = (Fts5HashEntry*)sqlite3_malloc(nByte); if( !p ) return SQLITE_NOMEM; memset(p, 0, FTS5_HASHENTRYSIZE); p->nAlloc = nByte; p->zKey[0] = bByte; memcpy(&p->zKey[1], pToken, nToken); assert( iHash==fts5HashKey(pHash->nSlot, (u8*)p->zKey, nToken+1) ); p->zKey[nToken+1] = '\0'; p->nData = nToken+1 + 1 + FTS5_HASHENTRYSIZE; p->nData += sqlite3Fts5PutVarint(&((u8*)p)[p->nData], iRowid); p->iSzPoslist = p->nData; p->nData += 1; p->iRowid = iRowid; p->pHashNext = pHash->aSlot[iHash]; |
︙ | ︙ | |||
5225 5226 5227 5228 5229 5230 5231 | */ static int sqlite3Fts5HashQuery( Fts5Hash *pHash, /* Hash table to query */ const char *pTerm, int nTerm, /* Query term */ const u8 **ppDoclist, /* OUT: Pointer to doclist for pTerm */ int *pnDoclist /* OUT: Size of doclist in bytes */ ){ | | | 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 | */ static int sqlite3Fts5HashQuery( Fts5Hash *pHash, /* Hash table to query */ const char *pTerm, int nTerm, /* Query term */ const u8 **ppDoclist, /* OUT: Pointer to doclist for pTerm */ int *pnDoclist /* OUT: Size of doclist in bytes */ ){ unsigned int iHash = fts5HashKey(pHash->nSlot, (const u8*)pTerm, nTerm); Fts5HashEntry *p; for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){ if( memcmp(p->zKey, pTerm, nTerm)==0 && p->zKey[nTerm]==0 ) break; } if( p ){ |
︙ | ︙ | |||
5316 5317 5318 5319 5320 5321 5322 | ** * all segment b-tree leaf data is stored in fixed size page records ** (e.g. 1000 bytes). A single doclist may span multiple pages. Care is ** taken to ensure it is possible to iterate in either direction through ** the entries in a doclist, or to seek to a specific entry within a ** doclist, without loading it into memory. ** ** * large doclists that span many pages have associated "doclist index" | | | 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 | ** * all segment b-tree leaf data is stored in fixed size page records ** (e.g. 1000 bytes). A single doclist may span multiple pages. Care is ** taken to ensure it is possible to iterate in either direction through ** the entries in a doclist, or to seek to a specific entry within a ** doclist, without loading it into memory. ** ** * large doclists that span many pages have associated "doclist index" ** records that contain a copy of the first rowid on each page spanned by ** the doclist. This is used to speed up seek operations, and merges of ** large doclists with very small doclists. ** ** * extra fields in the "structure record" record the state of ongoing ** incremental merge operations. ** */ |
︙ | ︙ | |||
5493 5494 5495 5496 5497 5498 5499 | ** is: ** ** * Flags byte. Bits are: ** 0x01: Clear if leaf is also the root page, otherwise set. ** ** * Page number of fts index leaf page. As a varint. ** | | | | | | 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 | ** is: ** ** * Flags byte. Bits are: ** 0x01: Clear if leaf is also the root page, otherwise set. ** ** * Page number of fts index leaf page. As a varint. ** ** * First rowid on page indicated by previous field. As a varint. ** ** * A list of varints, one for each subsequent termless page. A ** positive delta if the termless page contains at least one rowid, ** or an 0x00 byte otherwise. ** ** Internal doclist index nodes are: ** ** * Flags byte. Bits are: ** 0x01: Clear for root page, otherwise set. ** ** * Page number of first child page. As a varint. ** ** * Copy of first rowid on page indicated by previous field. As a varint. ** ** * A list of delta-encoded varints - the first rowid on each subsequent ** child page. ** */ /* ** Rowids for the averages and structure records in the %_data table. */ |
︙ | ︙ | |||
5570 5571 5572 5573 5574 5575 5576 5577 | /* ** Each time a blob is read from the %_data table, it is padded with this ** many zero bytes. This makes it easier to decode the various record formats ** without overreading if the records are corrupt. */ #define FTS5_DATA_ZERO_PADDING 8 | > < < | 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 | /* ** Each time a blob is read from the %_data table, it is padded with this ** many zero bytes. This makes it easier to decode the various record formats ** without overreading if the records are corrupt. */ #define FTS5_DATA_ZERO_PADDING 8 #define FTS5_DATA_PADDING 20 typedef struct Fts5Data Fts5Data; typedef struct Fts5DlidxIter Fts5DlidxIter; typedef struct Fts5DlidxLvl Fts5DlidxLvl; typedef struct Fts5DlidxWriter Fts5DlidxWriter; typedef struct Fts5NodeIter Fts5NodeIter; typedef struct Fts5PageWriter Fts5PageWriter; typedef struct Fts5SegIter Fts5SegIter; |
︙ | ︙ | |||
5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 | /* Error state. */ int rc; /* Current error code */ /* State used by the fts5DataXXX() functions. */ sqlite3_blob *pReader; /* RO incr-blob open on %_data table */ sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */ sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */ int nRead; /* Total number of blocks read */ }; struct Fts5DoclistIter { u8 *a; int n; int i; | > > > | 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 | /* Error state. */ int rc; /* Current error code */ /* State used by the fts5DataXXX() functions. */ sqlite3_blob *pReader; /* RO incr-blob open on %_data table */ sqlite3_stmt *pWriter; /* "INSERT ... %_data VALUES(?,?)" */ sqlite3_stmt *pDeleter; /* "DELETE FROM %_data ... id>=? AND id<=?" */ sqlite3_stmt *pIdxWriter; /* "INSERT ... %_idx VALUES(?,?,?,?)" */ sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */ sqlite3_stmt *pIdxSelect; int nRead; /* Total number of blocks read */ }; struct Fts5DoclistIter { u8 *a; int n; int i; |
︙ | ︙ | |||
5665 5666 5667 5668 5669 5670 5671 | int pgno; /* Page number for this page */ Fts5Buffer buf; /* Buffer containing page data */ Fts5Buffer term; /* Buffer containing previous term on page */ }; struct Fts5DlidxWriter { int pgno; /* Page number for this page */ int bPrevValid; /* True if iPrev is valid */ | | < | | > > > > | | 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 | int pgno; /* Page number for this page */ Fts5Buffer buf; /* Buffer containing page data */ Fts5Buffer term; /* Buffer containing previous term on page */ }; struct Fts5DlidxWriter { int pgno; /* Page number for this page */ int bPrevValid; /* True if iPrev is valid */ i64 iPrev; /* Previous rowid value written to page */ Fts5Buffer buf; /* Buffer containing page data */ }; struct Fts5SegWriter { int iSegid; /* Segid to write to */ Fts5PageWriter writer; /* PageWriter object */ i64 iPrevRowid; /* Previous rowid written to current leaf */ u8 bFirstRowidInDoclist; /* True if next rowid is first in doclist */ u8 bFirstRowidInPage; /* True if next rowid is first in page */ u8 bFirstTermInPage; /* True if next term will be first in leaf */ int nLeafWritten; /* Number of leaf pages written */ int nEmpty; /* Number of contiguous term-less nodes */ int nDlidx; /* Allocated size of aDlidx[] array */ Fts5DlidxWriter *aDlidx; /* Array of Fts5DlidxWriter objects */ /* Values to insert into the %_idx table */ Fts5Buffer btterm; /* Next term to insert into %_idx table */ int iBtPage; /* Page number corresponding to btterm */ }; /* ** Object for iterating through the merged results of one or more segments, ** visiting each term/rowid pair in the merged data. ** ** nSeg is always a power of two greater than or equal to the number of ** segments that this object is merging data from. Both the aSeg[] and ** aFirst[] arrays are sized at nSeg entries. The aSeg[] array is padded ** with zeroed objects - these are handled as if they were iterators opened ** on empty segments. ** |
︙ | ︙ | |||
5710 5711 5712 5713 5714 5715 5716 | typedef struct Fts5CResult Fts5CResult; struct Fts5CResult { u16 iFirst; /* aSeg[] index of firstest iterator */ u8 bTermEq; /* True if the terms are equal */ }; /* | | | 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 | typedef struct Fts5CResult Fts5CResult; struct Fts5CResult { u16 iFirst; /* aSeg[] index of firstest iterator */ u8 bTermEq; /* True if the terms are equal */ }; /* ** Object for iterating through a single segment, visiting each term/rowid ** pair in the segment. ** ** pSeg: ** The segment to iterate through. ** ** iLeafPgno: ** Current leaf page number within segment. |
︙ | ︙ | |||
5742 5743 5744 5745 5746 5747 5748 | ** ** FTS5_SEGITER_ONETERM: ** If set, set the iterator to point to EOF after the current doclist ** has been exhausted. Do not proceed to the next term in the segment. ** ** FTS5_SEGITER_REVERSE: ** This flag is only ever set if FTS5_SEGITER_ONETERM is also set. If | | | 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 | ** ** FTS5_SEGITER_ONETERM: ** If set, set the iterator to point to EOF after the current doclist ** has been exhausted. Do not proceed to the next term in the segment. ** ** FTS5_SEGITER_REVERSE: ** This flag is only ever set if FTS5_SEGITER_ONETERM is also set. If ** it is set, iterate through rowid in descending order instead of the ** default ascending order. ** ** iRowidOffset/nRowidOffset/aRowidOffset: ** These are used if the FTS5_SEGITER_REVERSE flag is set. ** ** For each rowid on the page corresponding to the current term, the ** corresponding aRowidOffset[] entry is set to the byte offset of the |
︙ | ︙ | |||
5852 5853 5854 5855 5856 5857 5858 | struct Fts5DlidxIter { int nLvl; int iSegid; Fts5DlidxLvl aLvl[1]; }; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 | struct Fts5DlidxIter { int nLvl; int iSegid; Fts5DlidxLvl aLvl[1]; }; /* ** The first argument passed to this macro is a pointer to an Fts5Buffer ** object. */ #define fts5BufferSize(pBuf,n) { \ if( pBuf->nSpace<n ) { \ |
︙ | ︙ | |||
6031 6032 6033 6034 6035 6036 6037 | fts5BufferSize(pBuf, MAX(nByte, p->pConfig->pgsz) + 20); pBuf->n = nByte; aOut = pBuf->p; if( aOut==0 ){ rc = SQLITE_NOMEM; } }else{ | | | 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 | fts5BufferSize(pBuf, MAX(nByte, p->pConfig->pgsz) + 20); pBuf->n = nByte; aOut = pBuf->p; if( aOut==0 ){ rc = SQLITE_NOMEM; } }else{ int nSpace = nByte + FTS5_DATA_PADDING; pRet = (Fts5Data*)sqlite3_malloc(nSpace+sizeof(Fts5Data)); if( pRet ){ pRet->n = nByte; aOut = pRet->p = (u8*)&pRet[1]; }else{ rc = SQLITE_NOMEM; } |
︙ | ︙ | |||
6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 | /* ** Release a reference to data record returned by an earlier call to ** fts5DataRead(). */ static void fts5DataRelease(Fts5Data *pData){ sqlite3_free(pData); } /* ** INSERT OR REPLACE a record into the %_data table. */ static void fts5DataWrite(Fts5Index *p, i64 iRowid, const u8 *pData, int nData){ if( p->rc!=SQLITE_OK ) return; if( p->pWriter==0 ){ int rc = SQLITE_OK; Fts5Config *pConfig = p->pConfig; | > > > > > > > > > > > > > > > > > | | > | < < < < < < | < | > | 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 | /* ** Release a reference to data record returned by an earlier call to ** fts5DataRead(). */ static void fts5DataRelease(Fts5Data *pData){ sqlite3_free(pData); } static int fts5IndexPrepareStmt( Fts5Index *p, sqlite3_stmt **ppStmt, char *zSql ){ if( p->rc==SQLITE_OK ){ if( zSql ){ p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0); }else{ p->rc = SQLITE_NOMEM; } } sqlite3_free(zSql); return p->rc; } /* ** INSERT OR REPLACE a record into the %_data table. */ static void fts5DataWrite(Fts5Index *p, i64 iRowid, const u8 *pData, int nData){ if( p->rc!=SQLITE_OK ) return; if( p->pWriter==0 ){ int rc = SQLITE_OK; Fts5Config *pConfig = p->pConfig; fts5IndexPrepareStmt(p, &p->pWriter, sqlite3_mprintf( "REPLACE INTO '%q'.'%q_data'(id, block) VALUES(?,?)", pConfig->zDb, pConfig->zName )); if( p->rc ) return; } sqlite3_bind_int64(p->pWriter, 1, iRowid); sqlite3_bind_blob(p->pWriter, 2, pData, nData, SQLITE_STATIC); sqlite3_step(p->pWriter); p->rc = sqlite3_reset(p->pWriter); } /* ** Execute the following SQL: ** ** DELETE FROM %_data WHERE id BETWEEN $iFirst AND $iLast */ static void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){ if( p->rc!=SQLITE_OK ) return; if( p->pDeleter==0 ){ int rc; Fts5Config *pConfig = p->pConfig; char *zSql = sqlite3_mprintf( "DELETE FROM '%q'.'%q_data' WHERE id>=? AND id<=?", pConfig->zDb, pConfig->zName ); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0); sqlite3_free(zSql); } |
︙ | ︙ | |||
6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 | /* ** Remove all records associated with segment iSegid. */ static void fts5DataRemoveSegment(Fts5Index *p, int iSegid){ i64 iFirst = FTS5_SEGMENT_ROWID(iSegid, 0, 0); i64 iLast = FTS5_SEGMENT_ROWID(iSegid+1, 0, 0)-1; fts5DataDelete(p, iFirst, iLast); } /* ** Release a reference to an Fts5Structure object returned by an earlier ** call to fts5StructureRead() or fts5StructureDecode(). */ static void fts5StructureRelease(Fts5Structure *pStruct){ | > > > > > > > > > > > > | 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 | /* ** Remove all records associated with segment iSegid. */ static void fts5DataRemoveSegment(Fts5Index *p, int iSegid){ i64 iFirst = FTS5_SEGMENT_ROWID(iSegid, 0, 0); i64 iLast = FTS5_SEGMENT_ROWID(iSegid+1, 0, 0)-1; fts5DataDelete(p, iFirst, iLast); if( p->pIdxDeleter==0 ){ Fts5Config *pConfig = p->pConfig; fts5IndexPrepareStmt(p, &p->pIdxDeleter, sqlite3_mprintf( "DELETE FROM '%q'.'%q_idx' WHERE segid=?", pConfig->zDb, pConfig->zName )); } if( p->rc==SQLITE_OK ){ sqlite3_bind_int(p->pIdxDeleter, 1, iSegid); sqlite3_step(p->pIdxDeleter); p->rc = sqlite3_reset(p->pIdxDeleter); } } /* ** Release a reference to an Fts5Structure object returned by an earlier ** call to fts5StructureRead() or fts5StructureDecode(). */ static void fts5StructureRelease(Fts5Structure *pStruct){ |
︙ | ︙ | |||
7530 7531 7532 7533 7534 7535 7536 | } iOff += nNew; /* Skip past the doclist. If the end of the page is reached, bail out. */ while( 1 ){ int nPos; | | | 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 | } iOff += nNew; /* Skip past the doclist. If the end of the page is reached, bail out. */ while( 1 ){ int nPos; /* Skip past rowid delta */ fts5IndexSkipVarint(a, iOff); /* Skip past position list */ fts5IndexGetVarint32(a, iOff, nPos); iOff += (nPos >> 1); if( iOff>=(n-1) ){ iOff = n; |
︙ | ︙ | |||
7603 7604 7605 7606 7607 7608 7609 | Fts5Buffer *pBuf, /* Buffer to use for loading pages */ const u8 *pTerm, int nTerm, /* Term to seek to */ int flags, /* Mask of FTS5INDEX_XXX flags */ Fts5StructureSegment *pSeg, /* Description of segment */ Fts5SegIter *pIter /* Object to populate */ ){ int iPg = 1; | < | | > > > | > > | > | > > > > > | 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 | Fts5Buffer *pBuf, /* Buffer to use for loading pages */ const u8 *pTerm, int nTerm, /* Term to seek to */ int flags, /* Mask of FTS5INDEX_XXX flags */ Fts5StructureSegment *pSeg, /* Description of segment */ Fts5SegIter *pIter /* Object to populate */ ){ int iPg = 1; int bGe = (flags & FTS5INDEX_QUERY_SCAN); int bDlidx = 0; /* True if there is a doclist-index */ static int nCall = 0; nCall++; assert( bGe==0 || (flags & FTS5INDEX_QUERY_DESC)==0 ); assert( pTerm && nTerm ); memset(pIter, 0, sizeof(*pIter)); pIter->pSeg = pSeg; /* This block sets stack variable iPg to the leaf page number that may ** contain term (pTerm/nTerm), if it is present in the segment. */ if( p->pIdxSelect==0 ){ Fts5Config *pConfig = p->pConfig; fts5IndexPrepareStmt(p, &p->pIdxSelect, sqlite3_mprintf( "SELECT pgno FROM '%q'.'%q_idx' WHERE " "segid=? AND term<=? ORDER BY term DESC LIMIT 1", pConfig->zDb, pConfig->zName )); } if( p->rc ) return; sqlite3_bind_int(p->pIdxSelect, 1, pSeg->iSegid); sqlite3_bind_blob(p->pIdxSelect, 2, pTerm, nTerm, SQLITE_STATIC); if( SQLITE_ROW==sqlite3_step(p->pIdxSelect) ){ i64 val = sqlite3_column_int(p->pIdxSelect, 0); iPg = (int)(val>>1); bDlidx = (val & 0x0001); } p->rc = sqlite3_reset(p->pIdxSelect); if( iPg<pSeg->pgnoFirst ){ iPg = pSeg->pgnoFirst; bDlidx = 0; } pIter->iLeafPgno = iPg - 1; |
︙ | ︙ | |||
8452 8453 8454 8455 8456 8457 8458 | pWriter->nDlidx = nLvl; } } return p->rc; } /* | | > | | < | < < | | | | | | < < | | < | > > | > > | > > > > > > > | > > > < < < | | | < | < < | | | < < | | < < < < < < < | < < < | < | < < < < < < < < < < < < < < < < < < | 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 | pWriter->nDlidx = nLvl; } } return p->rc; } /* ** If the current doclist-index accumulating in pWriter->aDlidx[] is large ** enough, flush it to disk and return 1. Otherwise discard it and return ** zero. */ static int fts5WriteFlushDlidx(Fts5Index *p, Fts5SegWriter *pWriter){ int bFlag = 0; /* If there were FTS5_MIN_DLIDX_SIZE or more empty leaf pages written ** to the database, also write the doclist-index to disk. */ if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){ bFlag = 1; } fts5WriteDlidxClear(p, pWriter, bFlag); pWriter->nEmpty = 0; return bFlag; } /* ** This function is called whenever processing of the doclist for the ** last term on leaf page (pWriter->iBtPage) is completed. ** ** The doclist-index for that term is currently stored in-memory within the ** Fts5SegWriter.aDlidx[] array. If it is large enough, this function ** writes it out to disk. Or, if it is too small to bother with, discards ** it. ** ** Fts5SegWriter.btterm currently contains the first term on page iBtPage. */ static void fts5WriteFlushBtree(Fts5Index *p, Fts5SegWriter *pWriter){ int bFlag; assert( pWriter->iBtPage || pWriter->nEmpty==0 ); if( pWriter->iBtPage==0 ) return; bFlag = fts5WriteFlushDlidx(p, pWriter); if( p->rc==SQLITE_OK ){ const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:""); /* The following was already done in fts5WriteInit(): */ /* sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); */ sqlite3_bind_blob(p->pIdxWriter, 2, z, pWriter->btterm.n, SQLITE_STATIC); sqlite3_bind_int64(p->pIdxWriter, 3, bFlag + ((i64)pWriter->iBtPage<<1)); sqlite3_step(p->pIdxWriter); p->rc = sqlite3_reset(p->pIdxWriter); } pWriter->iBtPage = 0; } /* ** This is called once for each leaf page except the first that contains ** at least one term. Argument (nTerm/pTerm) is the split-key - a term that ** is larger than all terms written to earlier leaves, and equal to or ** smaller than the first term on the new leaf. ** ** If an error occurs, an error code is left in Fts5Index.rc. If an error ** has already occurred when this function is called, it is a no-op. */ static void fts5WriteBtreeTerm( Fts5Index *p, /* FTS5 backend object */ Fts5SegWriter *pWriter, /* Writer object */ int nTerm, const u8 *pTerm /* First term on new page */ ){ fts5WriteFlushBtree(p, pWriter); fts5BufferSet(&p->rc, &pWriter->btterm, nTerm, pTerm); pWriter->iBtPage = pWriter->writer.pgno; } /* ** This function is called when flushing a leaf page that contains no ** terms at all to disk. */ static void fts5WriteBtreeNoTerm( |
︙ | ︙ | |||
8627 8628 8629 8630 8631 8632 8633 | }else{ bDone = 1; } if( pDlidx->bPrevValid ){ iVal = iRowid - pDlidx->iPrev; }else{ | | | | 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 | }else{ bDone = 1; } if( pDlidx->bPrevValid ){ iVal = iRowid - pDlidx->iPrev; }else{ i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno); assert( pDlidx->buf.n==0 ); sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, !bDone); sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iPgno); iVal = iRowid; } sqlite3Fts5BufferAppendVarint(&p->rc, &pDlidx->buf, iVal); pDlidx->bPrevValid = 1; pDlidx->iPrev = iRowid; } } static void fts5WriteFlushLeaf(Fts5Index *p, Fts5SegWriter *pWriter){ static const u8 zero[] = { 0x00, 0x00, 0x00, 0x00 }; Fts5PageWriter *pPage = &pWriter->writer; i64 iRowid; if( pWriter->bFirstTermInPage ){ /* No term was written to this page. */ assert( 0==fts5GetU16(&pPage->buf.p[2]) ); fts5WriteBtreeNoTerm(p, pWriter); } |
︙ | ︙ | |||
8681 8682 8683 8684 8685 8686 8687 | */ static void fts5WriteAppendTerm( Fts5Index *p, Fts5SegWriter *pWriter, int nTerm, const u8 *pTerm ){ int nPrefix; /* Bytes of prefix compression for term */ | | | | 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 | */ static void fts5WriteAppendTerm( Fts5Index *p, Fts5SegWriter *pWriter, int nTerm, const u8 *pTerm ){ int nPrefix; /* Bytes of prefix compression for term */ Fts5PageWriter *pPage = &pWriter->writer; assert( pPage->buf.n==0 || pPage->buf.n>4 ); if( pPage->buf.n==0 ){ /* Zero the first term and first rowid fields */ static const u8 zero[] = { 0x00, 0x00, 0x00, 0x00 }; fts5BufferAppendBlob(&p->rc, &pPage->buf, 4, zero); assert( pWriter->bFirstTermInPage ); } if( p->rc ) return; if( pWriter->bFirstTermInPage ){ |
︙ | ︙ | |||
8716 8717 8718 8719 8720 8721 8722 | ** copy of (pTerm/nTerm) into the parent node. This is slightly ** inefficient, but still correct. */ int n = nTerm; if( pPage->term.n ){ n = 1 + fts5PrefixCompress(pPage->term.n, pPage->term.p, nTerm, pTerm); } fts5WriteBtreeTerm(p, pWriter, n, pTerm); | | | 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 | ** copy of (pTerm/nTerm) into the parent node. This is slightly ** inefficient, but still correct. */ int n = nTerm; if( pPage->term.n ){ n = 1 + fts5PrefixCompress(pPage->term.n, pPage->term.p, nTerm, pTerm); } fts5WriteBtreeTerm(p, pWriter, n, pTerm); pPage = &pWriter->writer; } }else{ nPrefix = fts5PrefixCompress(pPage->term.n, pPage->term.p, nTerm, pTerm); fts5BufferAppendVarint(&p->rc, &pPage->buf, nPrefix); } /* Append the number of bytes of new data, then the term data itself |
︙ | ︙ | |||
8745 8746 8747 8748 8749 8750 8751 | /* If the current leaf page is full, flush it to disk. */ if( pPage->buf.n>=p->pConfig->pgsz ){ fts5WriteFlushLeaf(p, pWriter); } } /* | | | | | | | 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 | /* If the current leaf page is full, flush it to disk. */ if( pPage->buf.n>=p->pConfig->pgsz ){ fts5WriteFlushLeaf(p, pWriter); } } /* ** Append a rowid and position-list size field to the writers output. */ static void fts5WriteAppendRowid( Fts5Index *p, Fts5SegWriter *pWriter, i64 iRowid, int nPos ){ if( p->rc==SQLITE_OK ){ Fts5PageWriter *pPage = &pWriter->writer; /* If this is to be the first rowid written to the page, set the ** rowid-pointer in the page-header. Also append a value to the dlidx ** buffer, in case a doclist-index is required. */ if( pWriter->bFirstRowidInPage ){ fts5PutU16(pPage->buf.p, pPage->buf.n); fts5WriteDlidxAppend(p, pWriter, iRowid); } /* Write the rowid. */ if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){ fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid); }else{ assert( p->rc || iRowid>pWriter->iPrevRowid ); fts5BufferAppendVarint(&p->rc, &pPage->buf, iRowid - pWriter->iPrevRowid); } pWriter->iPrevRowid = iRowid; |
︙ | ︙ | |||
8789 8790 8791 8792 8793 8794 8795 | static void fts5WriteAppendPoslistData( Fts5Index *p, Fts5SegWriter *pWriter, const u8 *aData, int nData ){ | | | 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 | static void fts5WriteAppendPoslistData( Fts5Index *p, Fts5SegWriter *pWriter, const u8 *aData, int nData ){ Fts5PageWriter *pPage = &pWriter->writer; const u8 *a = aData; int n = nData; assert( p->pConfig->pgsz>0 ); while( p->rc==SQLITE_OK && (pPage->buf.n + n)>=p->pConfig->pgsz ){ int nReq = p->pConfig->pgsz - pPage->buf.n; int nCopy = 0; |
︙ | ︙ | |||
8812 8813 8814 8815 8816 8817 8818 | } if( n>0 ){ fts5BufferAppendBlob(&p->rc, &pPage->buf, n, a); } } static void fts5WriteAppendZerobyte(Fts5Index *p, Fts5SegWriter *pWriter){ | | > < < < | < | < | | < < < < < < | < < < < | | < | < | < | < > | | > | > | < < | < < < < < | | < < < < < < < < < < | < < < < < < < < < | < | 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 | } if( n>0 ){ fts5BufferAppendBlob(&p->rc, &pPage->buf, n, a); } } static void fts5WriteAppendZerobyte(Fts5Index *p, Fts5SegWriter *pWriter){ fts5BufferAppendVarint(&p->rc, &pWriter->writer.buf, 0); } /* ** Flush any data cached by the writer object to the database. Free any ** allocations associated with the writer. */ static void fts5WriteFinish( Fts5Index *p, Fts5SegWriter *pWriter, /* Writer object */ int *pnHeight, /* OUT: Height of the b-tree */ int *pnLeaf /* OUT: Number of leaf pages in b-tree */ ){ int i; Fts5PageWriter *pLeaf = &pWriter->writer; if( p->rc==SQLITE_OK ){ if( pLeaf->pgno==1 && pLeaf->buf.n==0 ){ *pnLeaf = 0; *pnHeight = 0; }else{ if( pLeaf->buf.n>4 ){ fts5WriteFlushLeaf(p, pWriter); } *pnLeaf = pLeaf->pgno-1; fts5WriteFlushBtree(p, pWriter); *pnHeight = 0; } } fts5BufferFree(&pLeaf->term); fts5BufferFree(&pLeaf->buf); fts5BufferFree(&pWriter->btterm); for(i=0; i<pWriter->nDlidx; i++){ sqlite3Fts5BufferFree(&pWriter->aDlidx[i].buf); } sqlite3_free(pWriter->aDlidx); } static void fts5WriteInit( Fts5Index *p, Fts5SegWriter *pWriter, int iSegid ){ memset(pWriter, 0, sizeof(Fts5SegWriter)); pWriter->iSegid = iSegid; fts5WriteDlidxGrow(p, pWriter, 1); pWriter->writer.pgno = 1; pWriter->bFirstTermInPage = 1; pWriter->iBtPage = 1; if( p->pIdxWriter==0 ){ Fts5Config *pConfig = p->pConfig; fts5IndexPrepareStmt(p, &p->pIdxWriter, sqlite3_mprintf( "INSERT INTO '%q'.'%q_idx'(segid,term,pgno) VALUES(?,?,?)", pConfig->zDb, pConfig->zName )); } if( p->rc==SQLITE_OK ){ sqlite3_bind_int(p->pIdxWriter, 1, pWriter->iSegid); } } /* ** Iterator pIter was used to iterate through the input segments of on an ** incremental merge operation. This function is called if the incremental ** merge step has finished but the input has not been completely exhausted. |
︙ | ︙ | |||
8955 8956 8957 8958 8959 8960 8961 | fts5BufferZero(&buf); fts5BufferAppendBlob(&p->rc, &buf, sizeof(aHdr), aHdr); fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n); fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p); fts5BufferAppendBlob(&p->rc, &buf, pData->n - iOff, &pData->p[iOff]); fts5DataRelease(pData); pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno; | | | 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 | fts5BufferZero(&buf); fts5BufferAppendBlob(&p->rc, &buf, sizeof(aHdr), aHdr); fts5BufferAppendVarint(&p->rc, &buf, pSeg->term.n); fts5BufferAppendBlob(&p->rc, &buf, pSeg->term.n, pSeg->term.p); fts5BufferAppendBlob(&p->rc, &buf, pData->n - iOff, &pData->p[iOff]); fts5DataRelease(pData); pSeg->pSeg->pgnoFirst = pSeg->iTermLeafPgno; fts5DataDelete(p, FTS5_SEGMENT_ROWID(iId, 0, 1), iLeafRowid); fts5DataWrite(p, iLeafRowid, buf.p, buf.n); } } } fts5BufferFree(&buf); } |
︙ | ︙ | |||
9002 9003 9004 9005 9006 9007 9008 | memset(&writer, 0, sizeof(Fts5SegWriter)); memset(&term, 0, sizeof(Fts5Buffer)); if( pLvl->nMerge ){ pLvlOut = &pStruct->aLevel[iLvl+1]; assert( pLvlOut->nSeg>0 ); nInput = pLvl->nMerge; | < > > > > | 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 | memset(&writer, 0, sizeof(Fts5SegWriter)); memset(&term, 0, sizeof(Fts5Buffer)); if( pLvl->nMerge ){ pLvlOut = &pStruct->aLevel[iLvl+1]; assert( pLvlOut->nSeg>0 ); nInput = pLvl->nMerge; pSeg = &pLvlOut->aSeg[pLvlOut->nSeg-1]; fts5WriteInit(p, &writer, pSeg->iSegid); writer.writer.pgno = pSeg->pgnoLast+1; writer.iBtPage = 0; }else{ int iSegid = fts5AllocateSegid(p, pStruct); /* Extend the Fts5Structure object as required to ensure the output ** segment exists. */ if( iLvl==pStruct->nLevel-1 ){ fts5StructureAddLevel(&p->rc, ppStruct); |
︙ | ︙ | |||
9094 9095 9096 9097 9098 9099 9100 | pLvl->nSeg -= nInput; pLvl->nMerge = 0; if( pSeg->pgnoLast==0 ){ pLvlOut->nSeg--; pStruct->nSegment--; } }else{ | | | 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 | pLvl->nSeg -= nInput; pLvl->nMerge = 0; if( pSeg->pgnoLast==0 ){ pLvlOut->nSeg--; pStruct->nSegment--; } }else{ assert( pSeg->pgnoLast>0 ); fts5TrimSegments(p, pIter); pLvl->nMerge = nInput; } fts5MultiIterFree(p, pIter); fts5BufferFree(&term); if( pnRem ) *pnRem -= writer.nLeafWritten; |
︙ | ︙ | |||
9269 9270 9271 9272 9273 9274 9275 | Fts5SegWriter writer; fts5WriteInit(p, &writer, iSegid); /* Pre-allocate the buffer used to assemble leaf pages to the target ** page size. */ assert( pgsz>0 ); | | | 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 | Fts5SegWriter writer; fts5WriteInit(p, &writer, iSegid); /* Pre-allocate the buffer used to assemble leaf pages to the target ** page size. */ assert( pgsz>0 ); pBuf = &writer.writer.buf; fts5BufferGrow(&p->rc, pBuf, pgsz + 20); /* Begin scanning through hash table entries. This loop runs once for each ** term/doclist currently stored within the hash table. */ if( p->rc==SQLITE_OK ){ memset(pBuf->p, 0, 4); pBuf->n = 4; |
︙ | ︙ | |||
9291 9292 9293 9294 9295 9296 9297 | int nSuffix; /* Size of term suffix */ sqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist); nTerm = strlen(zTerm); /* Decide if the term will fit on the current leaf. If it will not, ** flush the leaf to disk here. */ | | | | | | | 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 | int nSuffix; /* Size of term suffix */ sqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist); nTerm = strlen(zTerm); /* Decide if the term will fit on the current leaf. If it will not, ** flush the leaf to disk here. */ if( pBuf->n>4 && (pBuf->n + nTerm + 2) > pgsz ){ fts5WriteFlushLeaf(p, &writer); pBuf = &writer.writer.buf; if( (nTerm + 32) > pBuf->nSpace ){ fts5BufferGrow(&p->rc, pBuf, nTerm + 32 - pBuf->n); if( p->rc ) break; } } /* Write the term to the leaf. And if it is the first on the leaf, and ** the leaf is not page number 1, push it up into the b-tree hierarchy ** as well. */ if( writer.bFirstTermInPage==0 ){ int nPre = fts5PrefixCompress(nTerm, zPrev, nTerm, (const u8*)zTerm); pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], nPre); nSuffix = nTerm - nPre; }else{ fts5PutU16(&pBuf->p[2], pBuf->n); writer.bFirstTermInPage = 0; if( writer.writer.pgno!=1 ){ int nPre = fts5PrefixCompress(nTerm, zPrev, nTerm, (const u8*)zTerm); fts5WriteBtreeTerm(p, &writer, nPre+1, (const u8*)zTerm); pBuf = &writer.writer.buf; assert( nPre<nTerm ); } nSuffix = nTerm; } pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], nSuffix); fts5BufferSafeAppendBlob(pBuf, (const u8*)&zTerm[nTerm-nSuffix], nSuffix); /* We just wrote a term into page writer.aWriter[0].pgno. If a ** doclist-index is to be generated for this doclist, it will be ** associated with this page. */ assert( writer.nDlidx>0 && writer.aDlidx[0].buf.n==0 ); writer.aDlidx[0].pgno = writer.writer.pgno; if( pgsz>=(pBuf->n + nDoclist + 1) ){ /* The entire doclist will fit on the current leaf. */ fts5BufferSafeAppendBlob(pBuf, pDoclist, nDoclist); }else{ i64 iRowid = 0; i64 iDelta = 0; |
︙ | ︙ | |||
9350 9351 9352 9353 9354 9355 9356 | int bDummy; iOff += fts5GetVarint(&pDoclist[iOff], (u64*)&iDelta); nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); nCopy += nPos; iRowid += iDelta; if( writer.bFirstRowidInPage ){ | | | 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 | int bDummy; iOff += fts5GetVarint(&pDoclist[iOff], (u64*)&iDelta); nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); nCopy += nPos; iRowid += iDelta; if( writer.bFirstRowidInPage ){ fts5PutU16(&pBuf->p[0], pBuf->n); /* first rowid on page */ pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iRowid); writer.bFirstRowidInPage = 0; fts5WriteDlidxAppend(p, &writer, iRowid); }else{ pBuf->n += sqlite3Fts5PutVarint(&pBuf->p[pBuf->n], iDelta); } assert( pBuf->n<=pBuf->nSpace ); |
︙ | ︙ | |||
9382 9383 9384 9385 9386 9387 9388 | n = fts5PoslistPrefix(&pPoslist[iPos], nSpace); } assert( n>0 ); fts5BufferSafeAppendBlob(pBuf, &pPoslist[iPos], n); iPos += n; if( pBuf->n>=pgsz ){ fts5WriteFlushLeaf(p, &writer); | | | 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 | n = fts5PoslistPrefix(&pPoslist[iPos], nSpace); } assert( n>0 ); fts5BufferSafeAppendBlob(pBuf, &pPoslist[iPos], n); iPos += n; if( pBuf->n>=pgsz ){ fts5WriteFlushLeaf(p, &writer); pBuf = &writer.writer.buf; } if( iPos>=nCopy ) break; } } iOff += nCopy; } } |
︙ | ︙ | |||
9415 9416 9417 9418 9419 9420 9421 | pSeg->nHeight = nHeight; pSeg->pgnoFirst = 1; pSeg->pgnoLast = pgnoLast; pStruct->nSegment++; } fts5StructurePromote(p, 0, pStruct); } | < | 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 | pSeg->nHeight = nHeight; pSeg->pgnoFirst = 1; pSeg->pgnoLast = pgnoLast; pStruct->nSegment++; } fts5StructurePromote(p, 0, pStruct); } fts5IndexAutomerge(p, &pStruct, pgnoLast); fts5IndexCrisismerge(p, &pStruct); fts5StructureWrite(p, pStruct); fts5StructureRelease(pStruct); } |
︙ | ︙ | |||
9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 | p->nWorkUnit = FTS5_WORK_UNIT; p->nMaxPendingData = 1024*1024; p->zDataTbl = sqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName); if( p->zDataTbl && bCreate ){ rc = sqlite3Fts5CreateTable( pConfig, "data", "id INTEGER PRIMARY KEY, block BLOB", 0, pzErr ); if( rc==SQLITE_OK ){ rc = sqlite3Fts5IndexReinit(p); } } } assert( rc!=SQLITE_OK || p->rc==SQLITE_OK ); | > > > > > > | 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 | p->nWorkUnit = FTS5_WORK_UNIT; p->nMaxPendingData = 1024*1024; p->zDataTbl = sqlite3Fts5Mprintf(&rc, "%s_data", pConfig->zName); if( p->zDataTbl && bCreate ){ rc = sqlite3Fts5CreateTable( pConfig, "data", "id INTEGER PRIMARY KEY, block BLOB", 0, pzErr ); if( rc==SQLITE_OK ){ rc = sqlite3Fts5CreateTable(pConfig, "idx", "segid, term, pgno, PRIMARY KEY(segid, term)", 1, pzErr ); } if( rc==SQLITE_OK ){ rc = sqlite3Fts5IndexReinit(p); } } } assert( rc!=SQLITE_OK || p->rc==SQLITE_OK ); |
︙ | ︙ | |||
9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 | */ static int sqlite3Fts5IndexClose(Fts5Index *p){ int rc = SQLITE_OK; if( p ){ assert( p->pReader==0 ); sqlite3_finalize(p->pWriter); sqlite3_finalize(p->pDeleter); sqlite3Fts5HashFree(p->pHash); sqlite3Fts5BufferFree(&p->scratch); sqlite3_free(p->zDataTbl); sqlite3_free(p); } return rc; } | > > > | 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 | */ static int sqlite3Fts5IndexClose(Fts5Index *p){ int rc = SQLITE_OK; if( p ){ assert( p->pReader==0 ); sqlite3_finalize(p->pWriter); sqlite3_finalize(p->pDeleter); sqlite3_finalize(p->pIdxWriter); sqlite3_finalize(p->pIdxDeleter); sqlite3_finalize(p->pIdxSelect); sqlite3Fts5HashFree(p->pHash); sqlite3Fts5BufferFree(&p->scratch); sqlite3_free(p->zDataTbl); sqlite3_free(p); } return rc; } |
︙ | ︙ | |||
9948 9949 9950 9951 9952 9953 9954 | } } return rc; } /* | | | 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 | } } return rc; } /* ** Open a new iterator to iterate though all rowid that match the ** specified token or token prefix. */ static int sqlite3Fts5IndexQuery( Fts5Index *p, /* FTS index to query */ const char *pToken, int nToken, /* Token (or prefix) to query for */ int flags, /* Mask of FTS5INDEX_QUERY_X flags */ Fts5IndexIter **ppIter /* OUT: New iterator object */ |
︙ | ︙ | |||
10216 10217 10218 10219 10220 10221 10222 | ret += (ret<<3) + iCol; ret += (ret<<3) + iPos; if( iIdx>=0 ) ret += (ret<<3) + (FTS5_MAIN_PREFIX + iIdx); for(i=0; i<nTerm; i++) ret += (ret<<3) + pTerm[i]; return ret; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 | ret += (ret<<3) + iCol; ret += (ret<<3) + iPos; if( iIdx>=0 ) ret += (ret<<3) + (FTS5_MAIN_PREFIX + iIdx); for(i=0; i<nTerm; i++) ret += (ret<<3) + pTerm[i]; return ret; } #ifdef SQLITE_DEBUG /* ** This function is purely an internal test. It does not contribute to ** FTS functionality, or even the integrity-check, in any way. ** ** Instead, it tests that the same set of pgno/rowid combinations are ** visited regardless of whether the doclist-index identified by parameters |
︙ | ︙ | |||
10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 | p->rc = rc; } #else # define fts5TestDlidxReverse(x,y,z) # define fts5TestTerm(u,v,w,x,y,z) #endif static void fts5IndexIntegrityCheckSegment( Fts5Index *p, /* FTS5 backend object */ Fts5StructureSegment *pSeg /* Segment to check internal consistency */ ){ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > < | < < | > > > > | | | | | | | | | | < < < | | | | | 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 | p->rc = rc; } #else # define fts5TestDlidxReverse(x,y,z) # define fts5TestTerm(u,v,w,x,y,z) #endif /* ** Check that: ** ** 1) All leaves of pSeg between iFirst and iLast (inclusive) exist and ** contain zero terms. ** 2) All leaves of pSeg between iNoRowid and iLast (inclusive) exist and ** contain zero rowids. */ static void fts5IndexIntegrityCheckEmpty( Fts5Index *p, Fts5StructureSegment *pSeg, /* Segment to check internal consistency */ int iFirst, int iNoRowid, int iLast ){ int i; /* Now check that the iter.nEmpty leaves following the current leaf ** (a) exist and (b) contain no terms. */ for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){ Fts5Data *pLeaf = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, 0, i)); if( pLeaf ){ if( 0!=fts5GetU16(&pLeaf->p[2]) ) p->rc = FTS5_CORRUPT; if( i>=iNoRowid && 0!=fts5GetU16(&pLeaf->p[0]) ) p->rc = FTS5_CORRUPT; } fts5DataRelease(pLeaf); if( p->rc ) break; } } static void fts5IndexIntegrityCheckSegment( Fts5Index *p, /* FTS5 backend object */ Fts5StructureSegment *pSeg /* Segment to check internal consistency */ ){ Fts5Config *pConfig = p->pConfig; sqlite3_stmt *pStmt = 0; int rc2; int iIdxPrevLeaf = pSeg->pgnoFirst-1; int iDlidxPrevLeaf = pSeg->pgnoLast; if( pSeg->pgnoFirst==0 ) return; fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf( "SELECT segid, term, (pgno>>1), (pgno & 1) FROM '%q'.'%q_idx' WHERE segid=%d", pConfig->zDb, pConfig->zName, pSeg->iSegid )); /* Iterate through the b-tree hierarchy. */ while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ i64 iRow; /* Rowid for this leaf */ Fts5Data *pLeaf; /* Data for this leaf */ int iOff; /* Offset of first term on leaf */ int nIdxTerm = sqlite3_column_bytes(pStmt, 1); const char *zIdxTerm = (const char*)sqlite3_column_text(pStmt, 1); int iIdxLeaf = sqlite3_column_int(pStmt, 2); int bIdxDlidx = sqlite3_column_int(pStmt, 3); /* If the leaf in question has already been trimmed from the segment, ** ignore this b-tree entry. Otherwise, load it into memory. */ if( iIdxLeaf<pSeg->pgnoFirst ) continue; iRow = FTS5_SEGMENT_ROWID(pSeg->iSegid, 0, iIdxLeaf); pLeaf = fts5DataRead(p, iRow); if( pLeaf==0 ) break; /* Check that the leaf contains at least one term, and that it is equal ** to or larger than the split-key in zIdxTerm. Also check that if there ** is also a rowid pointer within the leaf page header, it points to a ** location before the term. */ iOff = fts5GetU16(&pLeaf->p[2]); if( iOff==0 ){ p->rc = FTS5_CORRUPT; }else{ int iRowidOff; int nTerm; /* Size of term on leaf in bytes */ int res; /* Comparison of term and split-key */ iRowidOff = fts5GetU16(&pLeaf->p[0]); if( iRowidOff>=iOff ){ p->rc = FTS5_CORRUPT; }else{ iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm); res = memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm)); if( res==0 ) res = nTerm - nIdxTerm; if( res<0 ) p->rc = FTS5_CORRUPT; } } fts5DataRelease(pLeaf); if( p->rc ) break; /* Now check that the iter.nEmpty leaves following the current leaf ** (a) exist and (b) contain no terms. */ fts5IndexIntegrityCheckEmpty( p, pSeg, iIdxPrevLeaf+1, iDlidxPrevLeaf+1, iIdxLeaf-1 ); if( p->rc ) break; /* If there is a doclist-index, check that it looks right. */ if( bIdxDlidx ){ Fts5DlidxIter *pDlidx = 0; /* For iterating through doclist index */ int iPrevLeaf = iIdxLeaf; int iSegid = pSeg->iSegid; int iPg = 0; i64 iKey; for(pDlidx=fts5DlidxIterInit(p, 0, iSegid, iIdxLeaf); fts5DlidxIterEof(p, pDlidx)==0; fts5DlidxIterNext(p, pDlidx) ){ /* Check any rowid-less pages that occur before the current leaf. */ for(iPg=iPrevLeaf+1; iPg<fts5DlidxIterPgno(pDlidx); iPg++){ iKey = FTS5_SEGMENT_ROWID(iSegid, 0, iPg); |
︙ | ︙ | |||
10551 10552 10553 10554 10555 10556 10557 | fts5GetVarint(&pLeaf->p[iRowidOff], (u64*)&iRowid); if( iRowid!=fts5DlidxIterRowid(pDlidx) ) p->rc = FTS5_CORRUPT; } fts5DataRelease(pLeaf); } } | < < < | | | | > > | < | | | > > > | < | 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 | fts5GetVarint(&pLeaf->p[iRowidOff], (u64*)&iRowid); if( iRowid!=fts5DlidxIterRowid(pDlidx) ) p->rc = FTS5_CORRUPT; } fts5DataRelease(pLeaf); } } iDlidxPrevLeaf = iPg; fts5DlidxIterFree(pDlidx); fts5TestDlidxReverse(p, iSegid, iIdxLeaf); }else{ iDlidxPrevLeaf = pSeg->pgnoLast; /* TODO: Check there is no doclist index */ } iIdxPrevLeaf = iIdxLeaf; } rc2 = sqlite3_finalize(pStmt); if( p->rc==SQLITE_OK ) p->rc = rc2; /* Page iter.iLeaf must now be the rightmost leaf-page in the segment */ #if 0 if( p->rc==SQLITE_OK && iter.iLeaf!=pSeg->pgnoLast ){ p->rc = FTS5_CORRUPT; } #endif } /* ** Run internal checks to ensure that the FTS index (a) is internally ** consistent and (b) contains entries for which the XOR of the checksums ** as calculated by fts5IndexEntryCksum() is cksum. |
︙ | ︙ | |||
11042 11043 11044 11045 11046 11047 11048 | ** only true if it is guaranteed that the fts5 database is not corrupt. */ int sqlite3_fts5_may_be_corrupt = 1; typedef struct Fts5Table Fts5Table; typedef struct Fts5Cursor Fts5Cursor; | < | 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 | ** only true if it is guaranteed that the fts5 database is not corrupt. */ int sqlite3_fts5_may_be_corrupt = 1; typedef struct Fts5Table Fts5Table; typedef struct Fts5Cursor Fts5Cursor; typedef struct Fts5Auxiliary Fts5Auxiliary; typedef struct Fts5Auxdata Fts5Auxdata; typedef struct Fts5TokenizerModule Fts5TokenizerModule; /* ** NOTES ON TRANSACTIONS: |
︙ | ︙ | |||
11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 | ** ** If the cursor iterates in descending order of rowid, iFirstRowid ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid ** the lower. */ struct Fts5Cursor { sqlite3_vtab_cursor base; /* Base class used by SQLite core */ int ePlan; /* FTS5_PLAN_XXX value */ int bDesc; /* True for "ORDER BY rowid DESC" queries */ i64 iFirstRowid; /* Return no rowids earlier than this */ i64 iLastRowid; /* Return no rowids later than this */ sqlite3_stmt *pStmt; /* Statement used to read %_content */ Fts5Expr *pExpr; /* Expression for MATCH queries */ Fts5Sorter *pSorter; /* Sorter for "ORDER BY rank" queries */ int csrflags; /* Mask of cursor flags (see below) */ | > > > > > < | < < > > | 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 | ** ** If the cursor iterates in descending order of rowid, iFirstRowid ** is the upper limit (i.e. the "first" rowid visited) and iLastRowid ** the lower. */ struct Fts5Cursor { sqlite3_vtab_cursor base; /* Base class used by SQLite core */ Fts5Cursor *pNext; /* Next cursor in Fts5Cursor.pCsr list */ int *aColumnSize; /* Values for xColumnSize() */ i64 iCsrId; /* Cursor id */ /* Zero from this point onwards on cursor reset */ int ePlan; /* FTS5_PLAN_XXX value */ int bDesc; /* True for "ORDER BY rowid DESC" queries */ i64 iFirstRowid; /* Return no rowids earlier than this */ i64 iLastRowid; /* Return no rowids later than this */ sqlite3_stmt *pStmt; /* Statement used to read %_content */ Fts5Expr *pExpr; /* Expression for MATCH queries */ Fts5Sorter *pSorter; /* Sorter for "ORDER BY rank" queries */ int csrflags; /* Mask of cursor flags (see below) */ i64 iSpecial; /* Result of special query */ /* "rank" function. Populated on demand from vtab.xColumn(). */ char *zRank; /* Custom rank function */ char *zRankArgs; /* Custom rank function args */ Fts5Auxiliary *pRank; /* Rank callback (or NULL) */ int nRankArg; /* Number of trailing arguments for rank() */ sqlite3_value **apRankArg; /* Array of trailing arguments */ sqlite3_stmt *pRankArgStmt; /* Origin of objects in apRankArg[] */ /* Auxiliary data storage */ Fts5Auxiliary *pAux; /* Currently executing extension function */ Fts5Auxdata *pAuxdata; /* First in linked list of saved aux-data */ /* Cache used by auxiliary functions xInst() and xInstCount() */ Fts5PoslistReader *aInstIter; /* One for each phrase */ int nInstAlloc; /* Size of aInst[] array (entries / 3) */ int nInstCount; /* Number of phrase instances */ int *aInst; /* 3 integers per phrase instance */ }; /* ** Bits that make up the "idxNum" parameter passed indirectly by ** xBestIndex() to xFilter(). |
︙ | ︙ | |||
11445 11446 11447 11448 11449 11450 11451 | ){ return fts5InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr); } /* ** The different query plans. */ | | | | | | | | 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 | ){ return fts5InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr); } /* ** The different query plans. */ #define FTS5_PLAN_MATCH 1 /* (<tbl> MATCH ?) */ #define FTS5_PLAN_SOURCE 2 /* A source cursor for SORTED_MATCH */ #define FTS5_PLAN_SPECIAL 3 /* An internal query */ #define FTS5_PLAN_SORTED_MATCH 4 /* (<tbl> MATCH ? ORDER BY rank) */ #define FTS5_PLAN_SCAN 5 /* No usable constraint */ #define FTS5_PLAN_ROWID 6 /* (rowid = ?) */ /* ** Implementation of the xBestIndex method for FTS5 tables. Within the ** WHERE constraint, it searches for the following: ** ** 1. A MATCH constraint against the special column. ** 2. A MATCH constraint against the "rank" column. |
︙ | ︙ | |||
11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 | static void fts5CsrNewrow(Fts5Cursor *pCsr){ CsrFlagSet(pCsr, FTS5CSR_REQUIRE_CONTENT | FTS5CSR_REQUIRE_DOCSIZE | FTS5CSR_REQUIRE_INST ); } /* ** Close the cursor. For additional information see the documentation ** on the xClose method of the virtual table interface. */ static int fts5CloseMethod(sqlite3_vtab_cursor *pCursor){ if( pCursor ){ Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab); Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; Fts5Cursor **pp; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 | static void fts5CsrNewrow(Fts5Cursor *pCsr){ CsrFlagSet(pCsr, FTS5CSR_REQUIRE_CONTENT | FTS5CSR_REQUIRE_DOCSIZE | FTS5CSR_REQUIRE_INST ); } static void fts5FreeCursorComponents(Fts5Cursor *pCsr){ Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab); Fts5Auxdata *pData; Fts5Auxdata *pNext; sqlite3_free(pCsr->aInstIter); sqlite3_free(pCsr->aInst); if( pCsr->pStmt ){ int eStmt = fts5StmtType(pCsr); sqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt); } if( pCsr->pSorter ){ Fts5Sorter *pSorter = pCsr->pSorter; sqlite3_finalize(pSorter->pStmt); sqlite3_free(pSorter); } if( pCsr->ePlan!=FTS5_PLAN_SOURCE ){ sqlite3Fts5ExprFree(pCsr->pExpr); } for(pData=pCsr->pAuxdata; pData; pData=pNext){ pNext = pData->pNext; if( pData->xDelete ) pData->xDelete(pData->pPtr); sqlite3_free(pData); } sqlite3_finalize(pCsr->pRankArgStmt); sqlite3_free(pCsr->apRankArg); if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){ sqlite3_free(pCsr->zRank); sqlite3_free(pCsr->zRankArgs); } memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr)); } /* ** Close the cursor. For additional information see the documentation ** on the xClose method of the virtual table interface. */ static int fts5CloseMethod(sqlite3_vtab_cursor *pCursor){ if( pCursor ){ Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab); Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; Fts5Cursor **pp; fts5FreeCursorComponents(pCsr); /* Remove the cursor from the Fts5Global.pCsr list */ for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext); *pp = pCsr->pNext; sqlite3_free(pCsr); } return SQLITE_OK; } static int fts5SorterNext(Fts5Cursor *pCsr){ Fts5Sorter *pSorter = pCsr->pSorter; |
︙ | ︙ | |||
11773 11774 11775 11776 11777 11778 11779 | ** even if we reach end-of-file. The fts5EofMethod() will be called ** subsequently to determine whether or not an EOF was hit. */ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int rc = SQLITE_OK; | | | | 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 | ** even if we reach end-of-file. The fts5EofMethod() will be called ** subsequently to determine whether or not an EOF was hit. */ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int rc = SQLITE_OK; assert( (pCsr->ePlan<3)== (pCsr->ePlan==FTS5_PLAN_MATCH || pCsr->ePlan==FTS5_PLAN_SOURCE) ); if( pCsr->ePlan<3 ){ int bSkip = 0; if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc; rc = sqlite3Fts5ExprNext(pCsr->pExpr, pCsr->iLastRowid); if( sqlite3Fts5ExprEof(pCsr->pExpr) ){ CsrFlagSet(pCsr, FTS5CSR_EOF); } fts5CsrNewrow(pCsr); |
︙ | ︙ | |||
12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 | int bOrderByRank; /* True if ORDER BY rank */ sqlite3_value *pMatch = 0; /* <tbl> MATCH ? expression (or NULL) */ 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) */ char **pzErrmsg = pConfig->pzErrmsg; assert( pCsr->pStmt==0 ); assert( pCsr->pExpr==0 ); assert( pCsr->csrflags==0 ); assert( pCsr->pRank==0 ); assert( pCsr->zRank==0 ); assert( pCsr->zRankArgs==0 ); | > > > > > | 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 | int bOrderByRank; /* True if ORDER BY rank */ sqlite3_value *pMatch = 0; /* <tbl> MATCH ? expression (or NULL) */ 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) */ char **pzErrmsg = pConfig->pzErrmsg; if( pCsr->ePlan ){ fts5FreeCursorComponents(pCsr); memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan-(u8*)pCsr)); } assert( pCsr->pStmt==0 ); assert( pCsr->pExpr==0 ); assert( pCsr->csrflags==0 ); assert( pCsr->pRank==0 ); assert( pCsr->zRank==0 ); assert( pCsr->zRankArgs==0 ); |
︙ | ︙ | |||
12189 12190 12191 12192 12193 12194 12195 | return sqlite3Fts5ExprRowid(pCsr->pExpr); } } /* ** This is the xRowid method. The SQLite core calls this routine to ** retrieve the rowid for the current row of the result set. fts5 | | | 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 | return sqlite3Fts5ExprRowid(pCsr->pExpr); } } /* ** This is the xRowid method. The SQLite core calls this routine to ** retrieve the rowid for the current row of the result set. fts5 ** exposes %_content.rowid as the rowid for the virtual table. The ** rowid should be written to *pRowid. */ static int fts5RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ Fts5Cursor *pCsr = (Fts5Cursor*)pCursor; int ePlan = pCsr->ePlan; assert( CsrFlagTest(pCsr, FTS5CSR_EOF)==0 ); |
︙ | ︙ | |||
12532 12533 12534 12535 12536 12537 12538 | /* ** Ensure that the Fts5Cursor.nInstCount and aInst[] variables are populated ** correctly for the current view. Return SQLITE_OK if successful, or an ** SQLite error code otherwise. */ static int fts5CacheInstArray(Fts5Cursor *pCsr){ int rc = SQLITE_OK; | < | | < | | > | | > > > | < | | | | | | | | | | | | | | | | | | < | > | > > > | > > > > > > | > > | | | | | | < < | < | < | > | | > | > | 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 | /* ** Ensure that the Fts5Cursor.nInstCount and aInst[] variables are populated ** correctly for the current view. Return SQLITE_OK if successful, or an ** SQLite error code otherwise. */ static int fts5CacheInstArray(Fts5Cursor *pCsr){ int rc = SQLITE_OK; Fts5PoslistReader *aIter; /* One iterator for each phrase */ int nIter; /* Number of iterators/phrases */ nIter = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); if( pCsr->aInstIter==0 ){ int nByte = sizeof(Fts5PoslistReader) * nIter; pCsr->aInstIter = (Fts5PoslistReader*)sqlite3Fts5MallocZero(&rc, nByte); } aIter = pCsr->aInstIter; if( aIter ){ int nInst = 0; /* Number instances seen so far */ int i; /* Initialize all iterators */ for(i=0; i<nIter; i++){ const u8 *a; int n = fts5CsrPoslist(pCsr, i, &a); sqlite3Fts5PoslistReaderInit(-1, a, n, &aIter[i]); } while( 1 ){ int *aInst; int iBest = -1; for(i=0; i<nIter; i++){ if( (aIter[i].bEof==0) && (iBest<0 || aIter[i].iPos<aIter[iBest].iPos) ){ iBest = i; } } if( iBest<0 ) break; nInst++; if( nInst>=pCsr->nInstAlloc ){ pCsr->nInstAlloc = pCsr->nInstAlloc ? pCsr->nInstAlloc*2 : 32; aInst = (int*)sqlite3_realloc( pCsr->aInst, pCsr->nInstAlloc*sizeof(int)*3 ); if( aInst ){ pCsr->aInst = aInst; }else{ rc = SQLITE_NOMEM; break; } } aInst = &pCsr->aInst[3 * (nInst-1)]; aInst[0] = iBest; aInst[1] = FTS5_POS2COLUMN(aIter[iBest].iPos); aInst[2] = FTS5_POS2OFFSET(aIter[iBest].iPos); sqlite3Fts5PoslistReaderNext(&aIter[iBest]); } pCsr->nInstCount = nInst; CsrFlagClear(pCsr, FTS5CSR_REQUIRE_INST); } return rc; } static int fts5ApiInstCount(Fts5Context *pCtx, int *pnInst){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; int rc = SQLITE_OK; if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0 || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) ){ *pnInst = pCsr->nInstCount; } return rc; } static int fts5ApiInst( Fts5Context *pCtx, int iIdx, int *piPhrase, int *piCol, int *piOff ){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; int rc = SQLITE_OK; if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0 || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) ){ if( iIdx<0 || iIdx>=pCsr->nInstCount ){ rc = SQLITE_RANGE; }else{ *piPhrase = pCsr->aInst[iIdx*3]; *piCol = pCsr->aInst[iIdx*3 + 1]; *piOff = pCsr->aInst[iIdx*3 + 2]; } |
︙ | ︙ | |||
12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 | pData->pPtr = 0; pData->xDelete = 0; } } return pRet; } static int fts5ApiQueryPhrase(Fts5Context*, int, void*, int(*)(const Fts5ExtensionApi*, Fts5Context*, void*) ); static const Fts5ExtensionApi sFts5Api = { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 | pData->pPtr = 0; pData->xDelete = 0; } } return pRet; } static void fts5ApiPhraseNext( Fts5Context *pCtx, Fts5PhraseIter *pIter, int *piCol, int *piOff ){ if( pIter->a>=pIter->b ){ *piCol = -1; *piOff = -1; }else{ int iVal; pIter->a += fts5GetVarint32(pIter->a, iVal); if( iVal==1 ){ pIter->a += fts5GetVarint32(pIter->a, iVal); *piCol = iVal; *piOff = 0; pIter->a += fts5GetVarint32(pIter->a, iVal); } *piOff += (iVal-2); } } static void fts5ApiPhraseFirst( Fts5Context *pCtx, int iPhrase, Fts5PhraseIter *pIter, int *piCol, int *piOff ){ Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; int n = fts5CsrPoslist(pCsr, iPhrase, &pIter->a); pIter->b = &pIter->a[n]; *piCol = 0; *piOff = 0; fts5ApiPhraseNext(pCtx, pIter, piCol, piOff); } static int fts5ApiQueryPhrase(Fts5Context*, int, void*, int(*)(const Fts5ExtensionApi*, Fts5Context*, void*) ); static const Fts5ExtensionApi sFts5Api = { 2, /* iVersion */ fts5ApiUserData, fts5ApiColumnCount, fts5ApiRowCount, fts5ApiColumnTotalSize, fts5ApiTokenize, fts5ApiPhraseCount, fts5ApiPhraseSize, fts5ApiInstCount, fts5ApiInst, fts5ApiRowid, fts5ApiColumnText, fts5ApiColumnSize, fts5ApiQueryPhrase, fts5ApiSetAuxdata, fts5ApiGetAuxdata, fts5ApiPhraseFirst, fts5ApiPhraseNext, }; /* ** Implementation of API function xQueryPhrase(). */ static int fts5ApiQueryPhrase( |
︙ | ︙ | |||
13244 13245 13246 13247 13248 13249 13250 | */ static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apVal /* Function arguments */ ){ assert( nArg==0 ); | | | 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 | */ static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apVal /* Function arguments */ ){ assert( nArg==0 ); sqlite3_result_text(pCtx, "fts5: 2015-08-15 16:32:50 f65a9b4ab2c6f0b7028e16e2a0f83fd6d58ae1cd", -1, SQLITE_TRANSIENT); } #ifdef _WIN32 __declspec(dllexport) #endif int sqlite3_fts5_init( sqlite3 *db, |
︙ | ︙ | |||
13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 | /* ** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error ** code otherwise. */ static int sqlite3Fts5DropAll(Fts5Config *pConfig){ int rc = fts5ExecPrintf(pConfig->db, 0, "DROP TABLE IF EXISTS %Q.'%q_data';" "DROP TABLE IF EXISTS %Q.'%q_config';", pConfig->zDb, pConfig->zName, pConfig->zDb, pConfig->zName ); if( rc==SQLITE_OK && pConfig->bColumnsize ){ rc = fts5ExecPrintf(pConfig->db, 0, "DROP TABLE IF EXISTS %Q.'%q_docsize';", pConfig->zDb, pConfig->zName | > > | 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 | /* ** Drop all shadow tables. Return SQLITE_OK if successful or an SQLite error ** code otherwise. */ static int sqlite3Fts5DropAll(Fts5Config *pConfig){ int rc = fts5ExecPrintf(pConfig->db, 0, "DROP TABLE IF EXISTS %Q.'%q_data';" "DROP TABLE IF EXISTS %Q.'%q_idx';" "DROP TABLE IF EXISTS %Q.'%q_config';", pConfig->zDb, pConfig->zName, pConfig->zDb, pConfig->zName, pConfig->zDb, pConfig->zName ); if( rc==SQLITE_OK && pConfig->bColumnsize ){ rc = fts5ExecPrintf(pConfig->db, 0, "DROP TABLE IF EXISTS %Q.'%q_docsize';", pConfig->zDb, pConfig->zName |
︙ | ︙ | |||
13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 | } static int sqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){ Fts5Config *pConfig = pStorage->pConfig; int rc = sqlite3Fts5StorageSync(pStorage, 1); fts5StorageRenameOne(pConfig, &rc, "data", zName); fts5StorageRenameOne(pConfig, &rc, "config", zName); if( pConfig->bColumnsize ){ fts5StorageRenameOne(pConfig, &rc, "docsize", zName); } if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ fts5StorageRenameOne(pConfig, &rc, "content", zName); } | > | 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 | } static int sqlite3Fts5StorageRename(Fts5Storage *pStorage, const char *zName){ Fts5Config *pConfig = pStorage->pConfig; int rc = sqlite3Fts5StorageSync(pStorage, 1); fts5StorageRenameOne(pConfig, &rc, "data", zName); fts5StorageRenameOne(pConfig, &rc, "idx", zName); fts5StorageRenameOne(pConfig, &rc, "config", zName); if( pConfig->bColumnsize ){ fts5StorageRenameOne(pConfig, &rc, "docsize", zName); } if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ fts5StorageRenameOne(pConfig, &rc, "content", zName); } |
︙ | ︙ | |||
13933 13934 13935 13936 13937 13938 13939 | */ static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){ Fts5Config *pConfig = p->pConfig; int rc; /* Delete the contents of the %_data and %_docsize tables. */ rc = fts5ExecPrintf(pConfig->db, 0, | | > > | 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 | */ static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){ Fts5Config *pConfig = p->pConfig; int rc; /* Delete the contents of the %_data and %_docsize tables. */ rc = fts5ExecPrintf(pConfig->db, 0, "DELETE FROM %Q.'%q_data';" "DELETE FROM %Q.'%q_idx';", pConfig->zDb, pConfig->zName, pConfig->zDb, pConfig->zName ); if( rc==SQLITE_OK && pConfig->bColumnsize ){ rc = fts5ExecPrintf(pConfig->db, 0, "DELETE FROM %Q.'%q_docsize';", pConfig->zDb, pConfig->zName ); |
︙ | ︙ | |||
14963 14964 14965 14966 14967 14968 14969 | if( pRet ){ memset(pRet, 0, sizeof(PorterTokenizer)); rc = pApi->xFindTokenizer(pApi, zBase, &pUserdata, &pRet->tokenizer); }else{ rc = SQLITE_NOMEM; } if( rc==SQLITE_OK ){ | > > | | 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 | if( pRet ){ memset(pRet, 0, sizeof(PorterTokenizer)); rc = pApi->xFindTokenizer(pApi, zBase, &pUserdata, &pRet->tokenizer); }else{ rc = SQLITE_NOMEM; } if( rc==SQLITE_OK ){ int nArg2 = (nArg>0 ? nArg-1 : 0); const char **azArg2 = (nArg2 ? &azArg[1] : 0); rc = pRet->tokenizer.xCreate(pUserdata, azArg2, nArg2, &pRet->pTokenizer); } if( rc!=SQLITE_OK ){ fts5PorterDelete((Fts5Tokenizer*)pRet); pRet = 0; } *ppOut = (Fts5Tokenizer*)pRet; |
︙ | ︙ | |||
16803 16804 16805 16806 16807 16808 16809 | break; } return SQLITE_OK; } /* ** This is the xRowid method. The SQLite core calls this routine to | | < | 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 | break; } return SQLITE_OK; } /* ** This is the xRowid method. The SQLite core calls this routine to ** retrieve the rowid for the current row of the result set. The ** rowid should be written to *pRowid. */ static int fts5VocabRowidMethod( sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid ){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; |
︙ | ︙ |
Changes to Setup/build.bat.
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 | ECHO Could not change directory to "%ROOT%". GOTO errors ) SET PATH=%BUILDTOOLDIR%;%PATH% %_VECHO% Path = '%PATH%' IF NOT DEFINED SOLUTION ( %_AECHO% Building all projects... SET SOLUTION=.\SQLite.NET.%YEAR%.MSBuild.sln ) IF NOT EXIST "%SOLUTION%" ( | > > > > > > > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | ECHO Could not change directory to "%ROOT%". GOTO errors ) SET PATH=%BUILDTOOLDIR%;%PATH% %_VECHO% Path = '%PATH%' IF NOT DEFINED SOLUTION ( IF DEFINED COREONLY ( %_AECHO% Building core managed project... SET SOLUTION=.\System.Data.SQLite\System.Data.SQLite.%YEAR%.csproj ) ) IF NOT DEFINED SOLUTION ( %_AECHO% Building all projects... SET SOLUTION=.\SQLite.NET.%YEAR%.MSBuild.sln ) IF NOT EXIST "%SOLUTION%" ( |
︙ | ︙ |
Added Setup/build_mono.bat.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 | @ECHO OFF :: :: build_mono.bat -- :: :: Mono Wrapper Tool for MSBuild :: :: Written by Joe Mistachkin. :: Released to the public domain, use at your own risk! :: SETLOCAL REM SET __ECHO=ECHO REM SET __ECHO3=ECHO IF NOT DEFINED _AECHO (SET _AECHO=REM) IF NOT DEFINED _CECHO (SET _CECHO=REM) IF NOT DEFINED _VECHO (SET _VECHO=REM) %_AECHO% Running %0 %* SET DUMMY2=%1 IF DEFINED DUMMY2 ( GOTO usage ) SET TOOLS=%~dp0 SET TOOLS=%TOOLS:~0,-1% %_VECHO% Tools = '%TOOLS%' SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly SET PLATFORMS="Any CPU" SET YEARS=2008 2013 SET NOUSER=1 SET MSBUILD_ARGS=/property:UseInteropDll=false SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:UseSqliteStandard=true SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropExtensionFunctions=false SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropVirtualTable=false SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropTestExtension=false CALL :fn_ResetErrorLevel %__ECHO3% CALL "%TOOLS%\build_all.bat" IF ERRORLEVEL 1 ( ECHO Failed to build Mono binaries. GOTO errors ) :fn_ResetErrorLevel VERIFY > NUL GOTO :EOF :fn_SetErrorLevel VERIFY MAYBE 2> NUL GOTO :EOF :usage ECHO. ECHO Usage: %~nx0 ECHO. GOTO errors :errors CALL :fn_SetErrorLevel ENDLOCAL ECHO. ECHO Build failure, errors were encountered. GOTO end_of_file :no_errors CALL :fn_ResetErrorLevel ENDLOCAL ECHO. ECHO Build success, no errors were encountered. GOTO end_of_file :end_of_file %__ECHO% EXIT /B %ERRORLEVEL% |
Changes to Setup/clean.bat.
︙ | ︙ | |||
38 39 40 41 42 43 44 | IF NOT EXIST "%TEMP%" ( ECHO The TEMP directory, "%TEMP%", does not exist. GOTO usage ) IF DEFINED CLEANDIRS GOTO skip_cleanDirs | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | IF NOT EXIST "%TEMP%" ( ECHO The TEMP directory, "%TEMP%", does not exist. GOTO usage ) IF DEFINED CLEANDIRS GOTO skip_cleanDirs SET CLEANDIRS=.vs bin obj Doc\Output Setup\Output SET CLEANDIRS=%CLEANDIRS% SQLite.Designer\bin SQLite.Designer\obj SET CLEANDIRS=%CLEANDIRS% SQLite.Interop\bin SQLite.Interop\obj SET CLEANDIRS=%CLEANDIRS% System.Data.SQLite\bin System.Data.SQLite\obj SET CLEANDIRS=%CLEANDIRS% System.Data.SQLite.Linq\bin System.Data.SQLite.Linq\obj SET CLEANDIRS=%CLEANDIRS% test\bin test\obj testce\bin testce\obj testlinq\bin SET CLEANDIRS=%CLEANDIRS% testlinq\obj tools\install\bin tools\install\obj |
︙ | ︙ |
Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.
︙ | ︙ | |||
39 40 41 42 43 44 45 | static SQLiteFactory() { #if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY UnsafeNativeMethods.Initialize(); #endif | | | | 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 | static SQLiteFactory() { #if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY UnsafeNativeMethods.Initialize(); #endif #if USE_INTEROP_DLL && INTEROP_LOG if (UnsafeNativeMethods.sqlite3_config_log_interop() == SQLiteErrorCode.Ok) { UnsafeNativeMethods.sqlite3_log( SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized.")); } #endif SQLiteLog.Initialize(); string version = #if NET_40 || NET_45 || NET_451 || NET_46 "4.0.0.0"; #else "3.5.0.0"; #endif _dbProviderServicesType = Type.GetType(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false); } /// <summary> /// Will provide a <see cref="IServiceProvider" /> object in .NET 3.5. /// </summary> /// <param name="serviceType">The class or interface type to query for.</param> /// <returns></returns> |
︙ | ︙ | |||
86 87 88 89 90 91 92 | string typeName = UnsafeNativeMethods.GetSettingValue( "TypeName_SQLiteProviderServices", null); Version version = this.GetType().Assembly.GetName().Version; if (typeName != null) { | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | string typeName = UnsafeNativeMethods.GetSettingValue( "TypeName_SQLiteProviderServices", null); Version version = this.GetType().Assembly.GetName().Version; if (typeName != null) { typeName = UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, typeName, version); } else { typeName = UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, DefaultTypeName, version); } Type type = Type.GetType(typeName, false); if (type != null) { |
︙ | ︙ |
Changes to System.Data.SQLite/SQLite3.cs.
︙ | ︙ | |||
244 245 246 247 248 249 250 | if (SQLiteBase.ResetConnection(_sql, _sql, canThrow)) { if (unbindFunctions) { if (SQLiteFunction.UnbindAllFunctions(this, _flags, false)) { #if !NET_COMPACT_20 && TRACE_CONNECTION | | | | | | | | 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 | if (SQLiteBase.ResetConnection(_sql, _sql, canThrow)) { if (unbindFunctions) { if (SQLiteFunction.UnbindAllFunctions(this, _flags, false)) { #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "UnbindFunctions (Pool) Success: {0}", HandleToString())); #endif } else { #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "UnbindFunctions (Pool) Failure: {0}", HandleToString())); #endif } } #if INTEROP_VIRTUAL_TABLE DisposeModules(); #endif SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion); SQLiteConnection.OnChanged(null, new ConnectionEventArgs( SQLiteConnectionEventType.ClosedToPool, null, null, null, null, _sql, _fileName, new object[] { typeof(SQLite3), canThrow, _fileName, _poolVersion })); #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Close (Pool) Success: {0}", HandleToString())); #endif } #if !NET_COMPACT_20 && TRACE_CONNECTION else { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Close (Pool) Failure: {0}", HandleToString())); } #endif } else { if (unbindFunctions) { if (SQLiteFunction.UnbindAllFunctions(this, _flags, false)) { #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "UnbindFunctions Success: {0}", HandleToString())); #endif } else { #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "UnbindFunctions Failure: {0}", HandleToString())); #endif } } |
︙ | ︙ | |||
885 886 887 888 889 890 891 | SQLiteConnection.OnChanged(null, new ConnectionEventArgs( SQLiteConnectionEventType.OpenedFromPool, null, null, null, null, _sql, strFilename, new object[] { typeof(SQLite3), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool, _poolVersion })); #if !NET_COMPACT_20 && TRACE_CONNECTION | | | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | SQLiteConnection.OnChanged(null, new ConnectionEventArgs( SQLiteConnectionEventType.OpenedFromPool, null, null, null, null, _sql, strFilename, new object[] { typeof(SQLite3), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool, _poolVersion })); #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Open (Pool): {0}", HandleToString())); #endif } if (_sql == null) { |
︙ | ︙ | |||
916 917 918 919 920 921 922 | else #endif { n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), ref db, openFlags, ToUTF8(vfsName)); } #if !NET_COMPACT_20 && TRACE_CONNECTION | | | 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | else #endif { n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), ref db, openFlags, ToUTF8(vfsName)); } #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Open: {0}", db)); #endif if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null); _sql = new SQLiteConnectionHandle(db, true); } |
︙ | ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | // data classes. // string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null; if (!String.IsNullOrEmpty(baseSchemaName)) { strSql = strSql.Replace( | | | | | 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 | // data classes. // string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null; if (!String.IsNullOrEmpty(baseSchemaName)) { strSql = strSql.Replace( UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "[{0}].", baseSchemaName), String.Empty); strSql = strSql.Replace( UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "{0}.", baseSchemaName), String.Empty); } } SQLiteConnectionFlags flags = (cnn != null) ? cnn.Flags : SQLiteConnectionFlags.Default; if ( #if !PLATFORM_COMPACTFRAMEWORK ForceLogPrepare() || #endif ((flags & SQLiteConnectionFlags.LogPrepare) == SQLiteConnectionFlags.LogPrepare)) { if ((strSql == null) || (strSql.Length == 0) || (strSql.Trim().Length == 0)) SQLiteLog.LogMessage("Preparing {<nothing>}..."); else SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Preparing {{{0}}}...", strSql)); } IntPtr stmt = IntPtr.Zero; IntPtr ptr = IntPtr.Zero; int len = 0; SQLiteErrorCode n = SQLiteErrorCode.Schema; |
︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 | #else n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, ref stmt, ref ptr); #endif len = -1; #endif #if !NET_COMPACT_20 && TRACE_STATEMENT | | | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | #else n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, ref stmt, ref ptr); #endif len = -1; #endif #if !NET_COMPACT_20 && TRACE_STATEMENT Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Prepare ({0}): {1}", n, stmt)); #endif if ((n == SQLiteErrorCode.Ok) && (stmt != IntPtr.Zero)) { if (statementHandle != null) statementHandle.Dispose(); |
︙ | ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | } } protected static void LogBind(SQLiteStatementHandle handle, int index) { IntPtr handleIntPtr = handle; | | | > | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | } } protected static void LogBind(SQLiteStatementHandle handle, int index) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} as NULL...", handleIntPtr, index)); } protected static void LogBind(SQLiteStatementHandle handle, int index, ValueType value) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...", handleIntPtr, index, value.GetType(), value)); } private static string FormatDateTime(DateTime value) { StringBuilder result = new StringBuilder(); |
︙ | ︙ | |||
1477 1478 1479 1480 1481 1482 1483 | return result.ToString(); } protected static void LogBind(SQLiteStatementHandle handle, int index, DateTime value) { IntPtr handleIntPtr = handle; | | > | > | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | return result.ToString(); } protected static void LogBind(SQLiteStatementHandle handle, int index, DateTime value) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...", handleIntPtr, index, typeof(DateTime), FormatDateTime(value))); } protected static void LogBind(SQLiteStatementHandle handle, int index, string value) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...", handleIntPtr, index, typeof(String), (value != null) ? value : "<null>")); } private static string ToHexadecimalString( byte[] array ) |
︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | return result.ToString(); } protected static void LogBind(SQLiteStatementHandle handle, int index, byte[] value) { IntPtr handleIntPtr = handle; | | > > > < | 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 | return result.ToString(); } protected static void LogBind(SQLiteStatementHandle handle, int index, byte[] value) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...", handleIntPtr, index, typeof(Byte[]), (value != null) ? ToHexadecimalString(value) : "<null>")); } internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } #if !PLATFORM_COMPACTFRAMEWORK SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #else throw new NotImplementedException(); #endif } internal override void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, int value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) |
︙ | ︙ | |||
1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 | #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); #else throw new NotImplementedException(); #endif | > > < > > < | 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 | #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #else throw new NotImplementedException(); #endif } internal override void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, ulong value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); #else throw new NotImplementedException(); #endif } internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value) { SQLiteStatementHandle handle = stmt._sqlite_stmt; #if !PLATFORM_COMPACTFRAMEWORK |
︙ | ︙ | |||
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); #else throw new NotImplementedException(); #endif | > > > > < < > > > > < < > > > > < < | 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #else throw new NotImplementedException(); #endif } case SQLiteDateFormats.JulianDay: { double value = ToJulianDay(dt); #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #else throw new NotImplementedException(); #endif } case SQLiteDateFormats.UnixEpoch: { long value = Convert.ToInt64(dt.Subtract(UnixEpoch).TotalSeconds); #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { LogBind(handle, index, value); } SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #elif !SQLITE_STANDARD SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); break; #else throw new NotImplementedException(); #endif } default: { byte[] b = ToUTF8(dt); #if !PLATFORM_COMPACTFRAMEWORK if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) |
︙ | ︙ | |||
1783 1784 1785 1786 1787 1788 1789 | SQLiteStatementHandle handle = stmt._sqlite_stmt; int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle); if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; | | | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 | SQLiteStatementHandle handle = stmt._sqlite_stmt; int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle); if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Statement {0} paramter count is {1}.", handleIntPtr, value)); } return value; } |
︙ | ︙ | |||
1808 1809 1810 1811 1812 1813 1814 | name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(handle, index), -1); #endif if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; | | | | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 | name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(handle, index), -1); #endif if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Statement {0} paramter #{1} name is {{{2}}}.", handleIntPtr, index, name)); } return name; } internal override int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName) { SQLiteStatementHandle handle = stmt._sqlite_stmt; int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName)); if ((flags & SQLiteConnectionFlags.LogBind) == SQLiteConnectionFlags.LogBind) { IntPtr handleIntPtr = handle; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Statement {0} paramter index of name {{{1}}} is #{2}.", handleIntPtr, paramName, index)); } return index; } |
︙ | ︙ | |||
1974 1975 1976 1977 1978 1979 1980 | notNull = (nnotNull == 1); primaryKey = (nprimaryKey == 1); autoIncrement = (nautoInc == 1); } internal override double GetDouble(SQLiteStatement stmt, int index) { | < | | > < | 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 | notNull = (nnotNull == 1); primaryKey = (nprimaryKey == 1); autoIncrement = (nautoInc == 1); } internal override double GetDouble(SQLiteStatement stmt, int index) { #if !PLATFORM_COMPACTFRAMEWORK return UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index); #elif !SQLITE_STANDARD double value = 0.0; UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, ref value); return value; #else throw new NotImplementedException(); #endif } internal override sbyte GetSByte(SQLiteStatement stmt, int index) { return unchecked((sbyte)(GetInt32(stmt, index) & byte.MaxValue)); } |
︙ | ︙ | |||
2018 2019 2020 2021 2022 2023 2024 | internal override uint GetUInt32(SQLiteStatement stmt, int index) { return unchecked((uint)GetInt32(stmt, index)); } internal override long GetInt64(SQLiteStatement stmt, int index) { | < | | > < | 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 | internal override uint GetUInt32(SQLiteStatement stmt, int index) { return unchecked((uint)GetInt32(stmt, index)); } internal override long GetInt64(SQLiteStatement stmt, int index) { #if !PLATFORM_COMPACTFRAMEWORK return UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index); #elif !SQLITE_STANDARD long value = 0; UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, ref value); return value; #else throw new NotImplementedException(); #endif } internal override ulong GetUInt64(SQLiteStatement stmt, int index) { return unchecked((ulong)GetInt64(stmt, index)); } |
︙ | ︙ | |||
2249 2250 2251 2252 2253 2254 2255 | } return nCopied; } internal override double GetParamValueDouble(IntPtr ptr) { | < | | > < < | | > < | 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 | } return nCopied; } internal override double GetParamValueDouble(IntPtr ptr) { #if !PLATFORM_COMPACTFRAMEWORK return UnsafeNativeMethods.sqlite3_value_double(ptr); #elif !SQLITE_STANDARD double value = 0.0; UnsafeNativeMethods.sqlite3_value_double_interop(ptr, ref value); return value; #else throw new NotImplementedException(); #endif } internal override int GetParamValueInt32(IntPtr ptr) { return UnsafeNativeMethods.sqlite3_value_int(ptr); } internal override long GetParamValueInt64(IntPtr ptr) { #if !PLATFORM_COMPACTFRAMEWORK return UnsafeNativeMethods.sqlite3_value_int64(ptr); #elif !SQLITE_STANDARD Int64 value = 0; UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, ref value); return value; #else throw new NotImplementedException(); #endif } internal override string GetParamValueText(IntPtr ptr) { #if !SQLITE_STANDARD int len = 0; return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, ref len), len); |
︙ | ︙ | |||
2384 2385 2386 2387 2388 2389 2390 | _modules.Add(module.Name, module); if (_usePool) { _usePool = false; #if !NET_COMPACT_20 && TRACE_CONNECTION | | | 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 | _modules.Add(module.Name, module); if (_usePool) { _usePool = false; #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "CreateModule (Pool) Disabled: {0}", HandleToString())); #endif } } else |
︙ | ︙ | |||
2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 | } #if INTEROP_CODEC || INTEROP_INCLUDE_SEE internal override void SetPassword(byte[] passwordBytes) { SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } internal override void ChangePassword(byte[] newPasswordBytes) { SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); } #endif internal override void SetProgressHook(int nOps, SQLiteProgressCallback func) { UnsafeNativeMethods.sqlite3_progress_handler(_sql, nOps, func, IntPtr.Zero); } | > > | 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 | } #if INTEROP_CODEC || INTEROP_INCLUDE_SEE internal override void SetPassword(byte[] passwordBytes) { SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); _usePool = false; } internal override void ChangePassword(byte[] newPasswordBytes) { SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length); if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError()); _usePool = false; } #endif internal override void SetProgressHook(int nOps, SQLiteProgressCallback func) { UnsafeNativeMethods.sqlite3_progress_handler(_sql, nOps, func, IntPtr.Zero); } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | ︙ | |||
8 9 10 11 12 13 14 | namespace System.Data.SQLite { using System; using System.Collections.Generic; #if !NET_COMPACT_20 && TRACE_CONNECTION using System.Diagnostics; | < > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | namespace System.Data.SQLite { using System; using System.Collections.Generic; #if !NET_COMPACT_20 && TRACE_CONNECTION using System.Diagnostics; #endif using System.Globalization; using System.IO; using System.Runtime.InteropServices; /// <summary> /// Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode) /// </summary> internal sealed class SQLite3_UTF16 : SQLite3 { /// <summary> |
︙ | ︙ | |||
158 159 160 161 162 163 164 | SQLiteConnectionEventType.OpenedFromPool, null, null, null, null, _sql, strFilename, new object[] { typeof(SQLite3_UTF16), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool, _poolVersion })); #if !NET_COMPACT_20 && TRACE_CONNECTION | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | SQLiteConnectionEventType.OpenedFromPool, null, null, null, null, _sql, strFilename, new object[] { typeof(SQLite3_UTF16), strFilename, vfsName, connectionFlags, openFlags, maxPoolSize, usePool, _poolVersion })); #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Open16 (Pool): {0}", HandleToString())); #endif } if (_sql == null) |
︙ | ︙ | |||
197 198 199 200 201 202 203 | // a flags parameter. // if (((openFlags & SQLiteOpenFlagsEnum.Create) != SQLiteOpenFlagsEnum.Create) && !File.Exists(strFilename)) throw new SQLiteException(SQLiteErrorCode.CantOpen, strFilename); if (vfsName != null) { | | > | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | // a flags parameter. // if (((openFlags & SQLiteOpenFlagsEnum.Create) != SQLiteOpenFlagsEnum.Create) && !File.Exists(strFilename)) throw new SQLiteException(SQLiteErrorCode.CantOpen, strFilename); if (vfsName != null) { throw new SQLiteException(SQLiteErrorCode.CantOpen, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "cannot open using UTF-16 and VFS \"{0}\": need interop assembly", vfsName)); } n = UnsafeNativeMethods.sqlite3_open16(strFilename, ref db); } #if !NET_COMPACT_20 && TRACE_CONNECTION Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Open16: {0}", db)); #endif if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null); _sql = new SQLiteConnectionHandle(db, true); } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | ︙ | |||
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | /// <summary> /// Prevent this <see cref="SQLiteConnection" /> object instance from /// loading extensions. /// </summary> NoLoadExtension = 0x200, /// <summary> /// Prevent this <see cref="SQLiteConnection" /> object instance from /// creating virtual table modules. /// </summary> NoCreateModule = 0x400, /// <summary> /// Skip binding any functions provided by other managed assemblies when /// opening the connection. /// </summary> NoBindFunctions = 0x800, /// <summary> /// Skip setting the logging related properties of the /// <see cref="SQLiteModule" /> object instance that was passed to /// the <see cref="SQLiteConnection.CreateModule" /> method. /// </summary> NoLogModule = 0x1000, /// <summary> /// Enable logging of all virtual table module errors seen by the /// <see cref="SQLiteModule.SetTableError(IntPtr,String)" /> method. /// </summary> LogModuleError = 0x2000, /// <summary> /// Enable logging of certain virtual table module exceptions that cannot /// be easily discovered via other means. /// </summary> LogModuleException = 0x4000, /// <summary> /// Enable tracing of potentially important [non-fatal] error conditions /// that cannot be easily reported through other means. /// </summary> TraceWarning = 0x8000, | > > > > | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 | /// <summary> /// Prevent this <see cref="SQLiteConnection" /> object instance from /// loading extensions. /// </summary> NoLoadExtension = 0x200, #if INTEROP_VIRTUAL_TABLE /// <summary> /// Prevent this <see cref="SQLiteConnection" /> object instance from /// creating virtual table modules. /// </summary> NoCreateModule = 0x400, #endif /// <summary> /// Skip binding any functions provided by other managed assemblies when /// opening the connection. /// </summary> NoBindFunctions = 0x800, #if INTEROP_VIRTUAL_TABLE /// <summary> /// Skip setting the logging related properties of the /// <see cref="SQLiteModule" /> object instance that was passed to /// the <see cref="SQLiteConnection.CreateModule" /> method. /// </summary> NoLogModule = 0x1000, /// <summary> /// Enable logging of all virtual table module errors seen by the /// <see cref="SQLiteModule.SetTableError(IntPtr,String)" /> method. /// </summary> LogModuleError = 0x2000, /// <summary> /// Enable logging of certain virtual table module exceptions that cannot /// be easily discovered via other means. /// </summary> LogModuleException = 0x4000, #endif /// <summary> /// Enable tracing of potentially important [non-fatal] error conditions /// that cannot be easily reported through other means. /// </summary> TraceWarning = 0x8000, |
︙ | ︙ | |||
1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | /// </summary> ConvertAndBindAndGetAllAsInvariantText = BindAndGetAllAsText | ConvertAndBindInvariantText, /// <summary> /// Enable all logging. /// </summary> LogAll = LogPrepare | LogPreBind | LogBind | LogCallbackException | LogBackup | LogModuleError | LogModuleException, /// <summary> /// The default extra flags for new connections. /// </summary> Default = LogCallbackException | LogModuleException, /// <summary> /// The default extra flags for new connections with all logging enabled. /// </summary> DefaultAndLogAll = Default | LogAll } | > > > > > > > > > | 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 | /// </summary> ConvertAndBindAndGetAllAsInvariantText = BindAndGetAllAsText | ConvertAndBindInvariantText, /// <summary> /// Enable all logging. /// </summary> #if INTEROP_VIRTUAL_TABLE LogAll = LogPrepare | LogPreBind | LogBind | LogCallbackException | LogBackup | LogModuleError | LogModuleException, #else LogAll = LogPrepare | LogPreBind | LogBind | LogCallbackException | LogBackup, #endif /// <summary> /// The default extra flags for new connections. /// </summary> #if INTEROP_VIRTUAL_TABLE Default = LogCallbackException | LogModuleException, #else Default = LogCallbackException, #endif /// <summary> /// The default extra flags for new connections with all logging enabled. /// </summary> DefaultAndLogAll = Default | LogAll } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteCommandBuilder.cs.
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteCommandBuilder).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) | > > > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteCommandBuilder).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Cleans up resources (native and managed) associated with the current instance. /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) |
︙ | ︙ | |||
98 99 100 101 102 103 104 | /// <summary> /// Returns a valid named parameter /// </summary> /// <param name="parameterName">The name of the parameter</param> /// <returns>Error</returns> protected override string GetParameterName(string parameterName) { | | | | 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 | /// <summary> /// Returns a valid named parameter /// </summary> /// <param name="parameterName">The name of the parameter</param> /// <returns>Error</returns> protected override string GetParameterName(string parameterName) { return UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "@{0}", parameterName); } /// <summary> /// Returns a named parameter for the given ordinal /// </summary> /// <param name="parameterOrdinal">The i of the parameter</param> /// <returns>Error</returns> protected override string GetParameterName(int parameterOrdinal) { return UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "@param{0}", parameterOrdinal); } /// <summary> /// Returns a placeholder character for the specified parameter i. /// </summary> /// <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param> /// <returns>Returns a named parameter</returns> |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | ︙ | |||
294 295 296 297 298 299 300 | /// <b>False</b> - Store GUID columns as text /// </description> /// <description>N</description> /// <description>True</description> /// </item> /// <item> /// <description>Cache Size</description> | | > > > > > > > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | /// <b>False</b> - Store GUID columns as text /// </description> /// <description>N</description> /// <description>True</description> /// </item> /// <item> /// <description>Cache Size</description> /// <description> /// If the argument N is positive then the suggested cache size is set to N. /// If the argument N is negative, then the number of cache pages is adjusted /// to use approximately abs(N*1024) bytes of memory. Backwards compatibility /// note: The behavior of cache_size with a negative N was different in SQLite /// versions prior to 3.7.10. In version 3.7.9 and earlier, the number of /// pages in the cache was set to the absolute value of N. /// </description> /// <description>N</description> /// <description>2000</description> /// </item> /// <item> /// <description>Synchronous</description> /// <description> /// <b>Normal</b> - Normal file flushing behavior |
︙ | ︙ | |||
803 804 805 806 807 808 809 810 811 812 813 814 815 816 | /// <param name="connectionString">The connection string to use.</param> public SQLiteConnection(string connectionString) : this(connectionString, false) { // do nothing. } /// <summary> /// Initializes the connection with a pre-existing native connection handle. /// This constructor overload is intended to be used only by the private /// <see cref="SQLiteModule.CreateOrConnect" /> method. /// </summary> /// <param name="db"> /// The native connection handle to use. | > | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | /// <param name="connectionString">The connection string to use.</param> public SQLiteConnection(string connectionString) : this(connectionString, false) { // do nothing. } #if INTEROP_VIRTUAL_TABLE /// <summary> /// Initializes the connection with a pre-existing native connection handle. /// This constructor overload is intended to be used only by the private /// <see cref="SQLiteModule.CreateOrConnect" /> method. /// </summary> /// <param name="db"> /// The native connection handle to use. |
︙ | ︙ | |||
832 833 834 835 836 837 838 839 840 841 842 843 844 845 | _flags = SQLiteConnectionFlags.None; _connectionState = (db != IntPtr.Zero) ? ConnectionState.Open : ConnectionState.Closed; _connectionString = null; /* unknown */ } /// <summary> /// Initializes the connection with the specified connection string. /// </summary> /// <param name="connectionString"> /// The connection string to use. /// </param> | > | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 | _flags = SQLiteConnectionFlags.None; _connectionState = (db != IntPtr.Zero) ? ConnectionState.Open : ConnectionState.Closed; _connectionString = null; /* unknown */ } #endif /// <summary> /// Initializes the connection with the specified connection string. /// </summary> /// <param name="connectionString"> /// The connection string to use. /// </param> |
︙ | ︙ | |||
877 878 879 880 881 882 883 | if (_versionNumber >= 3007014) SQLiteConnectionHandle.closeConnection = SQLiteBase.CloseConnectionV2; } } #endif | | | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | if (_versionNumber >= 3007014) SQLiteConnectionHandle.closeConnection = SQLiteBase.CloseConnectionV2; } } #endif #if USE_INTEROP_DLL && INTEROP_LOG if (UnsafeNativeMethods.sqlite3_config_log_interop() == SQLiteErrorCode.Ok) { UnsafeNativeMethods.sqlite3_log( SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized.")); } #endif |
︙ | ︙ | |||
925 926 927 928 929 930 931 | { string str = row[0].ToString(); if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0 && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0) { using (SQLiteCommand cmd = CreateCommand()) { | | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | { string str = row[0].ToString(); if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0 && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0) { using (SQLiteCommand cmd = CreateCommand()) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]); cmd.ExecuteNonQuery(); } } } } } } |
︙ | ︙ | |||
1158 1159 1160 1161 1162 1163 1164 | break; } } catch (Exception e) { if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup) { | | | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | break; } } catch (Exception e) { if ((_flags & SQLiteConnectionFlags.LogBackup) == SQLiteConnectionFlags.LogBackup) { SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Caught exception while backing up database: {0}", e)); } throw; } finally |
︙ | ︙ | |||
1379 1380 1381 1382 1383 1384 1385 | /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to bind the specified <see cref="SQLiteFunction" /> object /// instance to this connection. /// </summary> /// <param name="functionAttribute"> | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1388 1389 1390 1391 1392 1393 1394 1395 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 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 | /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to bind the specified <see cref="SQLiteFunction" /> object /// instance to this connection. /// </summary> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute" /> object instance containing /// the metadata for the function to be bound. /// </param> /// <param name="function"> /// The <see cref="SQLiteFunction" /> object instance that implements the /// function to be bound. /// </param> public void BindFunction( SQLiteFunctionAttribute functionAttribute, SQLiteFunction function ) { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for binding functions."); _sql.BindFunction(functionAttribute, function, _flags); } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to bind the specified <see cref="SQLiteFunction" /> object /// instance to this connection. /// </summary> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute" /> object instance containing /// the metadata for the function to be bound. /// </param> /// <param name="callback1"> /// A <see cref="Delegate" /> object instance that helps implement the /// function to be bound. For scalar functions, this corresponds to the /// <see cref="SQLiteInvokeDelegate" /> type. For aggregate functions, /// this corresponds to the <see cref="SQLiteStepDelegate" /> type. For /// collation functions, this corresponds to the /// <see cref="SQLiteCompareDelegate" /> type. /// </param> /// <param name="callback2"> /// A <see cref="Delegate" /> object instance that helps implement the /// function to be bound. For aggregate functions, this corresponds to the /// <see cref="SQLiteFinalDelegate" /> type. For other callback types, it /// is not used and must be null. /// </param> public void BindFunction( SQLiteFunctionAttribute functionAttribute, Delegate callback1, Delegate callback2 ) { CheckDisposed(); if (_sql == null) throw new InvalidOperationException( "Database connection not valid for binding functions."); _sql.BindFunction(functionAttribute, new SQLiteDelegateFunction(callback1, callback2), _flags); } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to unbind the specified <see cref="SQLiteFunction" /> object /// instance to this connection. /// </summary> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute" /> object instance containing /// the metadata for the function to be unbound. /// </param> /// <returns>Non-zero if the function was unbound.</returns> public bool UnbindFunction( SQLiteFunctionAttribute functionAttribute ) { |
︙ | ︙ | |||
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteConnection).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { #if !NET_COMPACT_20 && TRACE_WARNING if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { if (_noDispose) { | > > > > > > | | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteConnection).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Cleans up resources (native and managed) associated with the current instance. /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { #if !NET_COMPACT_20 && TRACE_WARNING if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { if (_noDispose) { System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.", _connectionString)); } } #endif |
︙ | ︙ | |||
2032 2033 2034 2035 2036 2037 2038 | if (UnsafeNativeMethods.GetSettingValue("No_SQLiteConnectionNewParser", null) != null) arParts = SQLiteConvert.Split(s, ';'); else arParts = SQLiteConvert.NewSplit(s, ';', true, ref error); if (arParts == null) { | > | | 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 | if (UnsafeNativeMethods.GetSettingValue("No_SQLiteConnectionNewParser", null) != null) arParts = SQLiteConvert.Split(s, ';'); else arParts = SQLiteConvert.NewSplit(s, ';', true, ref error); if (arParts == null) { throw new ArgumentException(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Invalid ConnectionString format, cannot parse: {0}", (error != null) ? error : "could not split connection string into properties")); } int x = (arParts != null) ? arParts.Length : 0; // For each semi-colon piece, split into key and value pairs by the presence of the = sign for (n = 0; n < x; n++) |
︙ | ︙ | |||
2056 2057 2058 2059 2060 2061 2062 | int indexOf = arParts[n].IndexOf('='); if (indexOf != -1) ls.Add(UnwrapString(arParts[n].Substring(0, indexOf).Trim()), UnwrapString(arParts[n].Substring(indexOf + 1).Trim())); else if (allowNameOnly) ls.Add(UnwrapString(arParts[n].Trim()), String.Empty); else | | | 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 | int indexOf = arParts[n].IndexOf('='); if (indexOf != -1) ls.Add(UnwrapString(arParts[n].Substring(0, indexOf).Trim()), UnwrapString(arParts[n].Substring(indexOf + 1).Trim())); else if (allowNameOnly) ls.Add(UnwrapString(arParts[n].Trim()), String.Empty); else throw new ArgumentException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\", no equal sign found", arParts[n])); } return ls; } /// <summary> /// Parses a connection string using the built-in (i.e. framework provided) /// connection string parser class and returns the key/value pairs. An |
︙ | ︙ | |||
2256 2257 2258 2259 2260 2261 2262 | public void EnableExtensions( bool enable ) { CheckDisposed(); if (_sql == null) | | | 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | public void EnableExtensions( bool enable ) { CheckDisposed(); if (_sql == null) throw new InvalidOperationException(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Database connection not valid for {0} extensions.", enable ? "enabling" : "disabling")); if ((_flags & SQLiteConnectionFlags.NoLoadExtension) == SQLiteConnectionFlags.NoLoadExtension) throw new SQLiteException("Loading extensions is disabled for this database connection."); |
︙ | ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | StringBuilder result = new StringBuilder(); int length = array.Length; for (int index = 0; index < length; index++) #if NET_COMPACT_20 | > > | | 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | StringBuilder result = new StringBuilder(); int length = array.Length; for (int index = 0; index < length; index++) #if NET_COMPACT_20 result.Append(UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, "{0:x2}", array[index])); #else result.AppendFormat("{0:x2}", array[index]); #endif return result.ToString(); } |
︙ | ︙ | |||
2429 2430 2431 2432 2433 2434 2435 | for (int index = 0; index < text.Length; index += 2) { string value = text.Substring(index, 2); if (!TryParseByte(value, NumberStyles.HexNumber, out result[index / 2])) { | | | 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 | for (int index = 0; index < text.Length; index += 2) { string value = text.Substring(index, 2); if (!TryParseByte(value, NumberStyles.HexNumber, out result[index / 2])) { error = UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "string contains \"{0}\", which cannot be converted to a byte value", value); return null; } } |
︙ | ︙ | |||
2585 2586 2587 2588 2589 2590 2591 | #if !NET_COMPACT_20 && TRACE_WARNING bool uri = false; #endif bool fullUri = false; string fileName; if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion) | | | 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 | #if !NET_COMPACT_20 && TRACE_WARNING bool uri = false; #endif bool fullUri = false; string fileName; if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion) throw new NotSupportedException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion)); #if INTEROP_INCLUDE_ZIPVFS bool useZipVfs = false; string zipVfsVersion = FindKey(opts, "ZipVfsVersion", DefaultZipVfsVersion); if (zipVfsVersion != null) { |
︙ | ︙ | |||
2609 2610 2611 2612 2613 2614 2615 | else if (String.Compare(zipVfsVersion, ZipVfs_V3) == 0) { UnsafeNativeMethods.zipvfsInit_v3(0); useZipVfs = true; } else { | | | | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 | else if (String.Compare(zipVfsVersion, ZipVfs_V3) == 0) { UnsafeNativeMethods.zipvfsInit_v3(0); useZipVfs = true; } else { throw new NotSupportedException(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Only ZipVFS versions {0}, {1}, and {2} are supported at this time", ZipVfs_Automatic, ZipVfs_V2, ZipVfs_V3)); } } #endif fileName = FindKey(opts, "Data Source", DefaultDataSource); if (String.IsNullOrEmpty(fileName)) { fileName = FindKey(opts, "Uri", DefaultUri); if (String.IsNullOrEmpty(fileName)) { fileName = FindKey(opts, "FullUri", DefaultFullUri); if (String.IsNullOrEmpty(fileName)) throw new ArgumentException(UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Data Source cannot be empty. Use {0} to open an in-memory database", MemoryFileName)); else fullUri = true; } else { fileName = MapUriPath(fileName); #if !NET_COMPACT_20 && TRACE_WARNING |
︙ | ︙ | |||
2647 2648 2649 2650 2651 2652 2653 | #if !NET_COMPACT_20 && TRACE_WARNING if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { if (!uri && !fullUri && !isMemory && !String.IsNullOrEmpty(fileName) && fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase) && !fileName.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase)) { | | | 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 | #if !NET_COMPACT_20 && TRACE_WARNING if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { if (!uri && !fullUri && !isMemory && !String.IsNullOrEmpty(fileName) && fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase) && !fileName.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase)) { System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Detected a possibly malformed UNC database file name \"{0}\" that " + "may have originally started with two backslashes; however, four leading " + "backslashes may be required, e.g.: \"Data Source=\\\\\\{0};\"", fileName)); } } |
︙ | ︙ | |||
2729 2730 2731 2732 2733 2734 2735 | if (hexPassword != null) { string error = null; byte[] hexPasswordBytes = FromHexString(hexPassword, ref error); if (hexPasswordBytes == null) { | | | 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | if (hexPassword != null) { string error = null; byte[] hexPasswordBytes = FromHexString(hexPassword, ref error); if (hexPasswordBytes == null) { throw new FormatException(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Cannot parse 'HexPassword' property value into byte values: {0}", error)); } _sql.SetPassword(hexPasswordBytes); } |
︙ | ︙ | |||
2773 2774 2775 2776 2777 2778 2779 | if (boolValue) { using (SQLiteCommand cmd = CreateCommand()) { if (_busyTimeout != DefaultBusyTimeout) { | | | | | | | | | | | 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 | if (boolValue) { using (SQLiteCommand cmd = CreateCommand()) { if (_busyTimeout != DefaultBusyTimeout) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA busy_timeout={0}", _busyTimeout); cmd.ExecuteNonQuery(); } int intValue; if (!fullUri && !isMemory) { strValue = FindKey(opts, "Page Size", DefaultPageSize.ToString()); intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture); if (intValue != DefaultPageSize) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", intValue); cmd.ExecuteNonQuery(); } } strValue = FindKey(opts, "Max Page Count", DefaultMaxPageCount.ToString()); intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture); if (intValue != DefaultMaxPageCount) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", intValue); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Legacy Format", DefaultLegacyFormat.ToString()); boolValue = SQLiteConvert.ToBoolean(strValue); if (boolValue != DefaultLegacyFormat) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", boolValue ? "ON" : "OFF"); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Synchronous", DefaultSynchronous.ToString()); enumValue = TryParseEnum(typeof(SQLiteSynchronousEnum), strValue, true); if (!(enumValue is SQLiteSynchronousEnum) || ((SQLiteSynchronousEnum)enumValue != DefaultSynchronous)) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", strValue); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Cache Size", DefaultCacheSize.ToString()); intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture); if (intValue != DefaultCacheSize) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", intValue); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Journal Mode", DefaultJournalMode.ToString()); enumValue = TryParseEnum(typeof(SQLiteJournalModeEnum), strValue, true); if (!(enumValue is SQLiteJournalModeEnum) || ((SQLiteJournalModeEnum)enumValue != DefaultJournalMode)) { string pragmaStr = "PRAGMA journal_mode={0}"; #if INTEROP_INCLUDE_ZIPVFS if (useZipVfs) pragmaStr = "PRAGMA zipvfs_journal_mode={0}"; #endif cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, pragmaStr, strValue); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Foreign Keys", DefaultForeignKeys.ToString()); boolValue = SQLiteConvert.ToBoolean(strValue); if (boolValue != DefaultForeignKeys) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", boolValue ? "ON" : "OFF"); cmd.ExecuteNonQuery(); } strValue = FindKey(opts, "Recursive Triggers", DefaultRecursiveTriggers.ToString()); boolValue = SQLiteConvert.ToBoolean(strValue); if (boolValue != DefaultRecursiveTriggers) { cmd.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA recursive_triggers={0}", boolValue ? "ON" : "OFF"); cmd.ExecuteNonQuery(); } } } if (_progressHandler != null) _sql.SetProgressHook(_progressOps, _progressCallback); |
︙ | ︙ | |||
3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 | /// The size of the largest committed free block in the heap, in bytes. /// This value will be zero unless heap compaction is enabled. /// </param> /// <returns> /// A standard SQLite return code (i.e. zero for success and non-zero /// for failure). /// </returns> public static SQLiteErrorCode ReleaseMemory( int nBytes, bool reset, bool compact, ref int nFree, ref bool resetOk, ref uint nLargest ) { return SQLite3.StaticReleaseMemory( nBytes, reset, compact, ref nFree, ref resetOk, ref nLargest); } /// <summary> /// Sets the status of the memory usage tracking subsystem in the SQLite core library. By default, this is enabled. /// If this is disabled, memory usage tracking will not be performed. This is not really a per-connection value, it is /// global to the process. /// </summary> /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param> | > > | 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 | /// The size of the largest committed free block in the heap, in bytes. /// This value will be zero unless heap compaction is enabled. /// </param> /// <returns> /// A standard SQLite return code (i.e. zero for success and non-zero /// for failure). /// </returns> #pragma warning disable 3001 public static SQLiteErrorCode ReleaseMemory( int nBytes, bool reset, bool compact, ref int nFree, ref bool resetOk, ref uint nLargest ) { return SQLite3.StaticReleaseMemory( nBytes, reset, compact, ref nFree, ref resetOk, ref nLargest); } #pragma warning restore 3001 /// <summary> /// Sets the status of the memory usage tracking subsystem in the SQLite core library. By default, this is enabled. /// If this is disabled, memory usage tracking will not be performed. This is not really a per-connection value, it is /// global to the process. /// </summary> /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param> |
︙ | ︙ | |||
3384 3385 3386 3387 3388 3389 3390 | { if (sourceId == null) sourceId = "0000000000000000000000000000000000000000"; if (sourceTimeStamp == null) sourceTimeStamp = "0000-00-00 00:00:00 UTC"; | > > | | 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 | { if (sourceId == null) sourceId = "0000000000000000000000000000000000000000"; if (sourceTimeStamp == null) sourceTimeStamp = "0000-00-00 00:00:00 UTC"; return UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, "{0} {1}", sourceId, sourceTimeStamp); } else { return null; } } } |
︙ | ︙ | |||
3458 3459 3460 3461 3462 3463 3464 | throw new InvalidOperationException("Database connection not valid for shutdown."); _sql.Close(true); /* NOTE: MUST be closed before shutdown. */ SQLiteErrorCode rc = _sql.Shutdown(); #if !NET_COMPACT_20 && TRACE_CONNECTION if (rc != SQLiteErrorCode.Ok) | | | 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 | throw new InvalidOperationException("Database connection not valid for shutdown."); _sql.Close(true); /* NOTE: MUST be closed before shutdown. */ SQLiteErrorCode rc = _sql.Shutdown(); #if !NET_COMPACT_20 && TRACE_CONNECTION if (rc != SQLiteErrorCode.Ok) System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Shutdown (Instance) Failed: {0}", rc)); #endif return rc; } |
︙ | ︙ | |||
3488 3489 3490 3491 3492 3493 3494 | ) { SQLiteErrorCode rc = SQLite3.StaticShutdown(directories); if (rc != SQLiteErrorCode.Ok) { #if !NET_COMPACT_20 && TRACE_CONNECTION | | | 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 | ) { SQLiteErrorCode rc = SQLite3.StaticShutdown(directories); if (rc != SQLiteErrorCode.Ok) { #if !NET_COMPACT_20 && TRACE_CONNECTION System.Diagnostics.Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Shutdown (Static) Failed: {0}", rc)); #endif if (!noThrow) throw new SQLiteException(rc, null); } |
︙ | ︙ | |||
4072 4073 4074 4075 4076 4077 4078 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; | | | | 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this)) using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) { while (rdTables.Read()) { if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) { try { using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this)) using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly)) using (DataTable tblSchema = rd.GetSchemaTable(true, true)) { foreach (DataRow schemaRow in tblSchema.Rows) { if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0 || strColumn == null) |
︙ | ︙ | |||
4175 4176 4177 4178 4179 4180 4181 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; | | | | 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) { while (rdTables.Read()) { maybeRowId = false; primaryKeys.Clear(); if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) { // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns. // Such indexes are not listed in the indexes list but count as indexes just the same. try { using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) { while (rdTable.Read()) { if (rdTable.GetInt32(5) != 0) { primaryKeys.Add(rdTable.GetInt32(0)); |
︙ | ︙ | |||
4215 4216 4217 4218 4219 4220 4221 | { row = tbl.NewRow(); row["TABLE_CATALOG"] = strCatalog; row["TABLE_NAME"] = rdTables.GetString(2); row["INDEX_CATALOG"] = strCatalog; row["PRIMARY_KEY"] = true; | | | | | | 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 | { row = tbl.NewRow(); row["TABLE_CATALOG"] = strCatalog; row["TABLE_NAME"] = rdTables.GetString(2); row["INDEX_CATALOG"] = strCatalog; row["PRIMARY_KEY"] = true; row["INDEX_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); row["UNIQUE"] = true; if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0 || strIndex == null) { tbl.Rows.Add(row); } primaryKeys.Clear(); } // Now fetch all the rest of the indexes. try { using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this)) using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) { while (rd.Read()) { if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0 || strIndex == null) { row = tbl.NewRow(); row["TABLE_CATALOG"] = strCatalog; row["TABLE_NAME"] = rdTables.GetString(2); row["INDEX_CATALOG"] = strCatalog; row["INDEX_NAME"] = rd.GetString(1); row["UNIQUE"] = SQLiteConvert.ToBoolean(rd.GetValue(2), CultureInfo.InvariantCulture, false); row["PRIMARY_KEY"] = false; // get the index definition using (SQLiteCommand cmdIndexes = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this)) using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) { while (rdIndexes.Read()) { if (rdIndexes.IsDBNull(4) == false) row["INDEX_DEFINITION"] = rdIndexes.GetString(4); break; } } // Now for the really hard work. Figure out which index is the primary key index. // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid // primary key, and all the columns in the given index match the primary key columns if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true) { using (SQLiteCommand cmdDetails = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this)) using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader()) { int nMatches = 0; while (rdDetails.Read()) { if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false) { |
︙ | ︙ | |||
4321 4322 4323 4324 4325 4326 4327 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(table)) table = null; if (String.IsNullOrEmpty(catalog)) catalog = "main"; string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; | | | 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(table)) table = null; if (String.IsNullOrEmpty(catalog)) catalog = "main"; string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this)) using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) { while (rd.Read()) { if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0 || triggerName == null) { |
︙ | ︙ | |||
4376 4377 4378 4379 4380 4381 4382 | tbl.Columns.Add("TABLE_DEFINITION", typeof(string)); tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; | | | 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 | tbl.Columns.Add("TABLE_DEFINITION", typeof(string)); tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) { while (rd.Read()) { strItem = rd.GetString(0); if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0) strItem = "SYSTEM_TABLE"; |
︙ | ︙ | |||
4442 4443 4444 4445 4446 4447 4448 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; | | | 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 | tbl.BeginLoadData(); if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; using (SQLiteCommand cmd = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) { while (rd.Read()) { if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0 || String.IsNullOrEmpty(strView)) { |
︙ | ︙ | |||
4591 4592 4593 4594 4595 4596 4597 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); | | | | 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) { while (rdTables.Read()) { maybeRowId = false; primaryKeys.Clear(); if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) { try { using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) { while (rdTable.Read()) { if (rdTable.GetInt32(5) == 1) // is a primary key { primaryKeys.Add(new KeyValuePair<int, string>(rdTable.GetInt32(0), rdTable.GetString(1))); |
︙ | ︙ | |||
4625 4626 4627 4628 4629 4630 4631 | { } // This is a rowid row if (primaryKeys.Count == 1 && maybeRowId == true) { row = tbl.NewRow(); row["CONSTRAINT_CATALOG"] = strCatalog; | | | | | 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 | { } // This is a rowid row if (primaryKeys.Count == 1 && maybeRowId == true) { row = tbl.NewRow(); row["CONSTRAINT_CATALOG"] = strCatalog; row["CONSTRAINT_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); row["TABLE_CATALOG"] = strCatalog; row["TABLE_NAME"] = rdTables.GetString(2); row["COLUMN_NAME"] = primaryKeys[0].Value; row["INDEX_NAME"] = row["CONSTRAINT_NAME"]; row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key; row["COLLATION_NAME"] = "BINARY"; row["SORT_MODE"] = "ASC"; row["CONFLICT_OPTION"] = 2; if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0) tbl.Rows.Add(row); } using (SQLiteCommand cmdIndexes = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this)) using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) { while (rdIndexes.Read()) { int ordinal = 0; if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0) { try { using (SQLiteCommand cmdIndex = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this)) using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader()) { while (rdIndex.Read()) { row = tbl.NewRow(); row["CONSTRAINT_CATALOG"] = strCatalog; row["CONSTRAINT_NAME"] = rdIndexes.GetString(1); |
︙ | ︙ | |||
4749 4750 4751 4752 4753 4754 4755 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); | | | | 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); using (SQLiteCommand cmdViews = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) using (SQLiteDataReader rdViews = cmdViews.ExecuteReader()) { while (rdViews.Read()) { if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) { using (SQLiteCommand cmdViewSelect = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this)) { strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' '); n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase); if (n < 0) continue; strSql = strSql.Substring(n + 4); |
︙ | ︙ | |||
4854 4855 4856 4857 4858 4859 4860 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); | | | | | 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 | if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; tbl.BeginLoadData(); using (SQLiteCommand cmdTables = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) { while (rdTables.Read()) { if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) { try { using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder()) using (SQLiteCommand cmdKey = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this)) using (SQLiteDataReader rdKey = cmdKey.ExecuteReader()) { while (rdKey.Read()) { row = tbl.NewRow(); row["CONSTRAINT_CATALOG"] = strCatalog; row["CONSTRAINT_NAME"] = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables[2], rdKey.GetInt32(0), rdKey.GetInt32(1)); row["TABLE_CATALOG"] = strCatalog; row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2)); row["CONSTRAINT_TYPE"] = "FOREIGN KEY"; row["IS_DEFERRABLE"] = false; row["INITIALLY_DEFERRED"] = false; row["FKEY_ID"] = rdKey[0]; row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString()); |
︙ | ︙ | |||
5025 5026 5027 5028 5029 5030 5031 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Progress\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5078 5079 5080 5081 5082 5083 5084 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Authorize\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5127 5128 5129 5130 5131 5132 5133 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Update\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5218 5219 5220 5221 5222 5223 5224 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Trace\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5280 5281 5282 5283 5284 5285 5286 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Commit\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5322 5323 5324 5325 5326 5327 5328 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Rollback\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 | int totalPages, bool retry ); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// public class ProgressEventArgs : EventArgs { /// <summary> /// The user-defined native data associated with this event. Currently, /// this will always contain the value of <see cref="IntPtr.Zero" />. /// </summary> public readonly IntPtr UserData; | > > > | 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 | int totalPages, bool retry ); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// The event data associated with progress reporting events. /// </summary> public class ProgressEventArgs : EventArgs { /// <summary> /// The user-defined native data associated with this event. Currently, /// this will always contain the value of <see cref="IntPtr.Zero" />. /// </summary> public readonly IntPtr UserData; |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | ︙ | |||
1148 1149 1150 1151 1152 1153 1154 | case TypeCode.Decimal: return ((decimal)obj) != Decimal.Zero ? true : false; case TypeCode.String: return viaFramework ? Convert.ToBoolean(obj, provider) : ToBoolean(ToStringWithProvider(obj, provider)); default: | | | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | case TypeCode.Decimal: return ((decimal)obj) != Decimal.Zero ? true : false; case TypeCode.String: return viaFramework ? Convert.ToBoolean(obj, provider) : ToBoolean(ToStringWithProvider(obj, provider)); default: throw new SQLiteException(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Cannot convert type {0} to boolean", typeCode)); } } /// <summary> |
︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | DbType dbType, SQLiteConnectionFlags flags, string typeName ) { if ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { | | | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | DbType dbType, SQLiteConnectionFlags flags, string typeName ) { if ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning) { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.", typeName, dbType)); } } /// <summary> |
︙ | ︙ | |||
1468 1469 1470 1471 1472 1473 1474 | SQLiteConnectionFlags flags, DbType? dbType ) { if (!String.IsNullOrEmpty(typeName) && ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)) { | | | 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | SQLiteConnectionFlags flags, DbType? dbType ) { if (!String.IsNullOrEmpty(typeName) && ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)) { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".", dbType, typeName)); } } #endif |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteDataAdapter.cs.
︙ | ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteDataAdapter).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { if (disposing) | > > > > > > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteDataAdapter).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Cleans up resources (native and managed) associated with the current instance. /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { if (disposing) |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | } } } if (wantDefaultValue) { // Determine the default value for the column, which sucks because we have to query the schema for each column | | | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | } } } if (wantDefaultValue) { // Determine the default value for the column, which sucks because we have to query the schema for each column using (SQLiteCommand cmdTable = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])", row[SchemaTableOptionalColumn.BaseCatalogName], row[SchemaTableColumn.BaseTableName] ), _command.Connection)) using (DbDataReader rdTable = cmdTable.ExecuteReader()) { // Find the matching column while (rdTable.Read()) |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteEnlistment.cs.
︙ | ︙ | |||
92 93 94 95 96 97 98 | // NOTE: When in "strict" mode, throw an exception if the isolation // level is not recognized; otherwise, fallback to the default // isolation level specified by the caller. // if (throwOnUnsupported) { throw new InvalidOperationException( | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | // NOTE: When in "strict" mode, throw an exception if the isolation // level is not recognized; otherwise, fallback to the default // isolation level specified by the caller. // if (throwOnUnsupported) { throw new InvalidOperationException( UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "unsupported isolation level {0}", isolationLevel)); } return defaultIsolationLevel; } /////////////////////////////////////////////////////////////////////////// |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteException.cs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; using System.Data.Common; #if !PLATFORM_COMPACTFRAMEWORK using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; #endif | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; using System.Data.Common; using System.Globalization; #if !PLATFORM_COMPACTFRAMEWORK using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; #endif |
︙ | ︙ | |||
178 179 180 181 182 183 184 | /// <param name="message">Optional detailed error message.</param> /// <returns>Error message text for the return code.</returns> private static string GetStockErrorMessage( SQLiteErrorCode errorCode, string message ) { | > > | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | /// <param name="message">Optional detailed error message.</param> /// <returns>Error message text for the return code.</returns> private static string GetStockErrorMessage( SQLiteErrorCode errorCode, string message ) { return UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "{0}{1}{2}", GetErrorString(errorCode), #if !NET_COMPACT_20 Environment.NewLine, message).Trim(); #else "\r\n", message).Trim(); #endif } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteFactory.cs.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | // been moved to the new SQLiteLog static class. // } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion | > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | // been moved to the new SQLiteLog static class. // } /////////////////////////////////////////////////////////////////////////////////////////////// #region IDisposable Members /// <summary> /// Cleans up resources (native and managed) associated with the current instance. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } #endregion |
︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteFactory() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// | > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor /// <summary> /// Cleans up resources associated with the current instance. /// </summary> ~SQLiteFactory() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteFunction.cs.
︙ | ︙ | |||
63 64 65 66 67 68 69 | /// </summary> private SQLiteCallback _StepFunc; /// <summary> /// Holds a reference to the callback function for finalizing an aggregate function /// </summary> private SQLiteFinalCallback _FinalFunc; /// <summary> | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /// </summary> private SQLiteCallback _StepFunc; /// <summary> /// Holds a reference to the callback function for finalizing an aggregate function /// </summary> private SQLiteFinalCallback _FinalFunc; /// <summary> /// Holds a reference to the callback function for collating sequences /// </summary> private SQLiteCollation _CompareFunc; private SQLiteCollation _CompareFunc16; /// <summary> /// Current context of the current callback. Only valid during a callback |
︙ | ︙ | |||
197 198 199 200 201 202 203 204 205 206 207 208 209 210 | } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor ~SQLiteFunction() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// | > > > | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | } } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region Destructor /// <summary> /// Cleans up resources associated with the current instance. /// </summary> ~SQLiteFunction() { Dispose(false); } #endregion /////////////////////////////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
273 274 275 276 277 278 279 | public virtual object Final(object contextData) { CheckDisposed(); return null; } /// <summary> | | | | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | public virtual object Final(object contextData) { CheckDisposed(); return null; } /// <summary> /// User-defined collating sequences override this method to provide a custom string sorting algorithm. /// </summary> /// <param name="param1">The first string to compare.</param> /// <param name="param2">The second strnig to compare.</param> /// <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2.</returns> public virtual int Compare(string param1, string param2) { CheckDisposed(); return 0; } /// <summary> |
︙ | ︙ | |||
413 414 415 416 417 418 419 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Invoke\" method: {0}", e)); /* throw */ } } catch { // do nothing. } } } /// <summary> /// Internal collating sequence function, which wraps up the raw string pointers and executes the Compare() virtual function. /// WARNING: Must not throw exceptions. /// </summary> /// <param name="ptr">Not used</param> /// <param name="len1">Length of the string pv1</param> /// <param name="ptr1">Pointer to the first string to compare</param> /// <param name="len2">Length of the string pv2</param> /// <param name="ptr2">Pointer to the second string to compare</param> |
︙ | ︙ | |||
451 452 453 454 455 456 457 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Compare\" (UTF8) method: {0}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
473 474 475 476 477 478 479 | if ((_base != null) && _base.IsOpen()) _base.Cancel(); return 0; } /// <summary> | | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | if ((_base != null) && _base.IsOpen()) _base.Cancel(); return 0; } /// <summary> /// Internal collating sequence function, which wraps up the raw string pointers and executes the Compare() virtual function. /// WARNING: Must not throw exceptions. /// </summary> /// <param name="ptr">Not used</param> /// <param name="len1">Length of the string pv1</param> /// <param name="ptr1">Pointer to the first string to compare</param> /// <param name="len2">Length of the string pv2</param> /// <param name="ptr2">Pointer to the second string to compare</param> |
︙ | ︙ | |||
498 499 500 501 502 503 504 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Compare\" (UTF16) method: {0}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
571 572 573 574 575 576 577 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Step\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
626 627 628 629 630 631 632 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | { try { if ((_flags & SQLiteConnectionFlags.LogCallbackException) == SQLiteConnectionFlags.LogCallbackException) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"Final\" method: {1}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
724 725 726 727 728 729 730 | /// <summary> /// Manual method of registering a function. The type must still have the SQLiteFunctionAttributes in order to work /// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported. /// </summary> /// <param name="typ">The type of the function to register</param> public static void RegisterFunction(Type typ) { | | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /// <summary> /// Manual method of registering a function. The type must still have the SQLiteFunctionAttributes in order to work /// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported. /// </summary> /// <param name="typ">The type of the function to register</param> public static void RegisterFunction(Type typ) { object[] arAtt = typ.GetCustomAttributes( typeof(SQLiteFunctionAttribute), false); for (int y = 0; y < arAtt.Length; y++) { SQLiteFunctionAttribute at = arAtt[y] as SQLiteFunctionAttribute; if (at == null) continue; RegisterFunction( at.Name, at.Arguments, at.FuncType, typ, at.Callback1, at.Callback2); } } /// <summary> /// Alternative method of registering a function. This method /// does not require the specified type to be annotated with /// <see cref="SQLiteFunctionAttribute" />. /// </summary> /// <param name="name"> /// The name of the function to register. /// </param> /// <param name="argumentCount"> /// The number of arguments accepted by the function. /// </param> /// <param name="functionType"> /// The type of SQLite function being resitered (e.g. scalar, /// aggregate, or collating sequence). /// </param> /// <param name="instanceType"> /// The <see cref="Type" /> that actually implements the function. /// This will only be used if the <paramref name="callback1" /> /// and <paramref name="callback2" /> parameters are null. /// </param> /// <param name="callback1"> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="SQLiteFunction.Invoke" />, /// <see cref="SQLiteFunction.Step" />, /// and <see cref="SQLiteFunction.Compare" /> virtual methods. /// </param> /// <param name="callback2"> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="SQLiteFunction.Final" /> virtual method. This /// parameter is only necessary for aggregate functions. /// </param> public static void RegisterFunction( string name, int argumentCount, FunctionType functionType, Type instanceType, Delegate callback1, Delegate callback2 ) { SQLiteFunctionAttribute at = new SQLiteFunctionAttribute( name, argumentCount, functionType); at.InstanceType = instanceType; at.Callback1 = callback1; at.Callback2 = callback2; _registeredFunctions.Add(at, null); } /// <summary> /// Creates a <see cref="SQLiteFunction" /> instance based on the specified /// <see cref="SQLiteFunctionAttribute" />. /// </summary> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute" /> containing the metadata about /// the function to create. /// </param> /// <param name="function"> /// The created function -OR- null if the function could not be created. /// </param> /// <returns> /// Non-zero if the function was created; otherwise, zero. /// </returns> private static bool CreateFunction( SQLiteFunctionAttribute functionAttribute, out SQLiteFunction function ) { if (functionAttribute == null) { function = null; return false; } else if ((functionAttribute.Callback1 != null) || (functionAttribute.Callback2 != null)) { function = new SQLiteDelegateFunction( functionAttribute.Callback1, functionAttribute.Callback2); return true; } else if (functionAttribute.InstanceType != null) { function = (SQLiteFunction)Activator.CreateInstance( functionAttribute.InstanceType); return true; } else { function = null; return false; } } /// <summary> /// Called by the SQLiteBase derived classes, this method binds all registered (known) user-defined functions to a connection. /// It is done this way so that all user-defined functions will access the database using the same encoding scheme /// as the connection (UTF-8 or UTF-16). /// </summary> |
︙ | ︙ | |||
767 768 769 770 771 772 773 | in _registeredFunctions) { SQLiteFunctionAttribute pr = pair.Key; if (pr == null) continue; | | | > | | | > > > > > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | in _registeredFunctions) { SQLiteFunctionAttribute pr = pair.Key; if (pr == null) continue; SQLiteFunction f; if (CreateFunction(pr, out f)) { BindFunction(sqlbase, pr, f, flags); lFunctions[pr] = f; } else { lFunctions[pr] = null; } } return lFunctions; } /// <summary> /// Called by the SQLiteBase derived classes, this method unbinds all registered (known) |
︙ | ︙ | |||
857 858 859 860 861 862 863 | } } return result; } /// <summary> | | | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | } } return result; } /// <summary> /// This function binds a user-defined function to a connection. /// </summary> /// <param name="sqliteBase"> /// The <see cref="SQLiteBase" /> object instance associated with the /// <see cref="SQLiteConnection" /> that the function should be bound to. /// </param> /// <param name="functionAttribute"> /// The <see cref="SQLiteFunctionAttribute"/> object instance containing |
︙ | ︙ | |||
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | { return sqliteBase.CreateCollation( name, null, null, false) == SQLiteErrorCode.Ok; } } } /// <summary> /// Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call. /// </summary> /// <remarks> /// User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays. /// </remarks> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 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 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 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 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 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 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | { return sqliteBase.CreateCollation( name, null, null, false) == SQLiteErrorCode.Ok; } } } ///////////////////////////////////////////////////////////////////////////// /// <summary> /// This <see cref="Delegate" /> type is used with the /// <see cref="SQLiteDelegateFunction.Invoke" /> method. /// </summary> /// <param name="param0"> /// This is always the string literal "Invoke". /// </param> /// <param name="args"> /// The arguments for the scalar function. /// </param> /// <returns> /// The result of the scalar function. /// </returns> public delegate object SQLiteInvokeDelegate( string param0, object[] args ); ///////////////////////////////////////////////////////////////////////////// /// <summary> /// This <see cref="Delegate" /> type is used with the /// <see cref="SQLiteDelegateFunction.Step" /> method. /// </summary> /// <param name="param0"> /// This is always the string literal "Step". /// </param> /// <param name="args"> /// The arguments for the aggregate function. /// </param> /// <param name="stepNumber"> /// The step number (one based). This is incrememted each time the /// <see cref="SQLiteDelegateFunction.Step" /> method is called. /// </param> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> public delegate void SQLiteStepDelegate( string param0, object[] args, int stepNumber, ref object contextData ); ///////////////////////////////////////////////////////////////////////////// /// <summary> /// This <see cref="Delegate" /> type is used with the /// <see cref="SQLiteDelegateFunction.Final" /> method. /// </summary> /// <param name="param0"> /// This is always the string literal "Final". /// </param> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> /// <returns> /// The result of the aggregate function. /// </returns> public delegate object SQLiteFinalDelegate( string param0, object contextData ); ///////////////////////////////////////////////////////////////////////////// /// <summary> /// This <see cref="Delegate" /> type is used with the /// <see cref="SQLiteDelegateFunction.Compare" /> method. /// </summary> /// <param name="param0"> /// This is always the string literal "Compare". /// </param> /// <param name="param1"> /// The first string to compare. /// </param> /// <param name="param2"> /// The second strnig to compare. /// </param> /// <returns> /// A positive integer if the <paramref name="param1" /> parameter is /// greater than the <paramref name="param2" /> parameter, a negative /// integer if the <paramref name="param1" /> parameter is less than /// the <paramref name="param2" /> parameter, or zero if they are /// equal. /// </returns> public delegate int SQLiteCompareDelegate( string param0, string param1, string param2 ); ///////////////////////////////////////////////////////////////////////////// /// <summary> /// This class implements a SQLite function using a <see cref="Delegate" />. /// All the virtual methods of the <see cref="SQLiteFunction" /> class are /// implemented using calls to the <see cref="Delegate.DynamicInvoke" /> /// method. The arguments are presented in the same order they appear in /// the associated <see cref="SQLiteFunction" /> methods with one exception: /// the first argument is the name of the virtual method being implemented. /// </summary> public class SQLiteDelegateFunction : SQLiteFunction { #region Private Constants /// <summary> /// This error message is used by the overridden virtual methods when /// a required <see cref="Delegate" /> property (e.g. /// <see cref="Callback1" /> or <see cref="Callback2" />) has not been /// set. /// </summary> private const string NoCallbackError = "No \"{0}\" callback is set."; ///////////////////////////////////////////////////////////////////////// /// <summary> /// This error message is used by the overridden <see cref="Compare" /> /// method when the result does not have a type of <see cref="Int32" />. /// </summary> private const string ResultInt32Error = "\"{0}\" result must be Int32."; #endregion ///////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an empty instance of this class. /// </summary> public SQLiteDelegateFunction() : this(null, null) { // do nothing. } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Constructs an instance of this class using the specified /// <see cref="Delegate" /> as the <see cref="SQLiteFunction" /> /// implementation. /// </summary> /// <param name="callback1"> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="Invoke" />, <see cref="Step" />, and /// <see cref="Compare" /> virtual methods needed by the /// <see cref="SQLiteFunction" /> base class. /// </param> /// <param name="callback2"> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="Final" /> virtual methods needed by the /// <see cref="SQLiteFunction" /> base class. /// </param> public SQLiteDelegateFunction( Delegate callback1, Delegate callback2 ) { this.callback1 = callback1; this.callback2 = callback2; } #endregion ///////////////////////////////////////////////////////////////////////// #region Protected Methods /// <summary> /// Returns the list of arguments for the <see cref="Invoke" /> method, /// as an <see cref="Array" /> of <see cref="Object" />. The first /// argument is always the literal string "Invoke". /// </summary> /// <param name="args"> /// The original arguments received by the <see cref="Invoke" /> method. /// </param> /// <param name="earlyBound"> /// Non-zero if the returned arguments are going to be used with the /// <see cref="SQLiteInvokeDelegate" /> type; otherwise, zero. /// </param> /// <returns> /// The arguments to pass to the configured <see cref="Delegate" />. /// </returns> protected virtual object[] GetInvokeArgs( object[] args, bool earlyBound ) { object[] newArgs = new object[] { "Invoke", args }; if (!earlyBound) newArgs = new object[] { newArgs }; // WRAP return newArgs; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the list of arguments for the <see cref="Step" /> method, /// as an <see cref="Array" /> of <see cref="Object" />. The first /// argument is always the literal string "Step". /// </summary> /// <param name="args"> /// The original arguments received by the <see cref="Step" /> method. /// </param> /// <param name="stepNumber"> /// The step number (one based). This is incrememted each time the /// <see cref="Step" /> method is called. /// </param> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> /// <param name="earlyBound"> /// Non-zero if the returned arguments are going to be used with the /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero. /// </param> /// <returns> /// The arguments to pass to the configured <see cref="Delegate" />. /// </returns> protected virtual object[] GetStepArgs( object[] args, int stepNumber, object contextData, bool earlyBound ) { object[] newArgs = new object[] { "Step", args, stepNumber, contextData }; if (!earlyBound) newArgs = new object[] { newArgs }; // WRAP return newArgs; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Updates the output arguments for the <see cref="Step" /> method, /// using an <see cref="Array" /> of <see cref="Object" />. The first /// argument is always the literal string "Step". Currently, only the /// <paramref name="contextData" /> parameter is updated. /// </summary> /// <param name="args"> /// The original arguments received by the <see cref="Step" /> method. /// </param> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> /// <param name="earlyBound"> /// Non-zero if the returned arguments are going to be used with the /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero. /// </param> /// <returns> /// The arguments to pass to the configured <see cref="Delegate" />. /// </returns> protected virtual void UpdateStepArgs( object[] args, ref object contextData, bool earlyBound ) { object[] newArgs; if (earlyBound) newArgs = args; else newArgs = args[0] as object[]; if (newArgs == null) return; contextData = newArgs[newArgs.Length - 1]; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the list of arguments for the <see cref="Final" /> method, /// as an <see cref="Array" /> of <see cref="Object" />. The first /// argument is always the literal string "Final". /// </summary> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> /// <param name="earlyBound"> /// Non-zero if the returned arguments are going to be used with the /// <see cref="SQLiteFinalDelegate" /> type; otherwise, zero. /// </param> /// <returns> /// The arguments to pass to the configured <see cref="Delegate" />. /// </returns> protected virtual object[] GetFinalArgs( object contextData, bool earlyBound ) { object[] newArgs = new object[] { "Final", contextData }; if (!earlyBound) newArgs = new object[] { newArgs }; // WRAP return newArgs; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the list of arguments for the <see cref="Compare" /> method, /// as an <see cref="Array" /> of <see cref="Object" />. The first /// argument is always the literal string "Compare". /// </summary> /// <param name="param1"> /// The first string to compare. /// </param> /// <param name="param2"> /// The second strnig to compare. /// </param> /// <param name="earlyBound"> /// Non-zero if the returned arguments are going to be used with the /// <see cref="SQLiteCompareDelegate" /> type; otherwise, zero. /// </param> /// <returns> /// The arguments to pass to the configured <see cref="Delegate" />. /// </returns> protected virtual object[] GetCompareArgs( string param1, string param2, bool earlyBound ) { object[] newArgs = new object[] { "Compare", param1, param2 }; if (!earlyBound) newArgs = new object[] { newArgs }; // WRAP return newArgs; } #endregion ///////////////////////////////////////////////////////////////////////// #region Public Properties private Delegate callback1; /// <summary> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="Invoke" />, <see cref="Step" />, and /// <see cref="Compare" /> virtual methods needed by the /// <see cref="SQLiteFunction" /> base class. /// </summary> public virtual Delegate Callback1 { get { return callback1; } set { callback1 = value; } } ///////////////////////////////////////////////////////////////////////// private Delegate callback2; /// <summary> /// The <see cref="Delegate" /> to be used for all calls into the /// <see cref="Final" /> virtual methods needed by the /// <see cref="SQLiteFunction" /> base class. /// </summary> public virtual Delegate Callback2 { get { return callback2; } set { callback2 = value; } } #endregion ///////////////////////////////////////////////////////////////////////// #region System.Data.SQLite.SQLiteFunction Overrides /// <summary> /// This virtual method is the implementation for scalar functions. /// See the <see cref="SQLiteFunction.Invoke" /> method for more /// details. /// </summary> /// <param name="args"> /// The arguments for the scalar function. /// </param> /// <returns> /// The result of the scalar function. /// </returns> public override object Invoke( object[] args /* in */ ) { if (callback1 == null) { throw new InvalidOperationException( UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, NoCallbackError, "Invoke")); } SQLiteInvokeDelegate invokeDelegate = callback1 as SQLiteInvokeDelegate; if (invokeDelegate != null) { return invokeDelegate.Invoke("Invoke", args); /* throw */ } else { return callback1.DynamicInvoke( GetInvokeArgs(args, false)); /* throw */ } } ///////////////////////////////////////////////////////////////////////// /// <summary> /// This virtual method is part of the implementation for aggregate /// functions. See the <see cref="SQLiteFunction.Step" /> method /// for more details. /// </summary> /// <param name="args"> /// The arguments for the aggregate function. /// </param> /// <param name="stepNumber"> /// The step number (one based). This is incrememted each time the /// <see cref="Step" /> method is called. /// </param> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> public override void Step( object[] args, /* in */ int stepNumber, /* in */ ref object contextData /* in, out */ ) { if (callback1 == null) { throw new InvalidOperationException( UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, NoCallbackError, "Step")); } SQLiteStepDelegate stepDelegate = callback1 as SQLiteStepDelegate; if (stepDelegate != null) { stepDelegate.Invoke( "Step", args, stepNumber, ref contextData); /* throw */ } else { object[] newArgs = GetStepArgs( args, stepNumber, contextData, false); /* IGNORED */ callback1.DynamicInvoke(newArgs); /* throw */ UpdateStepArgs(newArgs, ref contextData, false); } } ///////////////////////////////////////////////////////////////////////// /// <summary> /// This virtual method is part of the implementation for aggregate /// functions. See the <see cref="SQLiteFunction.Final" /> method /// for more details. /// </summary> /// <param name="contextData"> /// A placeholder for implementers to store contextual data pertaining /// to the current context. /// </param> /// <returns> /// The result of the aggregate function. /// </returns> public override object Final( object contextData /* in */ ) { if (callback2 == null) { throw new InvalidOperationException( UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, NoCallbackError, "Final")); } SQLiteFinalDelegate finalDelegate = callback2 as SQLiteFinalDelegate; if (finalDelegate != null) { return finalDelegate.Invoke("Final", contextData); /* throw */ } else { return callback1.DynamicInvoke(GetFinalArgs( contextData, false)); /* throw */ } } ///////////////////////////////////////////////////////////////////////// /// <summary> /// This virtual method is part of the implementation for collating /// sequences. See the <see cref="SQLiteFunction.Compare" /> method /// for more details. /// </summary> /// <param name="param1"> /// The first string to compare. /// </param> /// <param name="param2"> /// The second strnig to compare. /// </param> /// <returns> /// A positive integer if the <paramref name="param1" /> parameter is /// greater than the <paramref name="param2" /> parameter, a negative /// integer if the <paramref name="param1" /> parameter is less than /// the <paramref name="param2" /> parameter, or zero if they are /// equal. /// </returns> public override int Compare( string param1, /* in */ string param2 /* in */ ) { if (callback1 == null) { throw new InvalidOperationException( UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, NoCallbackError, "Compare")); } SQLiteCompareDelegate compareDelegate = callback1 as SQLiteCompareDelegate; if (compareDelegate != null) { return compareDelegate.Invoke( "Compare", param1, param2); /* throw */ } else { object result = callback1.DynamicInvoke(GetCompareArgs( param1, param2, false)); /* throw */ if (result is int) return (int)result; throw new InvalidOperationException( UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, ResultInt32Error, "Compare")); } } #endregion } ///////////////////////////////////////////////////////////////////////////// /// <summary> /// Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call. /// </summary> /// <remarks> /// User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays. /// </remarks> |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteFunctionEx).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) | > > > > > > | 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 | if (disposed) throw new ObjectDisposedException(typeof(SQLiteFunctionEx).Name); #endif } /////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Cleans up resources (native and managed) associated with the current instance. /// </summary> /// <param name="disposing"> /// Zero when being disposed via garbage collection; otherwise, non-zero. /// </param> protected override void Dispose(bool disposing) { try { if (!disposed) { //if (disposing) |
︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 | Scalar = 0, /// <summary> /// Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data. /// Examples include SUM(), COUNT(), AVG(), etc. /// </summary> Aggregate = 1, /// <summary> | | | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | Scalar = 0, /// <summary> /// Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data. /// Examples include SUM(), COUNT(), AVG(), etc. /// </summary> Aggregate = 1, /// <summary> /// Collating sequences are used to sort textual data in a custom manner, and appear in an ORDER BY clause. Typically text in an ORDER BY is /// sorted using a straight case-insensitive comparison function. Custom collating sequences can be used to alter the behavior of text sorting /// in a user-defined manner. /// </summary> Collation = 2, } /// <summary> |
︙ | ︙ | |||
1089 1090 1091 1092 1093 1094 1095 | /// </summary> /// <param name="context">Raw context pointer for the user function</param> #if !PLATFORM_COMPACTFRAMEWORK [UnmanagedFunctionPointer(CallingConvention.Cdecl)] #endif internal delegate void SQLiteFinalCallback(IntPtr context); /// <summary> | | | 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 | /// </summary> /// <param name="context">Raw context pointer for the user function</param> #if !PLATFORM_COMPACTFRAMEWORK [UnmanagedFunctionPointer(CallingConvention.Cdecl)] #endif internal delegate void SQLiteFinalCallback(IntPtr context); /// <summary> /// Internal callback delegate for implementing collating sequences /// </summary> /// <param name="puser">Not used</param> /// <param name="len1">Length of the string pv1</param> /// <param name="pv1">Pointer to the first string to compare</param> /// <param name="len2">Length of the string pv2</param> /// <param name="pv2">Pointer to the second string to compare</param> /// <returns>Returns -1 if the first string is less than the second. 0 if they are equal, or 1 if the first string is greater |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteFunctionAttribute.cs.
1 2 3 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) | | > > | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; /// <summary> /// A simple custom attribute to enable us to easily find user-defined functions in /// the loaded assemblies and initialize them in SQLite as connections are made. /// </summary> [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)] public sealed class SQLiteFunctionAttribute : Attribute { private string _name; private int _argumentCount; private FunctionType _functionType; private Type _instanceType; private Delegate _callback1; private Delegate _callback2; /// <summary> /// Default constructor, initializes the internal variables for the function. /// </summary> public SQLiteFunctionAttribute() : this(null, -1, FunctionType.Scalar) { // do nothing. } /// <summary> /// Constructs an instance of this class. This sets the initial /// <see cref="InstanceType" />, <see cref="Callback1" />, and /// <see cref="Callback2" /> properties to null. /// </summary> /// <param name="name"> /// The name of the function, as seen by the SQLite core library. /// </param> /// <param name="argumentCount"> /// The number of arguments that the function will accept. /// </param> |
︙ | ︙ | |||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 | FunctionType functionType ) { _name = name; _argumentCount = argumentCount; _functionType = functionType; _instanceType = null; } /// <summary> /// The function's name as it will be used in SQLite command text. /// </summary> public string Name { | > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | FunctionType functionType ) { _name = name; _argumentCount = argumentCount; _functionType = functionType; _instanceType = null; _callback1 = null; _callback2 = null; } /// <summary> /// The function's name as it will be used in SQLite command text. /// </summary> public string Name { |
︙ | ︙ | |||
80 81 82 83 84 85 86 | { get { return _functionType; } set { _functionType = value; } } /// <summary> /// The <see cref="System.Type" /> object instance that describes the class | | > > | > > > > > > > > > | > > > > > > > > > > > > > | 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 | { get { return _functionType; } set { _functionType = value; } } /// <summary> /// The <see cref="System.Type" /> object instance that describes the class /// containing the implementation for the associated function. The value of /// this property will not be used if either the <see cref="Callback1" /> or /// <see cref="Callback2" /> property values are set to non-null. /// </summary> internal Type InstanceType { get { return _instanceType; } set { _instanceType = value; } } /// <summary> /// The <see cref="Delegate" /> that refers to the implementation for the /// associated function. If this property value is set to non-null, it will /// be used instead of the <see cref="InstanceType" /> property value. /// </summary> internal Delegate Callback1 { get { return _callback1; } set { _callback1 = value; } } /// <summary> /// The <see cref="Delegate" /> that refers to the implementation for the /// associated function. If this property value is set to non-null, it will /// be used instead of the <see cref="InstanceType" /> property value. /// </summary> internal Delegate Callback2 { get { return _callback2; } set { _callback2 = value; } } } } |
Changes to System.Data.SQLite/SQLiteKeyReader.cs.
︙ | ︙ | |||
54 55 56 57 58 59 60 | { _command = cnn.CreateCommand(); for (int n = 0; n < columns.Length; n++) { columns[n] = builder.QuoteIdentifier(columns[n]); } } | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | { _command = cnn.CreateCommand(); for (int n = 0; n < columns.Length; n++) { columns[n] = builder.QuoteIdentifier(columns[n]); } } _command.CommandText = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table); _command.Parameters.AddWithValue(null, (long)0); } internal bool IsValid { set { |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteLog.cs.
︙ | ︙ | |||
100 101 102 103 104 105 106 | /// <summary> /// The default log event handler. /// </summary> private static SQLiteLogEventHandler _defaultHandler; /////////////////////////////////////////////////////////////////////// | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /// <summary> /// The default log event handler. /// </summary> private static SQLiteLogEventHandler _defaultHandler; /////////////////////////////////////////////////////////////////////// #if !USE_INTEROP_DLL || !INTEROP_LOG /// <summary> /// The log callback passed to native SQLite engine. This must live /// as long as the SQLite library has a pointer to it. /// </summary> private static SQLiteLogCallback _callback; /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
174 175 176 177 178 179 180 | if (_domainUnload == null) { _domainUnload = new EventHandler(DomainUnload); AppDomain.CurrentDomain.DomainUnload += _domainUnload; } #endif | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | if (_domainUnload == null) { _domainUnload = new EventHandler(DomainUnload); AppDomain.CurrentDomain.DomainUnload += _domainUnload; } #endif #if !USE_INTEROP_DLL || !INTEROP_LOG // // NOTE: Create an instance of the SQLite wrapper class. // if (_sql == null) { _sql = new SQLite3( SQLiteDateFormats.Default, DateTimeKind.Unspecified, |
︙ | ︙ | |||
241 242 243 244 245 246 247 | // // NOTE: Disable logging. If necessary, it can be re-enabled // later by the Initialize method. // _enabled = false; | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | // // NOTE: Disable logging. If necessary, it can be re-enabled // later by the Initialize method. // _enabled = false; #if !USE_INTEROP_DLL || !INTEROP_LOG // // BUGBUG: This will cause serious problems if other AppDomains // have any open SQLite connections; however, there is // currently no way around this limitation. // if (_sql != null) { |
︙ | ︙ | |||
555 556 557 558 559 560 561 | { type = "trace"; } if ((errorCode != null) && !Object.ReferenceEquals(errorCode, String.Empty)) { | | | | 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | { type = "trace"; } if ((errorCode != null) && !Object.ReferenceEquals(errorCode, String.Empty)) { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "SQLite {0} ({1}): {2}", type, errorCode, message)); } else { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "SQLite {0}: {1}", type, message)); } #endif } } } |
Changes to System.Data.SQLite/SQLiteModule.cs.
︙ | ︙ | |||
6163 6164 6165 6166 6167 6168 6169 | // try { if (LogExceptionsNoThrow) { /* throw */ SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | > | | 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 | // try { if (LogExceptionsNoThrow) { /* throw */ SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Caught exception in \"{0}\" method: {1}", destroy ? "xDestroy" : "xDisconnect", e)); } } catch { // do nothing. |
︙ | ︙ | |||
6222 6223 6224 6225 6226 6227 6228 | ) { try { if (logErrors) { SQLiteLog.LogMessage(SQLiteErrorCode.Error, | > | | 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 | ) { try { if (logErrors) { SQLiteLog.LogMessage(SQLiteErrorCode.Error, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Virtual table error: {0}", error)); /* throw */ } } catch { // do nothing. } |
︙ | ︙ | |||
6269 6270 6271 6272 6273 6274 6275 | catch (Exception e) /* NOTE: Must catch ALL. */ { try { if (logExceptions) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | > | | 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 | catch (Exception e) /* NOTE: Must catch ALL. */ { try { if (logExceptions) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Caught exception in \"SetTableError\" method: {0}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ | |||
6670 6671 6672 6673 6674 6675 6676 | if ((tables != null) && tables.TryGetValue(pVtab, out table)) { return table; } | | | 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 | if ((tables != null) && tables.TryGetValue(pVtab, out table)) { return table; } SetTableError(pVtab, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "managed table for {0} not found", pVtab)); return null; } /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
6764 6765 6766 6767 6768 6769 6770 | if ((cursors != null) && cursors.TryGetValue(pCursor, out cursor)) { return cursor; } | | | 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 | if ((cursors != null) && cursors.TryGetValue(pCursor, out cursor)) { return cursor; } SetTableError(pVtab, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "managed cursor for {0} not found", pCursor)); return null; } /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
6850 6851 6852 6853 6854 6855 6856 | /// </returns> protected virtual string GetFunctionKey( int argumentCount, string name, SQLiteFunction function ) { | > > | | 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 | /// </returns> protected virtual string GetFunctionKey( int argumentCount, string name, SQLiteFunction function ) { return UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, "{0}:{1}", argumentCount, name); } #endregion /////////////////////////////////////////////////////////////////////// #region Table Declaration Helper Methods /// <summary> |
︙ | ︙ | |||
8675 8676 8677 8678 8679 8680 8681 | catch (Exception e) { try { if (LogExceptionsNoThrow) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, | > | | 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 | catch (Exception e) { try { if (LogExceptionsNoThrow) { SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Caught exception in \"Dispose\" method: {0}", e)); /* throw */ } } catch { // do nothing. |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteModuleCommon.cs.
︙ | ︙ | |||
19 20 21 22 23 24 25 | public class SQLiteModuleCommon : SQLiteModuleNoop /* NOT SEALED */ { #region Private Constants /// <summary> /// The CREATE TABLE statement used to declare the schema for the /// virtual table. /// </summary> | | > | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | public class SQLiteModuleCommon : SQLiteModuleNoop /* NOT SEALED */ { #region Private Constants /// <summary> /// The CREATE TABLE statement used to declare the schema for the /// virtual table. /// </summary> private static readonly string declareSql = UnsafeNativeMethods.StringFormat( CultureInfo.InvariantCulture, "CREATE TABLE {0}(x);", typeof(SQLiteModuleCommon).Name); #endregion /////////////////////////////////////////////////////////////////////// #region Private Data /// <summary> /// Non-zero if different object instances with the same value should |
︙ | ︙ | |||
114 115 116 117 118 119 120 | protected virtual SQLiteErrorCode CursorTypeMismatchError( SQLiteVirtualTableCursor cursor, Type type ) { if (type != null) { | | | > | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | protected virtual SQLiteErrorCode CursorTypeMismatchError( SQLiteVirtualTableCursor cursor, Type type ) { if (type != null) { SetCursorError(cursor, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "not a \"{0}\" cursor", type)); } else { SetCursorError(cursor, "cursor type mismatch"); } return SQLiteErrorCode.Error; |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteModuleEnumerable.cs.
︙ | ︙ | |||
499 500 501 502 503 504 505 | SQLiteIndex index ) { CheckDisposed(); if (!table.BestIndex(index)) { | > | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | SQLiteIndex index ) { CheckDisposed(); if (!table.BestIndex(index)) { SetTableError(table, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "failed to select best index for virtual table \"{0}\"", table.TableName)); return SQLiteErrorCode.Error; } return SQLiteErrorCode.Ok; |
︙ | ︙ | |||
826 827 828 829 830 831 832 | SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); | > | | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); SetTableError(table, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "virtual table \"{0}\" is read-only", table.TableName)); return SQLiteErrorCode.Error; } /////////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
855 856 857 858 859 860 861 | string newName ) { CheckDisposed(); if (!table.Rename(newName)) { | > | | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | string newName ) { CheckDisposed(); if (!table.Rename(newName)) { SetTableError(table, UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "failed to rename virtual table from \"{0}\" to \"{1}\"", table.TableName, newName)); return SQLiteErrorCode.Error; } return SQLiteErrorCode.Ok; |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteParameterCollection.cs.
︙ | ︙ | |||
423 424 425 426 427 428 429 | foreach(SQLiteParameter p in _parameterList) { y ++; s = p.ParameterName; if (s == null) { | | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | foreach(SQLiteParameter p in _parameterList) { y ++; s = p.ParameterName; if (s == null) { s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nUnnamed); nUnnamed++; } int x; bool isMapped = false; if (activeStatement == null) |
︙ | ︙ | |||
452 453 454 455 456 457 458 | stmt = null; } // If the parameter has a name, but the SQL statement uses unnamed references, this can happen -- attempt to map // the parameter by its index in the collection if (isMapped == false) { | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | stmt = null; } // If the parameter has a name, but the SQL statement uses unnamed references, this can happen -- attempt to map // the parameter by its index in the collection if (isMapped == false) { s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", y); stmt = activeStatement; for (n = 0; n < x; n++) { if (stmt == null) stmt = _command._statementList[n]; if (stmt._paramNames != null) { |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteStatement.cs.
1 2 3 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) | | | 1 2 3 4 5 6 7 8 9 10 11 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; using System.Globalization; |
︙ | ︙ | |||
81 82 83 84 85 86 87 | _paramValues = new SQLiteParameter[n]; for (x = 0; x < n; x++) { s = _sql.Bind_ParamName(this, _flags, x + 1); if (String.IsNullOrEmpty(s)) { | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | _paramValues = new SQLiteParameter[n]; for (x = 0; x < n; x++) { s = _sql.Bind_ParamName(this, _flags, x + 1); if (String.IsNullOrEmpty(s)) { s = UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nCmdStart); nCmdStart++; _unnamedParameters++; } _paramNames[x] = s; _paramValues[x] = null; } } |
︙ | ︙ | |||
200 201 202 203 204 205 206 | /// this statement, and if so, keeps a reference to the parameter so it can be bound later. /// </summary> /// <param name="s">The parameter name to map</param> /// <param name="p">The parameter to assign it</param> internal bool MapParameter(string s, SQLiteParameter p) { if (_paramNames == null) return false; | | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /// this statement, and if so, keeps a reference to the parameter so it can be bound later. /// </summary> /// <param name="s">The parameter name to map</param> /// <param name="p">The parameter to assign it</param> internal bool MapParameter(string s, SQLiteParameter p) { if (_paramNames == null) return false; int startAt = 0; if (s.Length > 0) { if (":$@;".IndexOf(s[0]) == -1) startAt = 1; } |
︙ | ︙ | |||
254 255 256 257 258 259 260 | if ((obj != null) && (objType == DbType.Object)) objType = SQLiteConvert.TypeToDbType(obj.GetType()); if ((_flags & SQLiteConnectionFlags.LogPreBind) == SQLiteConnectionFlags.LogPreBind) { IntPtr handle = _sqlite_stmt; | | > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | if ((obj != null) && (objType == DbType.Object)) objType = SQLiteConvert.TypeToDbType(obj.GetType()); if ((_flags & SQLiteConnectionFlags.LogPreBind) == SQLiteConnectionFlags.LogPreBind) { IntPtr handle = _sqlite_stmt; SQLiteLog.LogMessage(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "Binding statement {0} paramter #{1} with database type {2} and raw value {{{3}}}...", handle, index, objType, obj)); } if ((obj == null) || Convert.IsDBNull(obj)) { _sql.Bind_Null(this, _flags, index); |
︙ | ︙ |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
︙ | ︙ | |||
117 118 119 120 121 122 123 124 125 126 127 128 129 130 | /// <summary> /// For now, this method simply calls the Initialize method. /// </summary> static UnsafeNativeMethods() { Initialize(); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to initialize this class by pre-loading the native SQLite /// library for the processor architecture of the current process. /// </summary> internal static void Initialize() | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /// <summary> /// For now, this method simply calls the Initialize method. /// </summary> static UnsafeNativeMethods() { Initialize(); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// This type is only present when running on Mono. /// </summary> private static readonly string MonoRuntimeType = "Mono.Runtime"; /// <summary> /// Keeps track of whether we are running on Mono. Initially null, it is /// set by the <see cref="IsMono" /> method on its first call. Later, it /// is returned verbatim by the <see cref="IsMono" /> method. /// </summary> private static bool? isMono = null; /// <summary> /// Determines whether or not this assembly is running on Mono. /// </summary> /// <returns> /// Non-zero if this assembly is running on Mono. /// </returns> private static bool IsMono() { try { lock (staticSyncRoot) { if (isMono == null) isMono = (Type.GetType(MonoRuntimeType) != null); return (bool)isMono; } } catch { // do nothing. } return false; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// This is a wrapper around the /// <see cref="String.Format(IFormatProvider,String,Object[])" /> method. /// On Mono, it has to call the method overload without the /// <see cref="IFormatProvider" /> parameter, due to a bug in Mono. /// </summary> /// <param name="provider"> /// This is used for culture-specific formatting. /// </param> /// <param name="format"> /// The format string. /// </param> /// <param name="args"> /// An array the objects to format. /// </param> /// <returns> /// The resulting string. /// </returns> internal static string StringFormat( IFormatProvider provider, string format, params object[] args ) { if (IsMono()) return String.Format(format, args); else return String.Format(provider, format, args); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to initialize this class by pre-loading the native SQLite /// library for the processor architecture of the current process. /// </summary> internal static void Initialize() |
︙ | ︙ | |||
297 298 299 300 301 302 303 | #if !PLATFORM_COMPACTFRAMEWORK bool expand = true; if (Environment.GetEnvironmentVariable("No_Expand") != null) { expand = false; } | | > | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | #if !PLATFORM_COMPACTFRAMEWORK bool expand = true; if (Environment.GetEnvironmentVariable("No_Expand") != null) { expand = false; } else if (Environment.GetEnvironmentVariable(StringFormat( CultureInfo.InvariantCulture, "No_Expand_{0}", name)) != null) { expand = false; } value = Environment.GetEnvironmentVariable(name); if (expand && !String.IsNullOrEmpty(value)) |
︙ | ︙ | |||
323 324 325 326 327 328 329 | if (fileName == null) return @default; XmlDocument document = new XmlDocument(); document.Load(fileName); | | > | 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | if (fileName == null) return @default; XmlDocument document = new XmlDocument(); document.Load(fileName); XmlElement element = document.SelectSingleNode(StringFormat( CultureInfo.InvariantCulture, "/configuration/appSettings/add[@key='{0}']", name)) as XmlElement; if (element != null) { if (element.HasAttribute("value")) value = element.GetAttribute("value"); |
︙ | ︙ | |||
350 351 352 353 354 355 356 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader failed to get setting " + "\"{0}\" value: {1}", name, e)); /* throw */ } catch { // do nothing. |
︙ | ︙ | |||
466 467 468 469 470 471 472 | directory, XmlConfigFileName); if (File.Exists(xmlConfigFileName)) { #if !NET_COMPACT_20 && TRACE_DETECTION try { | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | directory, XmlConfigFileName); if (File.Exists(xmlConfigFileName)) { #if !NET_COMPACT_20 && TRACE_DETECTION try { Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader found XML configuration file " + "via code base for currently executing assembly: \"{0}\"", xmlConfigFileName)); /* throw */ } catch { |
︙ | ︙ | |||
489 490 491 492 493 494 495 | List<string> matches = null; if (CheckForArchitecturesAndPlatforms(directory, ref matches) > 0) { #if !NET_COMPACT_20 && TRACE_DETECTION try { | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | List<string> matches = null; if (CheckForArchitecturesAndPlatforms(directory, ref matches) > 0) { #if !NET_COMPACT_20 && TRACE_DETECTION try { Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader found native sub-directories " + "via code base for currently executing assembly: \"{0}\"", ListToString(matches))); /* throw */ } catch { |
︙ | ︙ | |||
516 517 518 519 520 521 522 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { | | | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader failed to check code base " + "for currently executing assembly: {0}", e)); /* throw */ } catch { // do nothing. |
︙ | ︙ | |||
583 584 585 586 587 588 589 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | #else catch (Exception) #endif { #if !NET_COMPACT_20 && TRACE_SHARED try { Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader failed to get directory " + "for currently executing assembly: {0}", e)); /* throw */ } catch { // do nothing. |
︙ | ︙ | |||
953 954 955 956 957 958 959 | #if !NET_COMPACT_20 && TRACE_DETECTION try { // // NOTE: Show that we hit a fairly unusual situation (i.e. // the "wrong" processor architecture was detected). // | | | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | #if !NET_COMPACT_20 && TRACE_DETECTION try { // // NOTE: Show that we hit a fairly unusual situation (i.e. // the "wrong" processor architecture was detected). // Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader detected {0}-bit pointer " + "size with processor architecture \"{1}\", using " + "processor architecture \"{2}\" instead...", IntPtr.Size * 8 /* bits */, savedProcessorArchitecture, processorArchitecture)); /* throw */ } |
︙ | ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | #if !NET_COMPACT_20 && TRACE_PRELOAD try { // // NOTE: Show exactly where we are trying to load the native // SQLite library from. // | | | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | #if !NET_COMPACT_20 && TRACE_PRELOAD try { // // NOTE: Show exactly where we are trying to load the native // SQLite library from. // Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader is trying to load native " + "SQLite library \"{0}\"...", fileName)); /* throw */ } catch { // do nothing. |
︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 | int lastError = Marshal.GetLastWin32Error(); /* throw */ // // NOTE: Show where we failed to load the native SQLite // library from along with the Win32 error code and // exception information. // | | | 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | int lastError = Marshal.GetLastWin32Error(); /* throw */ // // NOTE: Show where we failed to load the native SQLite // library from along with the Win32 error code and // exception information. // Trace.WriteLine(StringFormat( CultureInfo.CurrentCulture, "Native library pre-loader failed to load native " + "SQLite library \"{0}\" (getLastError = {1}): {2}", fileName, lastError, e)); /* throw */ } catch { |
︙ | ︙ | |||
2952 2953 2954 2955 2956 2957 2958 | if (localHandle != IntPtr.Zero) SQLiteBase.CloseConnection(this, localHandle); #endif #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 | if (localHandle != IntPtr.Zero) SQLiteBase.CloseConnection(this, localHandle); #endif #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "CloseConnection: {0}", localHandle)); /* throw */ } catch { } #endif |
︙ | ︙ | |||
2987 2988 2989 2990 2991 2992 2993 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "CloseConnection: {0}, exception: {1}", handle, e)); /* throw */ } catch { } |
︙ | ︙ | |||
3140 3141 3142 3143 3144 3145 3146 | if (localHandle != IntPtr.Zero) SQLiteBase.FinalizeStatement(cnn, localHandle); #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 | if (localHandle != IntPtr.Zero) SQLiteBase.FinalizeStatement(cnn, localHandle); #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "FinalizeStatement: {0}", localHandle)); /* throw */ } catch { } #endif |
︙ | ︙ | |||
3175 3176 3177 3178 3179 3180 3181 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "FinalizeStatement: {0}, exception: {1}", handle, e)); /* throw */ } catch { } |
︙ | ︙ | |||
3313 3314 3315 3316 3317 3318 3319 | if (localHandle != IntPtr.Zero) SQLiteBase.FinishBackup(cnn, localHandle); #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | if (localHandle != IntPtr.Zero) SQLiteBase.FinishBackup(cnn, localHandle); #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "FinishBackup: {0}", localHandle)); /* throw */ } catch { } #endif |
︙ | ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { | | | 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 | #else catch (SQLiteException) #endif { #if !NET_COMPACT_20 && TRACE_HANDLE try { Trace.WriteLine(UnsafeNativeMethods.StringFormat( CultureInfo.CurrentCulture, "FinishBackup: {0}, exception: {1}", handle, e)); /* throw */ } catch { } |
︙ | ︙ |
Changes to Targets/SQLite.NET.targets.
︙ | ︙ | |||
114 115 116 117 118 119 120 | <Copy SourceFiles="$(TargetPath).config" DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config" Condition="Exists('$(TargetPath).config')" /> <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe')" | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | <Copy SourceFiles="$(TargetPath).config" DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config" Condition="Exists('$(TargetPath).config')" /> <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe')" Command=""$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe" "$(TargetDir)$(TargetName)32$(TargetExt)" /32BIT+ /Force 1>NUL" /> <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And Exists('$(DirForCloneAndMark32BitOnly)bin\sn.exe')" Command=""$(DirForCloneAndMark32BitOnly)bin\sn.exe" -Ra "$(TargetDir)$(TargetName)32$(TargetExt)" "$(AssemblyOriginatorKeyFile)"" /> <Touch Condition="'$(DirForCloneAndMark32BitOnly)' != '' And |
︙ | ︙ | |||
147 148 149 150 151 152 153 | <Copy SourceFiles="$(TargetPath).config" DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config" Condition="Exists('$(TargetPath).config')" /> <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')" | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | <Copy SourceFiles="$(TargetPath).config" DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config" Condition="Exists('$(TargetPath).config')" /> <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')" Command=""$(TargetFrameworkSDKToolsDirectory)CorFlags.exe" "$(TargetDir)$(TargetName)32$(TargetExt)" /32BIT+ /Force 1>NUL" /> <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')" Command=""$(TargetFrameworkSDKToolsDirectory)sn.exe" -Ra "$(TargetDir)$(TargetName)32$(TargetExt)" "$(AssemblyOriginatorKeyFile)"" /> <Touch Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And |
︙ | ︙ |
Changes to Tests/authorizer.eagle.
︙ | ︙ | |||
120 121 122 123 124 125 126 | set filter $name; set data [list] set code [catch {sql execute $db $value} result] set result [lindex [split [string map [list \r\n \n] $result] \n] 0] lappend results [list $name $data $code $result] } lappend results [isTableInDb tDeny] | > | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | set filter $name; set data [list] set code [catch {sql execute $db $value} result] set result [lindex [split [string map [list \r\n \n] $result] \n] 0] lappend results [list $name $data $code $result] } lappend results [isTableInDb tDeny] string map \ [list "SQLiteException (0x80004005):" "SQLiteException:"] $results } -cleanup { catch {object invoke $connection remove_Authorize $callback} catch {object removecallback $callback} cleanupDb $fileName freeDbConnection |
︙ | ︙ | |||
157 158 159 160 161 162 163 | {{0 DropIndex i1 t1 main {}}} 0 0} {Recursive {{0 Recursive {} {} {} {}}} 0 -1}\ {DropTable {{0 DropTable t1 {} main {}}} 0 0} {Transaction {{0 Transaction\ BEGIN {} {} {}} {0 Transaction COMMIT {} {} {}}} 0 -1} {Savepoint {{0 Savepoint\ BEGIN s1 {} {}} {0 Savepoint RELEASE s1 {} {}}} 0 -1} {Attach {{0 Attach\ :memory: {} {} {}}} 0 -1} {Detach {{0 Detach d1 {} {} {}}} 0 -1} {CreateVtable\ {{0 CreateVtable t3 fts4 main {}}} 0 0} {DropVtable {{0 DropVtable t3 fts4 main\ {}}} 0 0} {CreateTable {{0 CreateTable tDeny {} main {}}} 1\ | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 | {{0 DropIndex i1 t1 main {}}} 0 0} {Recursive {{0 Recursive {} {} {} {}}} 0 -1}\ {DropTable {{0 DropTable t1 {} main {}}} 0 0} {Transaction {{0 Transaction\ BEGIN {} {} {}} {0 Transaction COMMIT {} {} {}}} 0 -1} {Savepoint {{0 Savepoint\ BEGIN s1 {} {}} {0 Savepoint RELEASE s1 {} {}}} 0 -1} {Attach {{0 Attach\ :memory: {} {} {}}} 0 -1} {Detach {{0 Detach d1 {} {} {}}} 0 -1} {CreateVtable\ {{0 CreateVtable t3 fts4 main {}}} 0 0} {DropVtable {{0 DropVtable t3 fts4 main\ {}}} 0 0} {CreateTable {{0 CreateTable tDeny {} main {}}} 1\ {System.Data.SQLite.SQLiteException: authorization denied}} False}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/basic.eagle.
︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | BuildTempSchema $connection } -cleanup { cleanupDb $fileName freeDbConnection unset -nocomplain providerServices connection db fileName | | | 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 | BuildTempSchema $connection } -cleanup { cleanupDb $fileName freeDbConnection unset -nocomplain providerServices connection db fileName } -constraints {eagle monoToDo command.object SQLite System.Data.SQLite\ System.Data.SQLite.Linq} -result {}} ############################################################################### runTest {test data-1.30 {EF6 ISQLiteSchemaExtensions.BuildTempSchema} -setup { setupDb [set fileName data-1.30.db] } -body { |
︙ | ︙ | |||
1592 1593 1594 1595 1596 1597 1598 | BuildTempSchema $connection } -cleanup { cleanupDb $fileName freeDbConnection unset -nocomplain providerServices connection db fileName | | | 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | BuildTempSchema $connection } -cleanup { cleanupDb $fileName freeDbConnection unset -nocomplain providerServices connection db fileName } -constraints {eagle monoToDo command.object SQLite System.Data.SQLite\ System.Data.SQLite.EF6} -result {}} ############################################################################### runTest {test data-1.31 {VARCHAR / NVARCHAR types with spaces} -body { list [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \ TypeNameToDbType null VARCHAR None] \ |
︙ | ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | "SELECT replicate('1234', 4);"} output] $output set result } -cleanup { cleanupDb $fileName unset -nocomplain output result db fileName | | | > | | | 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 | "SELECT replicate('1234', 4);"} output] $output set result } -cleanup { cleanupDb $fileName unset -nocomplain output result db fileName } -constraints {eagle monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite SQLiteInterop\ defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS} -match regexp \ -result {^0 12341234 1 \{System\.Data\.SQLite\.SQLiteException \(0x80004005\):\ SQL logic error or missing database.*?\} 0 1234123412341234$}} ############################################################################### runTest {test data-1.50 {column name and index lookup} -setup { setupDb [set fileName data-1.50.db] } -body { sql execute $db { |
︙ | ︙ | |||
2694 2695 2696 2697 2698 2699 2700 | unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ | | | 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 | unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite SQLiteInterop} -result {1 {} 1.01 {}}} ############################################################################### runTest {test data-1.57 {regexp extension} -setup { setupDb [set fileName data-1.57.db] } -body { unset -nocomplain pattern result |
︙ | ︙ | |||
2754 2755 2756 2757 2758 2759 2760 | unset -nocomplain pattern result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ | | | | 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 | unset -nocomplain pattern result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite SQLiteInterop} -result {0 1 1 {unmatched '('} 0 1 1\ {unmatched '('} 0 0 1 {unmatched '('} 0 0 1 {unmatched '('}}} ############################################################################### reportSQLiteResources $test_channel ############################################################################### |
︙ | ︙ | |||
2836 2837 2838 2839 2840 2841 2842 | unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ | | | 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 | unset -nocomplain result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite SQLiteInterop} -result {0 4 -1 1.75}} ############################################################################### runTest {test data-1.60 {per-connection type mappings} -setup { setupDb [set fileName data-1.60.db] "" "" "" UseConnectionTypes } -body { set connection [getDbConnection] |
︙ | ︙ | |||
3168 3169 3170 3171 3172 3173 3174 | cleanupDb $fileName restoreSQLiteConnectionEnvironment freeDbConnection unset -nocomplain connection db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ | | > | 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 | cleanupDb $fileName restoreSQLiteConnectionEnvironment freeDbConnection unset -nocomplain connection db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -match regexp -result \ {^Default Default|LogCallbackException LogCallbackException$}} ############################################################################### runTest {test data-1.69 {set env(DefaultFlags_SQLiteConnection)} -setup { saveSQLiteConnectionEnvironment set env(DefaultFlags_SQLiteConnection) "DetectTextAffinity, DetectStringType" |
︙ | ︙ | |||
3276 3277 3278 3279 3280 3281 3282 | unset -nocomplain x result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ | | | | | 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 | unset -nocomplain x result connection cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite SQLiteInterop} -match regexp -result \ {^\{fts5: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40}\} \{\} \{\} \{\}\ \{\} \{\} \{rowid 3 x horse rowid 4 x house\}$}} ############################################################################### runTest {test data-1.72 {unbind function from a connection} -setup { set fileName data-1.72.db } -body { set id [object invoke Interpreter.GetActive NextId] |
︙ | ︙ | |||
3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 | System.Data.SQLite compileCSharp} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{\} 0 (?:-)?\d+ 0 \{\} 1\ \{System\.Reflection\.TargetInvocationException: Exception has been thrown by\ the target of an invocation\. ---> System\.Data\.SQLite\.SQLiteException: SQL\ logic error or missing database no such function: MyRandom.*\} 0 \{\} 0 (?:-)?\d+ 0 \{\}$}]} ############################################################################### reportSQLiteResources $test_channel ############################################################################### runSQLiteTestFilesEpilogue runSQLiteTestEpilogue runTestEpilogue | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 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 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 | System.Data.SQLite compileCSharp} -match regexp -result \ [string map [list \n \r\n] {^Ok System#CodeDom#Compiler#CompilerResults#\d+\ \{\} 0 \{\} 0 (?:-)?\d+ 0 \{\} 1\ \{System\.Reflection\.TargetInvocationException: Exception has been thrown by\ the target of an invocation\. ---> System\.Data\.SQLite\.SQLiteException: SQL\ logic error or missing database no such function: MyRandom.*\} 0 \{\} 0 (?:-)?\d+ 0 \{\}$}]} ############################################################################### runTest {test data-1.74 {bind functions using delegate} -setup { proc getMyFuncArgs { argumentCount } { set result [list] for {set index 0} {$index < $argumentCount} {incr index} { lappend result [appendArgs 'myFuncArg [expr {$index + 1}] '] } return $result } proc getHashCode { value } { if {[isObjectHandle $value]} then { if {$value eq "null"} then { return 0 } else { return [object invoke $value GetHashCode] } } else { if {[string length $value] == 0} then { return 0 } else { set string [object create String $value] return [object invoke $string GetHashCode] } } } proc hashManagedArray { array } { set data "" if {[isObjectHandle $array] && $array ne "null"} then { if {[object invoke $array GetType.IsArray]} then { for {set index 0} {$index < [$array Length]} {incr index} { set element [$array -create -alias GetValue $index] if {[string length $element] > 0} then { append data [$element ToString] } else { append data null } } } } return [getHashCode [hash normal sha1 $data]] } proc myFuncCallback { args } { if {[llength $args] == 0} then { error "no function arguments" } set name [lindex $args 0] if {[isObjectHandle $name] && $name ne "null"} then { set name [object invoke $name ToString] } switch -exact -- $name { Invoke { return [hashManagedArray [lindex $args end]] } Step { set varName [lindex $args end] if {[string length $varName] == 0} then { error "invalid aggregate context variable name" } upvar 1 $varName ctx if {![info exists ctx] || [string length $ctx] == 0} then { set ctx [pid] } set hashCtx [getHashCode $ctx] set hashArgs [hashManagedArray [lindex $args end-2]] if {[info exists ::aggregateData($hashCtx)]} then { incr ::aggregateData($hashCtx) $hashArgs } else { set ::aggregateData($hashCtx) $hashArgs } } Final { set ctx [lindex $args end] if {[string length $ctx] == 0} then { error "invalid aggregate context" } set hashCtx [getHashCode $ctx] if {[info exists ::aggregateData($hashCtx)]} then { return $::aggregateData($hashCtx) } else { error "missing aggregate context data" } } Compare { lappend ::compareResults [object invoke -create \ Int32 Parse [string compare -nocase [lindex \ $args 1] [lindex $args 2]]] return [lindex $::compareResults end] } default { error [appendArgs "unknown function callback \"" $name \"] } } } proc myFuncInvokeCallback { param0 objs } { return [myFuncCallback $param0 $objs] } proc myFuncStepCallback { param0 objs stepNumber contextDataVarName } { upvar 1 $contextDataVarName $contextDataVarName return [myFuncCallback $param0 $objs $stepNumber $contextDataVarName] } proc myFuncFinalCallback { param0 contextData } { return [myFuncCallback $param0 $contextData ] } proc myFuncCompareCallback { param0 param1 param2 } { return [myFuncCallback $param0 $param1 $param2] } setupDb [set fileName data-1.74.db] } -body { sql execute $db "CREATE TABLE t1(x);" sql execute $db "INSERT INTO t1 (x) VALUES(1);" sql execute $db "INSERT INTO t1 (x) VALUES(2);" sql execute $db "INSERT INTO t1 (x) VALUES(3);" sql execute $db "INSERT INTO t1 (x) VALUES('A');" sql execute $db "INSERT INTO t1 (x) VALUES('a');" sql execute $db "INSERT INTO t1 (x) VALUES('M');" sql execute $db "INSERT INTO t1 (x) VALUES('m');" sql execute $db "INSERT INTO t1 (x) VALUES('Z');" sql execute $db "INSERT INTO t1 (x) VALUES('z');" set connection [getDbConnection] for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} { set attribute(1,$argumentCount) [object create \ System.Data.SQLite.SQLiteFunctionAttribute [appendArgs \ myFunc1_74_1_ $argumentCount] $argumentCount Scalar] $connection -marshalflags \ {-StrictMatchType +DynamicCallback ForceParameterType} \ -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \ System.Data.SQLite.SQLiteInvokeDelegate Delegate] \ BindFunction $attribute(1,$argumentCount) \ myFuncInvokeCallback null set attribute(2,$argumentCount) [object create \ System.Data.SQLite.SQLiteFunctionAttribute [appendArgs \ myFunc1_74_2_ $argumentCount] $argumentCount Aggregate] $connection -marshalflags \ {-StrictMatchType +DynamicCallback ForceParameterType} \ -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \ System.Data.SQLite.SQLiteStepDelegate \ System.Data.SQLite.SQLiteFinalDelegate] \ BindFunction $attribute(2,$argumentCount) \ myFuncStepCallback myFuncFinalCallback } set attribute(3,0) [object create \ System.Data.SQLite.SQLiteFunctionAttribute myFunc1_74_3 0 \ Collation] $connection -marshalflags \ {-StrictMatchType +DynamicCallback ForceParameterType} \ -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \ System.Data.SQLite.SQLiteCompareDelegate Delegate] \ BindFunction $attribute(3,0) \ myFuncCompareCallback null for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} { lappend result [catch { sql execute $db [appendArgs \ "SELECT " myFunc1_74_1_ $argumentCount ( \ [join [getMyFuncArgs $argumentCount] ,] )\;] } error] $error lappend result [catch { sql execute $db [appendArgs \ "SELECT " myFunc1_74_2_ $argumentCount ( \ [join [getMyFuncArgs $argumentCount] ,] )\;] } error] $error } lappend result [catch { sql execute -execute reader -format list $db \ "SELECT x FROM t1 ORDER BY x COLLATE myFunc1_74_3;" } error] $error lappend result [$connection UnbindAllFunctions false] for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} { lappend result [catch { sql execute $db [appendArgs \ "SELECT " myFunc1_74_1_ $argumentCount ( \ [join [getMyFuncArgs $argumentCount] ,] )\;] } error] [expr {[string first [appendArgs \ "no such function: myFunc1_74_1_" $argumentCount] $error] != -1}] lappend result [catch { sql execute $db [appendArgs \ "SELECT " myFunc1_74_2_ $argumentCount ( \ [join [getMyFuncArgs $argumentCount] ,] )\;] } error] [expr {[string first [appendArgs \ "no such function: myFunc1_74_2_" $argumentCount] $error] != -1}] } lappend result [catch { sql execute -execute reader -format list $db \ "SELECT x FROM t1 ORDER BY x COLLATE myFunc1_74_3;" } error] [expr {[string first "no such collation sequence: myFunc1_74_3" \ $error] != -1}] lappend result [array size aggregateData] lappend result [testArrayGet aggregateData] set result } -cleanup { cleanupDb $fileName freeDbConnection catch {object removecallback myFuncCompareCallback} catch {object removecallback myFuncFinalCallback} catch {object removecallback myFuncStepCallback} catch {object removecallback myFuncInvokeCallback} catch { foreach compareResult $compareResults { catch {object dispose $compareResult} } } unset -nocomplain result error compareResult compareResults \ aggregateData argumentCount attribute connection db fileName rename myFuncCompareCallback "" rename myFuncFinalCallback "" rename myFuncStepCallback "" rename myFuncInvokeCallback "" rename myFuncCallback "" rename hashManagedArray "" rename getHashCode "" rename getMyFuncArgs "" } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -match regexp -result {^0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 \{1\ 2 3 A a M m Z z\} True 1 True 1 True 1 True 1 True 1 True 1 True 1 True 1\ \{(?:-)?\d+ (?:-)?\d+\}$}} ############################################################################### reportSQLiteResources $test_channel ############################################################################### runSQLiteTestFilesEpilogue runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/linq.eagle.
︙ | ︙ | |||
87 88 89 90 91 92 93 | } else { lappend result [string trim $error] } set result } -cleanup { unset -nocomplain code output error result | > | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | } else { lappend result [string trim $error] } set result } -cleanup { unset -nocomplain code output error result } -constraints {eagle System.Data.SQLite.dll_v4.0.30319 monoToDo SQLite\ file_System.Data.SQLite.dll testExec file_System.Data.SQLite.Linq.dll\ file_testlinq.exe file_northwindEF.db} -result {0 {{ NewUnitPrice = 21.0 } {\ NewUnitPrice = 21.1 } { NewUnitPrice = 21.05 } { NewUnitPrice = 23.0 } {\ NewUnitPrice = 23.3 } { NewUnitPrice = 23.25 } { NewUnitPrice = 21.0 } {\ NewUnitPrice = 21.4 } { NewUnitPrice = 21.35 }}}} ############################################################################### runSQLiteTestFilesEpilogue runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/speed.eagle.
︙ | ︙ | |||
172 173 174 175 176 177 178 | } set result } -cleanup { cleanupDb $fileName unset -nocomplain time sql table column result char db fileName | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | } set result } -cleanup { cleanupDb $fileName unset -nocomplain time sql table column result char db fileName } -time true -constraints {eagle monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite} -result {3 3 3 3}} ############################################################################### # # NOTE: Report after test. # |
︙ | ︙ |
Changes to Tests/stress.eagle.
︙ | ︙ | |||
1643 1644 1645 1646 1647 1648 1649 | rename cleanupLogging "" rename setupLogging "" unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener event timeout connection indicators iterations exitOnFail \ coTaskMem noTrace failures status workloadNames workloadCallbacks | | | 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 | rename cleanupLogging "" rename setupLogging "" unset -nocomplain result thread index workload priority noWorkload \ priorities srcDb db fileName compiled options count times logFileName \ logListener event timeout connection indicators iterations exitOnFail \ coTaskMem noTrace failures status workloadNames workloadCallbacks } -time true -constraints {eagle command.object monoBug40 command.sql\ compile.DATA SQLite System.Data.SQLite compileCSharp} -result {0}} ############################################################################### # # NOTE: Report after test. # |
︙ | ︙ |
Changes to Tests/tkt-47c6fa04d3.eagle.
︙ | ︙ | |||
113 114 115 116 117 118 119 | [expr {$code eq "Ok" ? [catch { object invoke -alias _Dynamic${id}.Test${id} GetDataTable } result] : [set result ""]}] $result [getRowsFromDataTable $result] } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | [expr {$code eq "Ok" ? [catch { object invoke -alias _Dynamic${id}.Test${id} GetDataTable } result] : [set result ""]}] $result [getRowsFromDataTable $result] } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 System#Data#DataTable#\d+\ \{\{\{id 2\} \{min 2\} \{max 3\} \{sum 5\}\} \{\{id 2\} \{min 1\} \{max 2\}\ \{sum 3\}\}\}$}} ############################################################################### |
︙ | ︙ |
Changes to Tests/tkt-4a791e70ab.eagle.
︙ | ︙ | |||
67 68 69 70 71 72 73 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}} ############################################################################### runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/tkt-56b42d99c1.eagle.
︙ | ︙ | |||
95 96 97 98 99 100 101 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code dataSource id db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}} ############################################################################### runTest {test tkt-56b42d99c1-1.2 {enlisted transaction isolation} -setup { setupDb [set fileName tkt-56b42d99c1-1.2.db] |
︙ | ︙ | |||
172 173 174 175 176 177 178 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}} ############################################################################### runTest {test tkt-56b42d99c1-1.3 {enlisted transaction isolation} -setup { setupDb [set fileName tkt-56b42d99c1-1.3.db] |
︙ | ︙ | |||
403 404 405 406 407 408 409 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName | | | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | [expr {$code eq "Ok" ? [catch { object invoke _Dynamic${id}.Test${id} Main } result] : [set result ""]}] $result } -cleanup { cleanupDb $fileName unset -nocomplain result results errors code sql dataSource id db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite compileCSharp} -match regexp -result {^Ok\ System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}} ############################################################################### set flags MapIsolationLevels |
︙ | ︙ |
Changes to Tests/tkt-964063da16.eagle.
︙ | ︙ | |||
25 26 27 28 29 30 31 | System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=False;"] $connection Open $connection Flags } -cleanup { unset -nocomplain connection | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=False;"] $connection Open $connection Flags } -cleanup { unset -nocomplain connection } -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \ -result {^Default|LogCallbackException$}} ############################################################################### runTest {test tkt-964063da16-1.2 {pre-existing connection flags} -body { set connection [object create -alias \ System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=True;"] |
︙ | ︙ | |||
53 54 55 56 57 58 59 | System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=False;"] $connection Flags NoExtensionFunctions; $connection Open $connection Flags } -cleanup { unset -nocomplain connection | | > | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=False;"] $connection Flags NoExtensionFunctions; $connection Open $connection Flags } -cleanup { unset -nocomplain connection } -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \ -result {^Default, NoExtensionFunctions|NoExtensionFunctions,\ Default|LogCallbackException, NoExtensionFunctions$}} ############################################################################### runTest {test tkt-964063da16-1.4 {pre-existing connection flags} -body { set connection [object create -alias \ System.Data.SQLite.SQLiteConnection \ "Data Source=:memory:;NoDefaultFlags=True;"] |
︙ | ︙ |
Changes to Tests/tkt-9d353b0bd8.eagle.
︙ | ︙ | |||
50 51 52 53 54 55 56 | lappend result [string trim $error] } set result } -cleanup { unset -nocomplain code output error result } -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\ | | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | lappend result [string trim $error] } set result } -cleanup { unset -nocomplain code output error result } -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\ file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db\ System.Data.SQLite.dll_v4.0.30319} -result {0 {inserted 1}}} ############################################################################### runSQLiteTestFilesEpilogue runSQLiteTestEpilogue runTestEpilogue |
Changes to Tests/tkt-aba4549801.eagle.
︙ | ︙ | |||
62 63 64 65 66 67 68 | rename onChanged "" } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -match regexp -result \ {^\{System#Data#SQLite#SQLiteConnection#\d+ Opening \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ Closing \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ Closed \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ ConnectionString \{\} \{\} \{\}\ | | | | | | | | | | 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 | rename onChanged "" } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ System.Data.SQLite} -match regexp -result \ {^\{System#Data#SQLite#SQLiteConnection#\d+ Opening \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ Closing \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ Closed \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ ConnectionString \{\} \{\} \{\}\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteConnectionHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ Opened \{\} \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteStatementHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ DisposingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ ClosingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteStatementHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ DisposingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ ClosingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteStatementHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ DisposingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ ClosingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewTransaction\ System#Data#SQLite#SQLiteTransaction#\d+ \{\} \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteStatementHandle#\d+\} \{\{\} NewCriticalHandle \{\}\ \{\} \{\} System#Data#SQLite#SQLiteStatementHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ ClosingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ \{System#Data#SQLite#SQLiteConnection#\d+ NewDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{\{\} NewCriticalHandle \{\} \{\} \{\}\ System#Data#SQLite#SQLiteStatementHandle#\d+\}\ \{System#Data#SQLite#SQLiteConnection#\d+ DisposingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ ClosingDataReader \{\}\ System#Data#SQLite#SQLiteCommand#\d+ System#Data#SQLite#SQLiteDataReader#\d+\ \{\}\} \{System#Data#SQLite#SQLiteConnection#\d+ DisposingCommand \{\}\ System#Data#SQLite#SQLiteCommand#\d+ \{\} \{\}\}\ |
︙ | ︙ |
Changes to Tests/tkt-ac47dd230a.eagle.
︙ | ︙ | |||
23 24 25 26 27 28 29 | runTest {test tkt-ac47dd230a-1.1 {multiple AppDomains} -setup { for {set i 1} {$i < 3} {incr i} { set appDomain($i) [object invoke AppDomain CreateDomain \ [appendArgs tkt-ac47dd230a-1.1. $i]] set result null set interpreterHelper($i) [object invoke -alias InterpreterHelper \ | | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | runTest {test tkt-ac47dd230a-1.1 {multiple AppDomains} -setup { for {set i 1} {$i < 3} {incr i} { set appDomain($i) [object invoke AppDomain CreateDomain \ [appendArgs tkt-ac47dd230a-1.1. $i]] set result null set interpreterHelper($i) [object invoke -alias InterpreterHelper \ Create $appDomain($i) null Default Default Default null null null \ result] if {[string length $interpreterHelper($i)] == 0} then { error [object invoke $result ToString] } set interpreter($i) [$interpreterHelper($i) -alias Interpreter] |
︙ | ︙ |
Changes to Tests/tkt-e06c4caff3.eagle.
︙ | ︙ | |||
27 28 29 30 31 32 33 | sql execute $db "INSERT INTO t1 (x) VALUES(?);" \ [list param1 Double [set NaN [object invoke Double NaN]]] } -cleanup { cleanupDb $fileName unset -nocomplain NaN db fileName | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | sql execute $db "INSERT INTO t1 (x) VALUES(?);" \ [list param1 Double [set NaN [object invoke Double NaN]]] } -cleanup { cleanupDb $fileName unset -nocomplain NaN db fileName } -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\ System.Data.SQLite} -returnCodes 1 -match regexp -result [string map [list \n\ \r\n] {^System\.Data\.SQLite\.SQLiteException \(0x80004005\): constraint failed NOT NULL constraint failed: t1\.x .*$}]} ############################################################################### |
︙ | ︙ |
Changes to Tests/tkt-f8dbab8baf.eagle.
︙ | ︙ | |||
127 128 129 130 131 132 133 | [expr {[info exists rows(count)] ? $rows(count) : -1}] \ [expr {[info exists rows(names)] ? $rows(names) : ""}] } -cleanup { cleanupDb $fileName unset -nocomplain rows db fileName } -constraints \ | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | [expr {[info exists rows(count)] ? $rows(count) : -1}] \ [expr {[info exists rows(names)] ? $rows(names) : ""}] } -cleanup { cleanupDb $fileName unset -nocomplain rows db fileName } -constraints \ {eagle monoBug40 command.sql compile.DATA SQLite System.Data.SQLite} \ -returnCodes 1 -match regexp -result [string map [list \n \r\n] \ {^System\.Data\.SQLite\.SQLiteException \(0x80004005\): SQL logic error or\ missing database no such table: t1.*$}]} ############################################################################### |
︙ | ︙ |
Changes to lib/System.Data.SQLite/common.eagle.
︙ | ︙ | |||
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | # NOTE: If the primary assembly also contains the native components, # we have everything we need. # if {$native} then { return true } # # NOTE: What is the platform for this machine? # set platform [machineToPlatform $::tcl_platform(machine)] # # NOTE: Build the fully qualified file name for the interop assembly # containing the System.Data.SQLite native components. If this # file exists, we should have everything we need. # set fileName [file nativename [file join $directory \ $platform SQLite.Interop.dll]] if {[file exists $fileName]} then { return true } set fileName [file nativename [file join $directory \ SQLite.Interop.dll]] if {[file exists $fileName]} then { return true } # # NOTE: Build the fully qualified file name for the SQLite core # library. If this file exists, we should have everything we # need. # set fileName [file nativename [file join $directory \ $platform sqlite3.dll]] if {[file exists $fileName]} then { return true } | > > > > > > > > > > > > > > > > > > > | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | # NOTE: If the primary assembly also contains the native components, # we have everything we need. # if {$native} then { return true } # # NOTE: What is the architecture for this machine? # set architecture [machineToPlatform $::tcl_platform(machine) true] # # NOTE: What is the platform for this machine? # set platform [machineToPlatform $::tcl_platform(machine)] # # NOTE: Build the fully qualified file name for the interop assembly # containing the System.Data.SQLite native components. If this # file exists, we should have everything we need. # set fileName [file nativename [file join $directory \ $architecture SQLite.Interop.dll]] if {[file exists $fileName]} then { return true } set fileName [file nativename [file join $directory \ $platform SQLite.Interop.dll]] if {[file exists $fileName]} then { return true } set fileName [file nativename [file join $directory \ SQLite.Interop.dll]] if {[file exists $fileName]} then { return true } # # NOTE: Build the fully qualified file name for the SQLite core # library. If this file exists, we should have everything we # need. # set fileName [file nativename [file join $directory \ $architecture sqlite3.dll]] if {[file exists $fileName]} then { return true } set fileName [file nativename [file join $directory \ $platform sqlite3.dll]] if {[file exists $fileName]} then { return true } |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | # always return zero. # return [expr { [haveConstraint System.Data.SQLite] && [haveConstraint SQLite] }] } | | | 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | # always return zero. # return [expr { [haveConstraint System.Data.SQLite] && [haveConstraint SQLite] }] } proc matchPlatform { platform } { # # NOTE: An empty string for the platform means that the build is not # [primarily] a native build; therefore, it always matches. # if {[string length $platform] == 0} then { return true } |
︙ | ︙ | |||
1325 1326 1327 1328 1329 1330 1331 | # if {[isBuildAvailable $native $directory]} then { # # NOTE: When in "select" mode, automatically select the first # available build of System.Data.SQLite and then return # immediately. # | | | 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 | # if {[isBuildAvailable $native $directory]} then { # # NOTE: When in "select" mode, automatically select the first # available build of System.Data.SQLite and then return # immediately. # if {$select && [matchPlatform $platform]} then { # # NOTE: Manually override all the build directory selection # related test settings in order to force this build # of System.Data.SQLite to be used. # if {![changeNativeRuntimeOption $native]} then { tputs $channel [appendArgs \ |
︙ | ︙ | |||
1386 1387 1388 1389 1390 1391 1392 | $directory "\"... "] if {[isReleaseAvailable $directory platform]} then { if {[string length $platform] == 0} then { set platform unknown } | | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 | $directory "\"... "] if {[isReleaseAvailable $directory platform]} then { if {[string length $platform] == 0} then { set platform unknown } if {$select && [matchPlatform $platform]} then { set ::build_directory $directory tputs $channel [appendArgs "yes, selected (" $platform ")\n"] return true } else { tputs $channel [appendArgs "yes (" $platform ")\n"] |
︙ | ︙ | |||
1409 1410 1411 1412 1413 1414 1415 | $path "\"... "] if {[isReleaseAvailable $path platform]} then { if {[string length $platform] == 0} then { set platform unknown } | | | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | $path "\"... "] if {[isReleaseAvailable $path platform]} then { if {[string length $platform] == 0} then { set platform unknown } if {$select && [matchPlatform $platform]} then { set ::build_directory $path tputs $channel [appendArgs "yes, selected (" $platform ")\n"] return true } else { tputs $channel [appendArgs "yes (" $platform ")\n"] |
︙ | ︙ | |||
1519 1520 1521 1522 1523 1524 1525 | # so, make it easy to spot. # if {[string length $sourceId] == 0} then { set sourceId null } # | > > > > > | | | > > > > > | | 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | # so, make it easy to spot. # if {[string length $sourceId] == 0} then { set sourceId null } # # NOTE: Before actually adding the test constraint, make sure the # version is valid (i.e. not just that we could query it). # if {$version ne "null"} then { # # NOTE: Yes, the SQLite interop assembly appears to be available. # addConstraint SQLiteInterop set answer yes } else { set answer no } tputs $channel [appendArgs $answer " (" $version " " $sourceId ")\n"] } else { tputs $channel no\n } } proc checkForSQLiteDefineConstant { channel name } { tputs $channel [appendArgs \ |
︙ | ︙ |
Changes to readme.htm.
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | <p> <b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16]. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19]. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> | > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | <p> <b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Add support for creating custom SQL functions using delegates.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Prevent encrypted connections from being used with the connection pool. Pursuant to [89d3a159f1]. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16]. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19]. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> |
︙ | ︙ |
Changes to test/TestCases.cs.
︙ | ︙ | |||
19 20 21 22 23 24 25 | { private const int NumThreads = 8; private const int ThreadTimeout = 60000; private List<string> droptables = new List<string>(); private List<string> maydroptable = new List<string>(); | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | { private const int NumThreads = 8; private const int ThreadTimeout = 60000; private List<string> droptables = new List<string>(); private List<string> maydroptable = new List<string>(); #if !USE_INTEROP_DLL || !INTEROP_LOG private long logevents = 0; #endif internal TestCases() { } |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | SQLiteErrorCode rc = cnn.ResultCode(); SQLiteErrorCode xrc = cnn.ExtendedResultCode(); cnn.Close(); } } | | | 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 | SQLiteErrorCode rc = cnn.ResultCode(); SQLiteErrorCode xrc = cnn.ExtendedResultCode(); cnn.Close(); } } #if !USE_INTEROP_DLL || !INTEROP_LOG //Logging EventHandler public void OnLogEvent(object sender, LogEventArgs logEvent) { object errorCode = logEvent.ErrorCode; string err_msg = logEvent.Message; logevents++; } |
︙ | ︙ |
Changes to testce/TestCases.cs.
︙ | ︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); passed++; } catch (Exception) { frm.WriteLine("FAIL - UserCollation"); failed++; } total++; try { Int64Properties(cnn); frm.WriteLine("SUCCESS - Int64Properties"); passed++; } catch (Exception) { frm.WriteLine("FAIL - Int64Properties"); failed++; } total++; try { ManagedVirtualTable(cnn); frm.WriteLine("SUCCESS - ManagedVirtualTable"); passed++; } catch (Exception) { frm.WriteLine("FAIL - ManagedVirtualTable"); failed++; } total++; try { MultipleThreadStress(cnn); frm.WriteLine("SUCCESS - MultipleThreadStress"); passed++; } catch (Exception) { frm.WriteLine("FAIL - MultipleThreadStress"); failed++; } total++; try { SimpleRTree(cnn); frm.WriteLine("SUCCESS - SimpleRTree"); passed++; } | > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); passed++; } catch (Exception) { frm.WriteLine("FAIL - UserCollation"); failed++; } total++; try { Int64Properties(cnn); frm.WriteLine("SUCCESS - Int64Properties"); passed++; } catch (Exception) { frm.WriteLine("FAIL - Int64Properties"); failed++; } #if INTEROP_VIRTUAL_TABLE total++; try { ManagedVirtualTable(cnn); frm.WriteLine("SUCCESS - ManagedVirtualTable"); passed++; } catch (Exception) { frm.WriteLine("FAIL - ManagedVirtualTable"); failed++; } #endif total++; try { MultipleThreadStress(cnn); frm.WriteLine("SUCCESS - MultipleThreadStress"); passed++; } catch (Exception) { frm.WriteLine("FAIL - MultipleThreadStress"); failed++; } total++; try { SimpleRTree(cnn); frm.WriteLine("SUCCESS - SimpleRTree"); passed++; } |
︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | return; } throw new NotSupportedException("not a SQLite connection"); } // Make sure that managed virtual table support works on the .NET Compact Framework. internal void ManagedVirtualTable(DbConnection cnn) { SQLiteConnection cnn2 = cnn as SQLiteConnection; if (cnn2 != null) { | > | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | return; } throw new NotSupportedException("not a SQLite connection"); } #if INTEROP_VIRTUAL_TABLE // Make sure that managed virtual table support works on the .NET Compact Framework. internal void ManagedVirtualTable(DbConnection cnn) { SQLiteConnection cnn2 = cnn as SQLiteConnection; if (cnn2 != null) { |
︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | } return; } throw new NotSupportedException("not a SQLite connection"); } private int nextId = 0; private const int MAX_THREADS = 3; private const int MAX_ITERATIONS = 100; private ManualResetEvent goEvent = new ManualResetEvent(false); private static int GetThreadId() | > | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | } return; } throw new NotSupportedException("not a SQLite connection"); } #endif private int nextId = 0; private const int MAX_THREADS = 3; private const int MAX_ITERATIONS = 100; private ManualResetEvent goEvent = new ManualResetEvent(false); private static int GetThreadId() |
︙ | ︙ |
Changes to testce/testce.2005.csproj.
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2005</Name> </ProjectReference> </ItemGroup> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"> <HostingProcess disable="1" /> | > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2005</Name> </ProjectReference> </ItemGroup> <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"> <HostingProcess disable="1" /> |
︙ | ︙ |
Changes to testce/testce.2008.csproj.
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2008</Name> </ProjectReference> </ItemGroup> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"> <HostingProcess disable="1" /> | > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2008</Name> </ProjectReference> </ItemGroup> <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"> <HostingProcess disable="1" /> |
︙ | ︙ |
Changes to testce/testce.2012.csproj.
︙ | ︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2012</Name> </ProjectReference> </ItemGroup> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\v8.0\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"> | > | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | </ItemGroup> <ItemGroup> <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj"> <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project> <Name>System.Data.SQLite.Compact.2012</Name> </ProjectReference> </ItemGroup> <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\v8.0\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" /> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"> |
︙ | ︙ |
Changes to testlinq/Program.cs.
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | return SkipTest(pageSize); } case "substring": { return SubStringTest(); } case "unionall": { return UnionAllTest(); } case "endswith": { string value = null; if (args.Length > 1) { value = args[1]; | > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | return SkipTest(pageSize); } case "substring": { return SubStringTest(); } #if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS case "unionall": { return UnionAllTest(); } #endif case "endswith": { string value = null; if (args.Length > 1) { value = args[1]; |
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | return 1; } } return EFTransactionTest(value); } case "insert": { return InsertTest(); } case "update": { return UpdateTest(); } case "binaryguid": { bool value = false; | > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | return 1; } } return EFTransactionTest(value); } #if NET_40 || NET_45 || NET_451 || NET_46 case "insert": { return InsertTest(); } #endif case "update": { return UpdateTest(); } case "binaryguid": { bool value = false; |
︙ | ︙ | |||
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | once = true; } } return 0; } // // NOTE: Used to test the fix for ticket [0a32885109]. // private static int UnionAllTest() { using (northwindEFEntities db = new northwindEFEntities()) { | > | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | once = true; } } return 0; } #if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS // // NOTE: Used to test the fix for ticket [0a32885109]. // private static int UnionAllTest() { using (northwindEFEntities db = new northwindEFEntities()) { |
︙ | ︙ | |||
434 435 436 437 438 439 440 441 442 443 444 445 446 447 | Console.Write(customer.CustomerID); once = true; } } return 0; } // // NOTE: Used to test the fix for ticket [ccfa69fc32]. // private static int EFTransactionTest(bool add) { // | > | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | Console.Write(customer.CustomerID); once = true; } } return 0; } #endif // // NOTE: Used to test the fix for ticket [ccfa69fc32]. // private static int EFTransactionTest(bool add) { // |
︙ | ︙ | |||
548 549 550 551 552 553 554 555 556 557 558 559 560 561 | #endif } } return 0; } // // NOTE: Used to test the INSERT fix (i.e. an extra semi-colon in // the SQL statement after the actual INSERT statement in // the follow-up SELECT statement). // private static int InsertTest() { | > < < < < | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | #endif } } return 0; } #if NET_40 || NET_45 || NET_451 || NET_46 // // NOTE: Used to test the INSERT fix (i.e. an extra semi-colon in // the SQL statement after the actual INSERT statement in // the follow-up SELECT statement). // private static int InsertTest() { using (northwindEFEntities db = new northwindEFEntities()) { int[] counts = { 0 }; // // NOTE: *REQUIRED* This is required so that the // Entity Framework is prevented from opening |
︙ | ︙ | |||
602 603 604 605 606 607 608 609 610 611 612 613 614 615 | } Console.WriteLine("inserted {0}", counts[0]); } return 0; } // // NOTE: Used to test the UPDATE fix (i.e. the missing semi-colon // in the SQL statement between the actual UPDATE statement // and the follow-up SELECT statement). // private static int UpdateTest() | > | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | } Console.WriteLine("inserted {0}", counts[0]); } return 0; } #endif // // NOTE: Used to test the UPDATE fix (i.e. the missing semi-colon // in the SQL statement between the actual UPDATE statement // and the follow-up SELECT statement). // private static int UpdateTest() |
︙ | ︙ |
Changes to www/build.wiki.
︙ | ︙ | |||
393 394 395 396 397 398 399 | be able to simply delete these directories. </li> <li>Open a normal command prompt window with "cmd.exe".</li> <li>Change the current directory to "<root>\Setup".</li> | < < < < < < < < < < < < | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | be able to simply delete these directories. </li> <li>Open a normal command prompt window with "cmd.exe".</li> <li>Change the current directory to "<root>\Setup".</li> <li> Enter the following command to build the managed-only binaries for Mono: <br /> <br /> <b>build_mono.bat</b> <br /> <br /> </li> <li> Make sure everything succeeds with no errors; the log file "%TEMP%\System.Data.SQLite.Build_ReleaseManagedOnly_Win32_<year>_Unknown.log" |
︙ | ︙ |
Changes to www/news.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <title>News</title> <b>Version History</b> <p> <b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [https://www.sqlite.org/releaselog/3_8_11_1.html|SQLite 3.8.11.1].</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16]. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19]. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <title>News</title> <b>Version History</b> <p> <b>1.0.98.0 - August XX, 2015 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [https://www.sqlite.org/releaselog/3_8_11_1.html|SQLite 3.8.11.1].</li> <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li> <li>Add support for creating custom SQL functions using delegates.</li> <li>Implement the Substring method for LINQ using the "substr" core SQL function. <b>** Potentially Incompatible Change **</b></li> <li>Prevent encrypted connections from being used with the connection pool. Pursuant to [89d3a159f1]. <b>** Potentially Incompatible Change **</b></li> <li>Honor the second argument to Math.Round when using LINQ. <b>** Potentially Incompatible Change **</b></li> <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16]. <b>** Potentially Incompatible Change **</b></li> <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li> <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer. <b>** Potentially Incompatible Change **</b></li> <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19]. <b>** Potentially Incompatible Change **</b></li> <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li> <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li> |
︙ | ︙ |