Merge latest trunk changes into this branch.
FossilOrigin-Name: 790c56d493c66a2136e24d349d169639809d70bfab6996975a403be568a267a5
@@ -56,7 +56,7 @@ words, there are some non-public-domain files used to implement:
|
||||
In all cases, the non-public-domain files included with this
|
||||
repository have generous BSD-style licenses. So anyone is free to
|
||||
use any of the code in this source repository for any purpose, though
|
||||
attribution my be required to reuse or republish the configure and
|
||||
attribution may be required to reuse or republish the configure and
|
||||
build scripts. None of the non-public-domain code ever actually reaches
|
||||
the build products, such as "sqlite3.c", however, so no attribution is
|
||||
required to use SQLite itself. The non-public-domain code consists of
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
# The docs for many of its variables are in the primary static
|
||||
# makefile, main.mk (which this one includes at runtime).
|
||||
#
|
||||
.POSIX: #maintenance reminder: X:=Y is not POSIX-portable
|
||||
all:
|
||||
clean:
|
||||
########################################################################
|
||||
#XX# Lines starting with #XX# are TODOs for the port to autosetup.
|
||||
#
|
||||
# Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
|
||||
# particular order...
|
||||
@@ -27,31 +26,14 @@ clean:
|
||||
#
|
||||
# - Replace the autotools-specific distribution deliverable(s).
|
||||
#
|
||||
# - Provide Makefile.msc, Makefile.linux-gcc, and any required similar
|
||||
# makefile stubs for environments where the configure script will not
|
||||
# run. The core makefile rules in main.mk "should" apply as-is for
|
||||
# most platforms. We can potentially generate those makefiles, along
|
||||
# with main.mk, like we do in the Fossil project.
|
||||
#
|
||||
# - Confirm whether cross-compilation works and patch it
|
||||
# appropriately.
|
||||
#
|
||||
# - There are some lingering dependencies issues which cause a
|
||||
# re-configure to trigger more often than it should. This is
|
||||
# especially a problem in parallel builds, which may launch multiple
|
||||
# re-configures in parallel. GNU Make offers ways of controlling
|
||||
# that, but we're limited to POSIX Make compatibility here. The
|
||||
# automatic reconfigures are not too onerous, though, because they're
|
||||
# much, much faster than Autotools configure runs.
|
||||
#
|
||||
# - Add target(s) to dump out specific vars, e.g. SQLITE_OPT, as
|
||||
# requested at https://sqlite.org/forum/forumpost/75cb3179216f8d86.
|
||||
# This would also be useful for the ext/wasm build, which fishes
|
||||
# SHELL_OPT out of the makefile.
|
||||
#
|
||||
#
|
||||
# Maintenance reminders:
|
||||
#
|
||||
# - This makefile should remain as POSIX-make-compatible as possible:
|
||||
# https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html
|
||||
#
|
||||
# - When using the X?=Y variable assignment formulation, please test
|
||||
# the build with both GNU make and a POSIX make (e.g. BSD make,
|
||||
# a.k.a. bmake). On at least one occassion, that formulation has led
|
||||
@@ -75,13 +57,7 @@ clean:
|
||||
TOP = @abs_top_srcdir@
|
||||
#
|
||||
# Some standard variables and programs
|
||||
#
|
||||
prefix ?= @prefix@
|
||||
exec_prefix ?= @exec_prefix@
|
||||
libdir ?= @libdir@
|
||||
pkgconfigdir ?= $(libdir)/pkgconfig
|
||||
bindir ?= @bindir@
|
||||
includedir ?= @includedir@
|
||||
#
|
||||
# Just testing some default dir expansions...
|
||||
# srcdir = @srcdir@
|
||||
@@ -95,10 +71,20 @@ INSTALL = @BIN_INSTALL@
|
||||
AR = @AR@
|
||||
AR.flags = cr # TODO? Add a configure test to determine this?
|
||||
CC = @CC@
|
||||
B.cc = @BUILD_CC@ @BUILD_CFLAGS@
|
||||
T.cc = @CC@
|
||||
CFLAGS = @CPPFLAGS@ @CFLAGS@ @SH_CFLAGS@
|
||||
|
||||
B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
|
||||
T.cc = $(CC)
|
||||
#
|
||||
# CFLAGS is problematic because it is frequently overridden when
|
||||
# invoking make, which loses things like -fPIC. So... let's avoid
|
||||
# using it directly and instead add a level of indirection. We
|
||||
# combine CFLAGS and CPPFLAGS here because that's the way the legacy
|
||||
# build did it.
|
||||
#
|
||||
CFLAGS = @CFLAGS@ @CPPFLAGS@
|
||||
#
|
||||
# CFLAGS.core is documented in main.mk.
|
||||
#
|
||||
CFLAGS.core = @SH_CFLAGS@
|
||||
LDFLAGS.shobj = @SHOBJ_LDFLAGS@
|
||||
LDFLAGS.zlib = @LDFLAGS_ZLIB@
|
||||
LDFLAGS.math = @LDFLAGS_MATH@
|
||||
@@ -202,14 +188,28 @@ TCL_CONFIG_SH = @TCL_CONFIG_SH@
|
||||
#
|
||||
# TCL config info from tclConfig.sh
|
||||
#
|
||||
TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
|
||||
TCL_LIB_SPEC = @TCL_LIB_SPEC@
|
||||
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
|
||||
TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
|
||||
TCL_VERSION = @TCL_VERSION@
|
||||
TCLLIB_RPATH = @TCLLIB_RPATH@
|
||||
# We have to inject this differently in main.mk to accommodate static
|
||||
# makefiles, so we don't currently bother to export it here. This
|
||||
# block is retained in case we decide that we do indeed need to export
|
||||
# it at configure-time instead of calculate it at make-time.
|
||||
#
|
||||
# Where do we want to install the tcl plugin
|
||||
#TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
|
||||
#TCL_LIB_SPEC = @TCL_LIB_SPEC@
|
||||
#TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
|
||||
#TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
|
||||
#TCL_VERSION = @TCL_VERSION@
|
||||
#
|
||||
# $(TCLLIB_RPATH) is calculated by the configure script. Its counterpart
|
||||
# in tclConfig.sh (TCL_LD_SEARCH_FLAGS) is defined in such a way as to
|
||||
# make it incompatible with static makefiles.
|
||||
#
|
||||
#TCLLIB_RPATH = @TCLLIB_RPATH@
|
||||
#
|
||||
# $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
|
||||
# is calculated at make-time by the targets which need it but we
|
||||
# export it here so that it can be set at configure-time, so that
|
||||
# clients are not required to pass it at make-time, or set it in their
|
||||
# environment, to override it.
|
||||
#
|
||||
TCLLIBDIR = @TCLLIBDIR@
|
||||
|
||||
@@ -313,7 +313,7 @@ misspell: ./custom.rws has_tclsh84
|
||||
# build.
|
||||
#
|
||||
clean-autosetup:
|
||||
-gmake -C ext/wasm distclean 2>/dev/null; true
|
||||
-gmake -C ext/wasm distclean 2>/dev/null || true
|
||||
clean: clean-autosetup
|
||||
|
||||
distclean-autosetup: clean
|
||||
|
||||
@@ -24,9 +24,14 @@ TOP ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
|
||||
#
|
||||
# $(CFLAGS) will be used when compiling the library and most
|
||||
# utilities. It must normally contain -fPIC on Linux systems.
|
||||
# utilities. It must normally contain -fPIC on Linux systems,
|
||||
# but overriding CFLAGS is an easy way for users to inadvertently
|
||||
# remove -fPIC from their builds, so we generally expect to see
|
||||
# -fPIC in $(CFLAGS.core), which main.mk will integrate with
|
||||
# the CFLAGS where needed.
|
||||
#
|
||||
CFLAGS = -fPIC
|
||||
CFLAGS =
|
||||
CFLAGS.core = -fPIC
|
||||
|
||||
#
|
||||
# $(SHELL_OPT) contains CFLAGS for building the sqlite3 CLI shell.
|
||||
@@ -42,7 +47,7 @@ LDFLAGS.zlib = -lz
|
||||
#
|
||||
# Library's version number.
|
||||
#
|
||||
VERSION.XYZ ?= $(shell cat $(TOP)/VERSION 2>/dev/null)
|
||||
PACKAGE_VERSION ?= $(shell cat $(TOP)/VERSION 2>/dev/null)
|
||||
|
||||
# sqlite_cfg.h is typically created by the configure script. It's
|
||||
# commonly not needed but main.mk does not know that so we have to
|
||||
|
||||
@@ -1585,7 +1585,6 @@ TESTSRC = \
|
||||
$(TOP)\src\test8.c \
|
||||
$(TOP)\src\test9.c \
|
||||
$(TOP)\src\test_autoext.c \
|
||||
$(TOP)\src\test_async.c \
|
||||
$(TOP)\src\test_backup.c \
|
||||
$(TOP)\src\test_bestindex.c \
|
||||
$(TOP)\src\test_blob.c \
|
||||
@@ -1682,7 +1681,6 @@ TESTSRC2 = \
|
||||
$(SRC01) \
|
||||
$(SRC07) \
|
||||
$(SRC10) \
|
||||
$(TOP)\ext\async\sqlite3async.c \
|
||||
fts5.c
|
||||
|
||||
# Header files used by all library source files.
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
# Routines for Steve Bennett's autosetup which are common to trees
|
||||
# managed in and around the umbrella of the SQLite project.
|
||||
#
|
||||
# The intent is that these routines be relatively generic, independent
|
||||
# of a given project.
|
||||
#
|
||||
# This file was initially derived from one used in the libfossil
|
||||
# project, authored by the same person who ported it here, and this is
|
||||
# noted here only as an indication that there are no licensing issues
|
||||
# despite this code having at least two near-twins running around a
|
||||
# despite this code having a handful of near-twins running around a
|
||||
# handful of third-party source trees.
|
||||
#
|
||||
########################################################################
|
||||
@@ -45,26 +48,38 @@
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
# $hwaci_ is an internal-use-only array for storing whatever generic
|
||||
# $proj_ is an internal-use-only array for storing whatever generic
|
||||
# internal stuff we need stored.
|
||||
array set hwaci_ {}
|
||||
set hwaci_(isatty) [isatty? stdout]
|
||||
array set proj_ {}
|
||||
set proj_(isatty) [isatty? stdout]
|
||||
|
||||
proc hwaci-warn {msg} {
|
||||
puts stderr "WARNING: $msg"
|
||||
proc proj-warn {msg} {
|
||||
puts stderr [proj-bold "WARNING: $msg"]
|
||||
}
|
||||
proc hwaci-fatal {msg} {
|
||||
proc proj-fatal {msg} {
|
||||
show-notices
|
||||
puts stderr "ERROR: $msg"
|
||||
puts stderr [proj-bold "ERROR: $msg"]
|
||||
exit 1
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Kind of like a C assert if uplevel (eval) of $script is false,
|
||||
# triggers a fatal error.
|
||||
proc proj-assert {script} {
|
||||
if {1 == [get-env proj-assert 0]} {
|
||||
msg-result [proj-bold "asserting: [string trim $script]"]
|
||||
}
|
||||
if {![uplevel 1 $script]} {
|
||||
proj-fatal "Assertion failed: $script"
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# If this function believes that the current console might support
|
||||
# ANSI escape sequences then this returns $str wrapped in a sequence
|
||||
# to bold that text, else it returns $str as-is.
|
||||
proc hwaci-bold {str} {
|
||||
if {$::autosetup(iswin) || !$::hwaci_(isatty)} {
|
||||
proc proj-bold {str} {
|
||||
if {$::autosetup(iswin) || !$::proj_(isatty)} {
|
||||
return $str
|
||||
}
|
||||
return "\033\[1m${str}\033\[0m"
|
||||
@@ -78,10 +93,10 @@ proc hwaci-bold {str} {
|
||||
#
|
||||
# If its first argument is -error then it renders the message
|
||||
# immediately and then exits.
|
||||
proc hwaci-indented-notice {args} {
|
||||
proc proj-indented-notice {args} {
|
||||
set fErr ""
|
||||
switch -exact -- [lindex $args 0] {
|
||||
-error { set args [lassign $args fErr] }
|
||||
if {"-error" eq [lindex $args 0]} {
|
||||
set args [lassign $args fErr]
|
||||
}
|
||||
set lines [split [join $args] \n]
|
||||
foreach line $lines {
|
||||
@@ -95,16 +110,16 @@ proc hwaci-indented-notice {args} {
|
||||
|
||||
########################################################################
|
||||
# Returns 1 if cross-compiling, else 0.
|
||||
proc hwaci-is-cross-compiling {} {
|
||||
proc proj-is-cross-compiling {} {
|
||||
return [expr {[get-define host] ne [get-define build]}]
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# hwaci-lshift_ shifts $count elements from the list named $listVar
|
||||
# proj-lshift_ shifts $count elements from the list named $listVar
|
||||
# and returns them as a new list. On empty input, returns "".
|
||||
#
|
||||
# Modified slightly from: https://wiki.tcl-lang.org/page/lshift
|
||||
proc hwaci-lshift_ {listVar {count 1}} {
|
||||
proc proj-lshift_ {listVar {count 1}} {
|
||||
upvar 1 $listVar l
|
||||
if {![info exists l]} {
|
||||
# make the error message show the real variable name
|
||||
@@ -124,7 +139,7 @@ proc hwaci-lshift_ {listVar {count 1}} {
|
||||
# out any lines which begin with an number of whitespace followed by a
|
||||
# '#', and returns a value containing the [append]ed results of each
|
||||
# remaining line with a \n between each.
|
||||
proc hwaci-strip-hash-comments_ {val} {
|
||||
proc proj-strip-hash-comments_ {val} {
|
||||
set x {}
|
||||
foreach line [split $val \n] {
|
||||
if {![string match "#*" [string trimleft $line]]} {
|
||||
@@ -138,7 +153,7 @@ proc hwaci-strip-hash-comments_ {val} {
|
||||
# A proxy for cc-check-function-in-lib which "undoes" any changes that
|
||||
# routine makes to the LIBS define. Returns the result of
|
||||
# cc-check-function-in-lib.
|
||||
proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
|
||||
proc proj-check-function-in-lib {function libs {otherlibs {}}} {
|
||||
set found 0
|
||||
define-push {LIBS} {
|
||||
set found [cc-check-function-in-lib $function $libs $otherlibs]
|
||||
@@ -151,11 +166,11 @@ proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
|
||||
# by the -dirs {LIST} and -subdirs {LIST} flags (each of which have
|
||||
# sane defaults). Returns either the first matching dir or an empty
|
||||
# string. The return value does not contain the filename part.
|
||||
proc hwaci-search-for-header-dir {header args} {
|
||||
proc proj-search-for-header-dir {header args} {
|
||||
set subdirs {include}
|
||||
set dirs {/usr /usr/local /mingw}
|
||||
# Debatable:
|
||||
# if {![hwaci-is-cross-compiling]} {
|
||||
# if {![proj-is-cross-compiling]} {
|
||||
# lappend dirs [get-define prefix]
|
||||
# }
|
||||
while {[llength $args]} {
|
||||
@@ -163,7 +178,7 @@ proc hwaci-search-for-header-dir {header args} {
|
||||
-dirs { set args [lassign $args - dirs] }
|
||||
-subdirs { set args [lassign $args - subdirs] }
|
||||
default {
|
||||
hwaci-fatal "Unhandled argument: $args"
|
||||
proj-fatal "Unhandled argument: $args"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,22 +193,14 @@ proc hwaci-search-for-header-dir {header args} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# If $v is true, [puts $msg] is called, else puts is not called.
|
||||
#proc hwaci-maybe-verbose {v msg} {
|
||||
# if {$v} {
|
||||
# puts $msg
|
||||
# }
|
||||
#}
|
||||
|
||||
########################################################################
|
||||
# Usage: hwaci-find-executable-path ?-v? binaryName
|
||||
# Usage: proj-find-executable-path ?-v? binaryName
|
||||
#
|
||||
# Works similarly to autosetup's [find-executable-path $binName] but:
|
||||
#
|
||||
# - If the first arg is -v, it's verbose about searching, else it's quiet.
|
||||
#
|
||||
# Returns the full path to the result or an empty string.
|
||||
proc hwaci-find-executable-path {args} {
|
||||
proc proj-find-executable-path {args} {
|
||||
set binName $args
|
||||
set verbose 0
|
||||
if {[lindex $args 0] eq "-v"} {
|
||||
@@ -213,15 +220,15 @@ proc hwaci-find-executable-path {args} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Uses [hwaci-find-executable-path $binName] to (verbosely) search for
|
||||
# Uses [proj-find-executable-path $binName] to (verbosely) search for
|
||||
# a binary, sets a define (see below) to the result, and returns the
|
||||
# result (an empty string if not found).
|
||||
#
|
||||
# The define'd name is: if defName is empty then "BIN_X" is used,
|
||||
# where X is the upper-case form of $binName with any '-' characters
|
||||
# replaced with '_'.
|
||||
proc hwaci-bin-define {binName {defName {}}} {
|
||||
set check [hwaci-find-executable-path -v $binName]
|
||||
proc proj-bin-define {binName {defName {}}} {
|
||||
set check [proj-find-executable-path -v $binName]
|
||||
if {"" eq $defName} {
|
||||
set defName "BIN_[string toupper [string map {- _} $binName]]"
|
||||
}
|
||||
@@ -230,7 +237,7 @@ proc hwaci-bin-define {binName {defName {}}} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Usage: hwaci-first-bin-of bin...
|
||||
# Usage: proj-first-bin-of bin...
|
||||
#
|
||||
# Looks for the first binary found of the names passed to this
|
||||
# function. If a match is found, the full path to that binary is
|
||||
@@ -240,30 +247,18 @@ proc hwaci-bin-define {binName {defName {}}} {
|
||||
# any define'd name that function stores for the result (because the
|
||||
# caller has no sensible way of knowing which result it was unless
|
||||
# they pass only a single argument).
|
||||
proc hwaci-first-bin-of {args} {
|
||||
proc proj-first-bin-of {args} {
|
||||
set rc ""
|
||||
foreach b $args {
|
||||
set u [string toupper $b]
|
||||
# Note that cc-path-progs defines $u to false if it finds no match.
|
||||
if {[cc-path-progs $b]} {
|
||||
set u [string toupper $b]
|
||||
set x [get-define $u]
|
||||
undefine $u
|
||||
return $x
|
||||
set rc [get-define $u]
|
||||
}
|
||||
undefine $u
|
||||
if {"" ne $rc} break
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Looks for `bash` binary and dies if not found. On success, defines
|
||||
# BIN_BASH to the full path to bash and returns that value.
|
||||
#
|
||||
# TODO: move this out of this file and back into the 1 or 2 downstream
|
||||
# trees which use it.
|
||||
proc hwaci-require-bash {} {
|
||||
set bash [hwaci-bin-define bash]
|
||||
if {"" eq $bash} {
|
||||
user-error "Cannot find required bash shell"
|
||||
}
|
||||
return $bash
|
||||
return $rc
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -281,7 +276,7 @@ proc hwaci-require-bash {} {
|
||||
# passes --foo-bar to configure, even if that invocation would resolve
|
||||
# to the default value of baz. If the user does not explicitly pass in
|
||||
# --foo-bar (with or without a value) then this returns 0.
|
||||
proc hwaci-opt-was-provided {key} {
|
||||
proc proj-opt-was-provided {key} {
|
||||
dict exists $::autosetup(optset) $key
|
||||
}
|
||||
|
||||
@@ -290,7 +285,7 @@ proc hwaci-opt-was-provided {key} {
|
||||
# later with [opt-val], [opt-bool], and friends.
|
||||
#
|
||||
# Returns $val.
|
||||
proc hwaci-opt-set {flag {val 1}} {
|
||||
proc proj-opt-set {flag {val 1}} {
|
||||
global autosetup
|
||||
if {$flag ni $::autosetup(options)} {
|
||||
# We have to add this to autosetup(options) or else future calls
|
||||
@@ -304,15 +299,15 @@ proc hwaci-opt-set {flag {val 1}} {
|
||||
########################################################################
|
||||
# Returns 1 if $val appears to be a truthy value, else returns
|
||||
# 0. Truthy values are any of {1 on enabled yes}
|
||||
proc hwaci-val-truthy {val} {
|
||||
proc proj-val-truthy {val} {
|
||||
expr {$val in {1 on enabled yes}}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Returns 1 if [opt-val $flag] appears to be a truthy value or
|
||||
# [opt-bool $flag] is true. See hwaci-val-truthy.
|
||||
proc hwaci-opt-truthy {flag} {
|
||||
if {[hwaci-val-truthy [opt-val $flag]]} { return 1 }
|
||||
# [opt-bool $flag] is true. See proj-val-truthy.
|
||||
proc proj-opt-truthy {flag} {
|
||||
if {[proj-val-truthy [opt-val $flag]]} { return 1 }
|
||||
set rc 0
|
||||
catch {
|
||||
# opt-bool will throw if $flag is not a known boolean flag
|
||||
@@ -322,9 +317,9 @@ proc hwaci-opt-truthy {flag} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# If [hwaci-opt-truthy $flag] is true, eval $then, else eval $else.
|
||||
proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
|
||||
if {[hwaci-opt-truthy $boolFlag]} {
|
||||
# If [proj-opt-truthy $flag] is true, eval $then, else eval $else.
|
||||
proc proj-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
|
||||
if {[proj-opt-truthy $boolFlag]} {
|
||||
uplevel 1 $thenScript
|
||||
} else {
|
||||
uplevel 1 $elseScript
|
||||
@@ -332,23 +327,23 @@ proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# If [hwaci-opt-truthy $flag] then [define $def $iftrue] else [define
|
||||
# If [proj-opt-truthy $flag] then [define $def $iftrue] else [define
|
||||
# $def $iffalse]. If $msg is not empty, output [msg-checking $msg] and
|
||||
# a [msg-results ...] which corresponds to the result. Returns 1 if
|
||||
# the opt-truthy check passes, else 0.
|
||||
proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
|
||||
proc proj-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
|
||||
if {"" ne $msg} {
|
||||
msg-checking "$msg "
|
||||
}
|
||||
set rcMsg ""
|
||||
set rc 0
|
||||
if {[hwaci-opt-truthy $flag]} {
|
||||
if {[proj-opt-truthy $flag]} {
|
||||
define $def $iftrue
|
||||
set rc 1
|
||||
} else {
|
||||
define $def $iffalse
|
||||
}
|
||||
switch -- [hwaci-val-truthy [get-define $def]] {
|
||||
switch -- [proj-val-truthy [get-define $def]] {
|
||||
0 { set rcMsg no }
|
||||
1 { set rcMsg yes }
|
||||
}
|
||||
@@ -361,28 +356,28 @@ proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} {
|
||||
########################################################################
|
||||
# Args: [-v] optName defName {descr {}}
|
||||
#
|
||||
# Checks [hwaci-opt-truthy $optName] and calls [define $defName X]
|
||||
# Checks [proj-opt-truthy $optName] and calls [define $defName X]
|
||||
# where X is 0 for false and 1 for true. descr is an optional
|
||||
# [msg-checking] argument which defaults to $defName. Returns X.
|
||||
#
|
||||
# If args[0] is -v then the boolean semantics are inverted: if
|
||||
# the option is set, it gets define'd to 0, else 1. Returns the
|
||||
# define'd value.
|
||||
proc hwaci-opt-define-bool {args} {
|
||||
proc proj-opt-define-bool {args} {
|
||||
set invert 0
|
||||
if {[lindex $args 0] eq "-v"} {
|
||||
set invert 1
|
||||
set args [lrange $args 1 end]
|
||||
}
|
||||
set optName [hwaci-lshift_ args]
|
||||
set defName [hwaci-lshift_ args]
|
||||
set descr [hwaci-lshift_ args]
|
||||
set optName [proj-lshift_ args]
|
||||
set defName [proj-lshift_ args]
|
||||
set descr [proj-lshift_ args]
|
||||
if {"" eq $descr} {
|
||||
set descr $defName
|
||||
}
|
||||
set rc 0
|
||||
msg-checking "$descr ... "
|
||||
if {[hwaci-opt-truthy $optName]} {
|
||||
if {[proj-opt-truthy $optName]} {
|
||||
if {0 eq $invert} {
|
||||
set rc 1
|
||||
} else {
|
||||
@@ -414,7 +409,7 @@ proc hwaci-opt-define-bool {args} {
|
||||
#
|
||||
# Note that if it finds LIBLTDL it does not look for LIBDL, so will
|
||||
# report only that is has LIBLTDL.
|
||||
proc hwaci-check-module-loader {} {
|
||||
proc proj-check-module-loader {} {
|
||||
msg-checking "Looking for module-loader APIs... "
|
||||
if {99 ne [get-define LDFLAGS_MODULE_LOADER 99]} {
|
||||
if {1 eq [get-define HAVE_LIBLTDL 0]} {
|
||||
@@ -460,34 +455,44 @@ proc hwaci-check-module-loader {} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Sets all flags which would be set by hwaci-check-module-loader to
|
||||
# Sets all flags which would be set by proj-check-module-loader to
|
||||
# empty/falsy values, as if those checks had failed to find a module
|
||||
# loader. Intended to be called in place of that function when
|
||||
# a module loader is explicitly not desired.
|
||||
proc hwaci-no-check-module-loader {} {
|
||||
proc proj-no-check-module-loader {} {
|
||||
define HAVE_LIBDL 0
|
||||
define HAVE_LIBLTDL 0
|
||||
define LDFLAGS_MODULE_LOADER ""
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Opens the given file, reads all of its content, and returns it.
|
||||
proc hwaci-file-content {fname} {
|
||||
# Opens the given file, reads all of its content, and returns it. If
|
||||
# the first arg is -trim, the contents of the file named by the second
|
||||
# argument are trimmed before returning them.
|
||||
proc proj-file-content {args} {
|
||||
set trim 0
|
||||
set fname $args
|
||||
if {"-trim" eq [lindex $args 0]} {
|
||||
set trim 1
|
||||
lassign $args - fname
|
||||
}
|
||||
set fp [open $fname r]
|
||||
set rc [read $fp]
|
||||
close $fp
|
||||
if {$trim} { return [string trim $rc] }
|
||||
return $rc
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Returns the contents of the given file as an array of lines, with
|
||||
# the EOL stripped from each input line.
|
||||
proc hwaci-file-content-list {fname} {
|
||||
proc proj-file-content-list {fname} {
|
||||
set fp [open $fname r]
|
||||
set rc {}
|
||||
while { [gets $fp line] >= 0 } {
|
||||
lappend rc $line
|
||||
}
|
||||
close $fp
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -501,9 +506,9 @@ proc hwaci-file-content-list {fname} {
|
||||
#
|
||||
# This test has a long history of false positive results because of
|
||||
# compilers reacting differently to the -MJ flag.
|
||||
proc hwaci-check-compile-commands {{configOpt {}}} {
|
||||
proc proj-check-compile-commands {{configOpt {}}} {
|
||||
msg-checking "compile_commands.json support... "
|
||||
if {"" ne $configOpt && ![hwaci-opt-truthy $configOpt]} {
|
||||
if {"" ne $configOpt && ![proj-opt-truthy $configOpt]} {
|
||||
msg-result "explicitly disabled"
|
||||
define MAKE_COMPILATION_DB no
|
||||
return 0
|
||||
@@ -525,14 +530,14 @@ proc hwaci-check-compile-commands {{configOpt {}}} {
|
||||
|
||||
########################################################################
|
||||
# Runs the 'touch' command on one or more files, ignoring any errors.
|
||||
proc hwaci-touch {filename} {
|
||||
proc proj-touch {filename} {
|
||||
catch { exec touch {*}$filename }
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Usage:
|
||||
#
|
||||
# hwaci-make-from-dot-in ?-touch? filename(s)...
|
||||
# proj-make-from-dot-in ?-touch? filename(s)...
|
||||
#
|
||||
# Uses [make-template] to create makefile(-like) file(s) $filename
|
||||
# from $filename.in but explicitly makes the output read-only, to
|
||||
@@ -545,7 +550,7 @@ proc hwaci-touch {filename} {
|
||||
# please the build process.
|
||||
#
|
||||
# Failures when running chmod or touch are silently ignored.
|
||||
proc hwaci-make-from-dot-in {args} {
|
||||
proc proj-make-from-dot-in {args} {
|
||||
set filename $args
|
||||
set touch 0
|
||||
if {[lindex $args 0] eq "-touch"} {
|
||||
@@ -557,7 +562,7 @@ proc hwaci-make-from-dot-in {args} {
|
||||
catch { exec chmod u+w $f }
|
||||
make-template $f.in $f
|
||||
if {$touch} {
|
||||
hwaci-touch $f
|
||||
proj-touch $f
|
||||
}
|
||||
catch { exec chmod -w $f }
|
||||
}
|
||||
@@ -574,9 +579,9 @@ proc hwaci-make-from-dot-in {args} {
|
||||
# order to avoid potential problems with escaping, space-containing
|
||||
# tokens, and interfering with autosetup's use of these vars, this
|
||||
# routine does not directly modify CFLAGS or LDFLAGS.
|
||||
proc hwaci-check-profile-flag {{flagname profile}} {
|
||||
#puts "flagname=$flagname ?[hwaci-opt-truthy $flagname]?"
|
||||
if {[hwaci-opt-truthy $flagname]} {
|
||||
proc proj-check-profile-flag {{flagname profile}} {
|
||||
#puts "flagname=$flagname ?[proj-opt-truthy $flagname]?"
|
||||
if {[proj-opt-truthy $flagname]} {
|
||||
set CC [get-define CC]
|
||||
regsub {.*ccache *} $CC "" CC
|
||||
# ^^^ if CC="ccache gcc" then [exec] treats "ccache gcc" as a
|
||||
@@ -602,7 +607,7 @@ proc hwaci-check-profile-flag {{flagname profile}} {
|
||||
# machine, i.e. the local host). If $key == "build" then some
|
||||
# additional checks may be performed which are not applicable when
|
||||
# $key == "host".
|
||||
proc hwaci-looks-like-windows {{key host}} {
|
||||
proc proj-looks-like-windows {{key host}} {
|
||||
global autosetup
|
||||
switch -glob -- [get-define $key] {
|
||||
*-*-ming* - *-*-cygwin - *-*-msys {
|
||||
@@ -628,7 +633,7 @@ proc hwaci-looks-like-windows {{key host}} {
|
||||
#
|
||||
# TODO: have someone verify whether this is correct for the
|
||||
# non-Linux/BSD platforms.
|
||||
proc hwaci-looks-like-mac {{key host}} {
|
||||
proc proj-looks-like-mac {{key host}} {
|
||||
switch -glob -- [get-define $key] {
|
||||
*apple* {
|
||||
return 1
|
||||
@@ -645,13 +650,13 @@ proc hwaci-looks-like-mac {{key host}} {
|
||||
# build environment is then BUILD_EXEEXT is [define]'d to ".exe", else
|
||||
# "". If the target, a.k.a. "host", is then TARGET_EXEEXT is
|
||||
# [define]'d to ".exe", else "".
|
||||
proc hwaci-exe-extension {} {
|
||||
proc proj-exe-extension {} {
|
||||
set rH ""
|
||||
set rB ""
|
||||
if {[hwaci-looks-like-windows host]} {
|
||||
if {[proj-looks-like-windows host]} {
|
||||
set rH ".exe"
|
||||
}
|
||||
if {[hwaci-looks-like-windows build]} {
|
||||
if {[proj-looks-like-windows build]} {
|
||||
set rB ".exe"
|
||||
}
|
||||
define BUILD_EXEEXT $rB
|
||||
@@ -659,7 +664,7 @@ proc hwaci-exe-extension {} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Works like hwaci-exe-extension except that it defines BUILD_DLLEXT
|
||||
# Works like proj-exe-extension except that it defines BUILD_DLLEXT
|
||||
# and TARGET_DLLEXT to one of (.so, ,dll, .dylib).
|
||||
#
|
||||
# Trivia: for .dylib files, the linker needs the -dynamiclib flag
|
||||
@@ -667,7 +672,7 @@ proc hwaci-exe-extension {} {
|
||||
#
|
||||
# TODO: have someone verify whether this is correct for the
|
||||
# non-Linux/BSD platforms.
|
||||
proc hwaci-dll-extension {} {
|
||||
proc proj-dll-extension {} {
|
||||
proc inner {key} {
|
||||
switch -glob -- [get-define $key] {
|
||||
*apple* {
|
||||
@@ -686,10 +691,10 @@ proc hwaci-dll-extension {} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Static-library counterpart of hwaci-dll-extension. Defines
|
||||
# Static-library counterpart of proj-dll-extension. Defines
|
||||
# BUILD_LIBEXT and TARGET_LIBEXT to the conventional static library
|
||||
# extension for the being-built-on resp. the target platform.
|
||||
proc hwaci-lib-extension {} {
|
||||
proc proj-lib-extension {} {
|
||||
proc inner {key} {
|
||||
switch -glob -- [get-define $key] {
|
||||
*-*-ming* - *-*-cygwin - *-*-msys {
|
||||
@@ -705,11 +710,11 @@ proc hwaci-lib-extension {} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Calls all of the hwaci-*-extension functions.
|
||||
proc hwaci-file-extensions {} {
|
||||
hwaci-exe-extension
|
||||
hwaci-dll-extension
|
||||
hwaci-lib-extension
|
||||
# Calls all of the proj-*-extension functions.
|
||||
proc proj-file-extensions {} {
|
||||
proj-exe-extension
|
||||
proj-dll-extension
|
||||
proj-lib-extension
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -717,7 +722,7 @@ proc hwaci-file-extensions {} {
|
||||
# the filesystem, it fails fatally with an informative message.
|
||||
# Returns the last file name it checks. If the first argument is -v
|
||||
# then it emits msg-checking/msg-result messages for each file.
|
||||
proc hwaci-affirm-files-exist {args} {
|
||||
proc proj-affirm-files-exist {args} {
|
||||
set rc ""
|
||||
set verbose 0
|
||||
if {[lindex $args 0] eq "-v"} {
|
||||
@@ -753,7 +758,7 @@ proc hwaci-affirm-files-exist {args} {
|
||||
# but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
|
||||
# case we have to rely on the fact that sourcing $EMSDK_ENV from a
|
||||
# shell will add emcc to the $PATH.
|
||||
proc hwaci-check-emsdk {} {
|
||||
proc proj-check-emsdk {} {
|
||||
set emsdkHome [opt-val with-emsdk]
|
||||
define EMSDK_HOME ""
|
||||
define EMSDK_ENV ""
|
||||
@@ -794,7 +799,7 @@ proc hwaci-check-emsdk {} {
|
||||
# Achtung: we have seen platforms which report that a given option
|
||||
# checked here will work but then fails at build-time, and the current
|
||||
# order of checks reflects that.
|
||||
proc hwaci-check-rpath {} {
|
||||
proc proj-check-rpath {} {
|
||||
set rc 1
|
||||
set lp "[get-define prefix]/lib"
|
||||
# If we _don't_ use cc-with {} here (to avoid updating the global
|
||||
@@ -804,6 +809,8 @@ proc hwaci-check-rpath {} {
|
||||
cc-with {} {
|
||||
if {[cc-check-flags "-rpath $lp"]} {
|
||||
define LDFLAGS_RPATH "-rpath $lp"
|
||||
} elseif {[cc-check-flags "-Wl,-rpath,$lp"]} {
|
||||
define LDFLAGS_RPATH "-Wl,-rpath,$lp"
|
||||
} elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} {
|
||||
define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
|
||||
} elseif {[cc-check-flags -Wl,-R$lp]} {
|
||||
@@ -817,120 +824,12 @@ proc hwaci-check-rpath {} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Check for availability of libreadline. Linking in readline varies
|
||||
# wildly by platform and this check does not cover all known options.
|
||||
# This detection is known to fail under the following conditions:
|
||||
#
|
||||
# - (pkg-config readline) info is either unavailable for libreadline or
|
||||
# simply misbehaves.
|
||||
#
|
||||
# - Either of readline.h or libreadline are in an exotic place.
|
||||
#
|
||||
# Defines the following vars:
|
||||
#
|
||||
# - HAVE_READLINE: 0 or 1
|
||||
# - LDFLAGS_READLINE: "" or linker flags
|
||||
# - CFLAGS_READLINE: "" or c-flags
|
||||
#
|
||||
# Quirks:
|
||||
#
|
||||
# - If readline.h is found in a directory name matching *line then the
|
||||
# resulting -I... flag points one directory _up_ from that, under
|
||||
# the assumption that client-side code will #include
|
||||
# <readline/readline.h>.
|
||||
#
|
||||
# Returns the value of HAVE_READLINE.
|
||||
proc hwaci-check-readline {} {
|
||||
define HAVE_READLINE 0
|
||||
define LDFLAGS_READLINE ""
|
||||
define CFLAGS_READLINE ""
|
||||
if {![opt-bool readline]} {
|
||||
msg-result "libreadline disabled via --disable-readline."
|
||||
return 0
|
||||
}
|
||||
|
||||
if {[pkg-config-init 0] && [pkg-config readline]} {
|
||||
define HAVE_READLINE 1
|
||||
define LDFLAGS_READLINE [get-define PKG_READLINE_LDFLAGS]
|
||||
define-append LDFLAGS_READLINE [get-define PKG_READLINE_LIBS]
|
||||
define CFLAGS_READLINE [get-define PKG_READLINE_CFLAGS]
|
||||
return 1
|
||||
}
|
||||
|
||||
# On OpenBSD on a Raspberry pi 4:
|
||||
#
|
||||
# $ pkg-config readline; echo $?
|
||||
# 0
|
||||
# $ pkg-config --cflags readline
|
||||
# Package termcap was not found in the pkg-config search path
|
||||
# $ echo $?
|
||||
# 1
|
||||
# $ pkg-config --print-requires readline; echo $?
|
||||
# 1
|
||||
#
|
||||
# i.e. there's apparently no way to find out that readline requires
|
||||
# termcap beyond parsing the error message. It turns out it doesn't
|
||||
# want termcap, it wants -lcurses, but we don't get that info from
|
||||
# pkg-config either.
|
||||
|
||||
# Look for readline.h
|
||||
set rlInc ""
|
||||
if {![hwaci-is-cross-compiling]} {
|
||||
# ^^^ this check is derived from SQLite's legacy configure script
|
||||
set rlInc [hwaci-search-for-header-dir readline.h \
|
||||
-subdirs {include/readline include}]
|
||||
if {"" ne $rlInc} {
|
||||
if {[string match */*line $rlInc]} {
|
||||
# Special case: if the path includes .../*line/readline.h", set
|
||||
# the -I to one dir up from that because our sources include
|
||||
# <readline/readline.h> or <editline/readline.h>. Reminder: if
|
||||
# auto.def is being run by jimsh0 then [file normalize] will not
|
||||
# work!
|
||||
set rlInc [file dirname $v]
|
||||
}
|
||||
set rlInc "-I${rlInc}"
|
||||
}
|
||||
}
|
||||
|
||||
# If readline.h was found/specified, look for libreadline...
|
||||
set rlLib ""
|
||||
if {"" ne $rlInc} {
|
||||
set libTerm ""
|
||||
if {[hwaci-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
|
||||
# ^^^ check extracted from an ancient autotools configure script.
|
||||
set libTerm [get-define lib_tgetent]
|
||||
undefine lib_tgetent
|
||||
}
|
||||
if {"readline" eq $libTerm} {
|
||||
set rlLib $libTerm
|
||||
} elseif {[hwaci-check-function-in-lib readline readline $libTerm]} {
|
||||
set rlLib [get-define lib_readline]
|
||||
lappend rlLib $libTerm
|
||||
undefine lib_readline
|
||||
}
|
||||
}
|
||||
|
||||
if {"" ne $rlLib} {
|
||||
set rlLib [join $rlLib]
|
||||
define LDFLAGS_READLINE $rlLib
|
||||
define CFLAGS_READLINE $rlInc
|
||||
define HAVE_READLINE 1
|
||||
msg-result "Using readline with flags: $rlInc $rlLib"
|
||||
return 1
|
||||
}
|
||||
|
||||
msg-result "libreadline not found."
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
########################################################################
|
||||
# Internal helper for hwaci-dump-defs-json. Expects to be passed a
|
||||
# Internal helper for proj-dump-defs-json. Expects to be passed a
|
||||
# [define] name and the variadic $args which are passed to
|
||||
# hwaci-dump-defs-json. If it finds a pattern match for the given
|
||||
# proj-dump-defs-json. If it finds a pattern match for the given
|
||||
# $name in the various $args, it returns the type flag for that $name,
|
||||
# e.g. "-str" or "-bare", else returns an empty string.
|
||||
proc hwaci-defs-type_ {name spec} {
|
||||
proc proj-defs-type_ {name spec} {
|
||||
foreach {type patterns} $spec {
|
||||
foreach pattern $patterns {
|
||||
if {[string match $pattern $name]} {
|
||||
@@ -942,50 +841,50 @@ proc hwaci-defs-type_ {name spec} {
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Internal helper for hwaci-defs-format_: returns a JSON-ish quoted
|
||||
# Internal helper for proj-defs-format_: returns a JSON-ish quoted
|
||||
# form of the given (JSON) string-type values.
|
||||
proc hwaci-quote-str_ {value} {
|
||||
proc proj-quote-str_ {value} {
|
||||
return \"[string map [list \\ \\\\ \" \\\"] $value]\"
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# An internal impl detail of hwaci-dump-defs-json. Requires a data
|
||||
# An internal impl detail of proj-dump-defs-json. Requires a data
|
||||
# type specifier, as used by make-config-header, and a value. Returns
|
||||
# the formatted value or the value $::hwaci_(defs-skip) if the caller
|
||||
# the formatted value or the value $::proj_(defs-skip) if the caller
|
||||
# should skip emitting that value.
|
||||
set hwaci_(defs-skip) "-hwaci-defs-format_ sentinel"
|
||||
proc hwaci-defs-format_ {type value} {
|
||||
set proj_(defs-skip) "-proj-defs-format_ sentinel"
|
||||
proc proj-defs-format_ {type value} {
|
||||
switch -exact -- $type {
|
||||
-bare {
|
||||
# Just output the value unchanged
|
||||
}
|
||||
-none {
|
||||
set value $::hwaci_(defs-skip)
|
||||
set value $::proj_(defs-skip)
|
||||
}
|
||||
-str {
|
||||
set value [hwaci-quote-str_ $value]
|
||||
set value [proj-quote-str_ $value]
|
||||
}
|
||||
-auto {
|
||||
# Automatically determine the type
|
||||
if {![string is integer -strict $value]} {
|
||||
set value [hwaci-quote-str_ $value]
|
||||
set value [proj-quote-str_ $value]
|
||||
}
|
||||
}
|
||||
-array {
|
||||
set ar {}
|
||||
foreach v $value {
|
||||
set v [hwaci-defs-format_ -auto $v]
|
||||
if {$::hwaci_(defs-skip) ne $v} {
|
||||
set v [proj-defs-format_ -auto $v]
|
||||
if {$::proj_(defs-skip) ne $v} {
|
||||
lappend ar $v
|
||||
}
|
||||
}
|
||||
set value "\[ [join $ar {, }] \]"
|
||||
}
|
||||
"" {
|
||||
set value $::hwaci_(defs-skip)
|
||||
set value $::proj_(defs-skip)
|
||||
}
|
||||
default {
|
||||
hwaci-fatal "Unknown type in hwaci-dump-defs-json: $type"
|
||||
proj-fatal "Unknown type in proj-dump-defs-json: $type"
|
||||
}
|
||||
}
|
||||
return $value
|
||||
@@ -1021,14 +920,14 @@ proc hwaci-defs-format_ {type value} {
|
||||
# Neither is especially satisfactory (and the second is useless), and
|
||||
# handling of such values is subject to change if any such values ever
|
||||
# _really_ need to be processed by our source trees.
|
||||
proc hwaci-dump-defs-json {file args} {
|
||||
proc proj-dump-defs-json {file args} {
|
||||
file mkdir [file dirname $file]
|
||||
set lines {}
|
||||
lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
|
||||
foreach n [lsort [dict keys [all-defines]]] {
|
||||
set type [hwaci-defs-type_ $n $args]
|
||||
set value [hwaci-defs-format_ $type [get-define $n]]
|
||||
if {$::hwaci_(defs-skip) ne $value} {
|
||||
set type [proj-defs-type_ $n $args]
|
||||
set value [proj-defs-format_ $type [get-define $n]]
|
||||
if {$::proj_(defs-skip) ne $value} {
|
||||
lappend lines "\"$n\": ${value}"
|
||||
}
|
||||
}
|
||||
@@ -1050,12 +949,12 @@ proc hwaci-dump-defs-json {file args} {
|
||||
# form which autosetup will expect for passing to [opt-val NAME] and
|
||||
# friends.
|
||||
#
|
||||
# Commend lines are permitted in the input.
|
||||
# Comment lines are permitted in the input.
|
||||
#
|
||||
# If [opt-val $hidden] has a value but [opt-val
|
||||
# $canonical] does not, it copies the former over the latter. If
|
||||
# $hidden has no value set, this is a no-op. If both have explicit
|
||||
# values a fatal usage error is triggered.
|
||||
# For each pair ALIAS and CANONICAL, if --ALIAS is provided but
|
||||
# --CANONICAL is not, the value of the former is copied to the
|
||||
# latter. If --ALIAS is not provided, this is a no-op. If both have
|
||||
# explicitly been provided a fatal usage error is triggered.
|
||||
#
|
||||
# Motivation: autosetup enables "hidden aliases" in [options] lists,
|
||||
# and elides the aliases from --help output but does no further
|
||||
@@ -1067,14 +966,13 @@ proc hwaci-dump-defs-json {file args} {
|
||||
# to carry over any values from hidden aliases into their canonical
|
||||
# names, so that in the above example [opt-value canonical] will
|
||||
# return X if --alias=X is passed in.
|
||||
proc hwaci-xfer-options-aliases {mapping} {
|
||||
foreach {hidden => canonical} [hwaci-strip-hash-comments_ $mapping] {
|
||||
set x [opt-val $hidden "~9~9~9~"]
|
||||
if {"~9~9~9~" ne $x} {
|
||||
if {"~0~0~0~" eq [opt-val $canonical "~0~0~0~"]} {
|
||||
hwaci-opt-set $canonical $x
|
||||
proc proj-xfer-options-aliases {mapping} {
|
||||
foreach {hidden - canonical} [proj-strip-hash-comments_ $mapping] {
|
||||
if {[proj-opt-was-provided $hidden]} {
|
||||
if {[proj-opt-was-provided $canonical]} {
|
||||
proj-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
|
||||
} else {
|
||||
hwaci-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
|
||||
proj-opt-set $canonical [opt-val $hidden]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1096,11 +994,25 @@ proc hwaci-xfer-options-aliases {mapping} {
|
||||
# Sidebar: if we do this before the cc package is installed, it gets
|
||||
# reverted by that package. Ergo, the cc package init will tell the
|
||||
# user "Build C compiler...cc" shortly before we tell them:
|
||||
proc hwaci-redefine-cc-for-build {} {
|
||||
if {![hwaci-is-cross-compiling]
|
||||
proc proj-redefine-cc-for-build {} {
|
||||
if {![proj-is-cross-compiling]
|
||||
&& "nope" eq [get-env CC_FOR_BUILD "nope"]
|
||||
&& [get-define CC] ne [get-define CC_FOR_BUILD]} {
|
||||
user-notice "Re-defining CC_FOR_BUILD to CC=[get-define CC]. To avoid this, explicitly pass CC_FOR_BUILD=..."
|
||||
define CC_FOR_BUILD [get-define CC]
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Attempts to determine whether the given linenoise header file is of
|
||||
# the "antirez" or "msteveb" flavor. It returns 2 for msteveb, else 1
|
||||
# (it does not validate that the header otherwise contains the
|
||||
# linenoise API).
|
||||
proc proj-which-linenoise {dotH} {
|
||||
set srcHeader [proj-file-content $dotH]
|
||||
if {[string match *userdata* $srcHeader]} {
|
||||
return 2
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
NOTE (2012-11-29):
|
||||
|
||||
The functionality implemented by this extension has been superseded
|
||||
by WAL-mode. This module is no longer supported or maintained. The
|
||||
code is retained for historical reference only.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Normally, when SQLite writes to a database file, it waits until the write
|
||||
operation is finished before returning control to the calling application.
|
||||
Since writing to the file-system is usually very slow compared with CPU
|
||||
bound operations, this can be a performance bottleneck. This directory
|
||||
contains an extension that causes SQLite to perform all write requests
|
||||
using a separate thread running in the background. Although this does not
|
||||
reduce the overall system resources (CPU, disk bandwidth etc.) at all, it
|
||||
allows SQLite to return control to the caller quickly even when writing to
|
||||
the database, eliminating the bottleneck.
|
||||
|
||||
1. Functionality
|
||||
|
||||
1.1 How it Works
|
||||
1.2 Limitations
|
||||
1.3 Locking and Concurrency
|
||||
|
||||
2. Compilation and Usage
|
||||
|
||||
3. Porting
|
||||
|
||||
|
||||
|
||||
1. FUNCTIONALITY
|
||||
|
||||
With asynchronous I/O, write requests are handled by a separate thread
|
||||
running in the background. This means that the thread that initiates
|
||||
a database write does not have to wait for (sometimes slow) disk I/O
|
||||
to occur. The write seems to happen very quickly, though in reality
|
||||
it is happening at its usual slow pace in the background.
|
||||
|
||||
Asynchronous I/O appears to give better responsiveness, but at a price.
|
||||
You lose the Durable property. With the default I/O backend of SQLite,
|
||||
once a write completes, you know that the information you wrote is
|
||||
safely on disk. With the asynchronous I/O, this is not the case. If
|
||||
your program crashes or if a power loss occurs after the database
|
||||
write but before the asynchronous write thread has completed, then the
|
||||
database change might never make it to disk and the next user of the
|
||||
database might not see your change.
|
||||
|
||||
You lose Durability with asynchronous I/O, but you still retain the
|
||||
other parts of ACID: Atomic, Consistent, and Isolated. Many
|
||||
appliations get along fine without the Durablity.
|
||||
|
||||
1.1 How it Works
|
||||
|
||||
Asynchronous I/O works by creating a special SQLite "vfs" structure
|
||||
and registering it with sqlite3_vfs_register(). When files opened via
|
||||
this vfs are written to (using the vfs xWrite() method), the data is not
|
||||
written directly to disk, but is placed in the "write-queue" to be
|
||||
handled by the background thread.
|
||||
|
||||
When files opened with the asynchronous vfs are read from
|
||||
(using the vfs xRead() method), the data is read from the file on
|
||||
disk and the write-queue, so that from the point of view of
|
||||
the vfs reader the xWrite() appears to have already completed.
|
||||
|
||||
The special vfs is registered (and unregistered) by calls to the
|
||||
API functions sqlite3async_initialize() and sqlite3async_shutdown().
|
||||
See section "Compilation and Usage" below for details.
|
||||
|
||||
1.2 Limitations
|
||||
|
||||
In order to gain experience with the main ideas surrounding asynchronous
|
||||
IO, this implementation is deliberately kept simple. Additional
|
||||
capabilities may be added in the future.
|
||||
|
||||
For example, as currently implemented, if writes are happening at a
|
||||
steady stream that exceeds the I/O capability of the background writer
|
||||
thread, the queue of pending write operations will grow without bound.
|
||||
If this goes on for long enough, the host system could run out of memory.
|
||||
A more sophisticated module could to keep track of the quantity of
|
||||
pending writes and stop accepting new write requests when the queue of
|
||||
pending writes grows too large.
|
||||
|
||||
1.3 Locking and Concurrency
|
||||
|
||||
Multiple connections from within a single process that use this
|
||||
implementation of asynchronous IO may access a single database
|
||||
file concurrently. From the point of view of the user, if all
|
||||
connections are from within a single process, there is no difference
|
||||
between the concurrency offered by "normal" SQLite and SQLite
|
||||
using the asynchronous backend.
|
||||
|
||||
If file-locking is enabled (it is enabled by default), then connections
|
||||
from multiple processes may also read and write the database file.
|
||||
However concurrency is reduced as follows:
|
||||
|
||||
* When a connection using asynchronous IO begins a database
|
||||
transaction, the database is locked immediately. However the
|
||||
lock is not released until after all relevant operations
|
||||
in the write-queue have been flushed to disk. This means
|
||||
(for example) that the database may remain locked for some
|
||||
time after a "COMMIT" or "ROLLBACK" is issued.
|
||||
|
||||
* If an application using asynchronous IO executes transactions
|
||||
in quick succession, other database users may be effectively
|
||||
locked out of the database. This is because when a BEGIN
|
||||
is executed, a database lock is established immediately. But
|
||||
when the corresponding COMMIT or ROLLBACK occurs, the lock
|
||||
is not released until the relevant part of the write-queue
|
||||
has been flushed through. As a result, if a COMMIT is followed
|
||||
by a BEGIN before the write-queue is flushed through, the database
|
||||
is never unlocked,preventing other processes from accessing
|
||||
the database.
|
||||
|
||||
File-locking may be disabled at runtime using the sqlite3async_control()
|
||||
API (see below). This may improve performance when an NFS or other
|
||||
network file-system, as the synchronous round-trips to the server be
|
||||
required to establish file locks are avoided. However, if multiple
|
||||
connections attempt to access the same database file when file-locking
|
||||
is disabled, application crashes and database corruption is a likely
|
||||
outcome.
|
||||
|
||||
|
||||
2. COMPILATION AND USAGE
|
||||
|
||||
The asynchronous IO extension consists of a single file of C code
|
||||
(sqlite3async.c), and a header file (sqlite3async.h) that defines the
|
||||
C API used by applications to activate and control the modules
|
||||
functionality.
|
||||
|
||||
To use the asynchronous IO extension, compile sqlite3async.c as
|
||||
part of the application that uses SQLite. Then use the API defined
|
||||
in sqlite3async.h to initialize and configure the module.
|
||||
|
||||
The asynchronous IO VFS API is described in detail in comments in
|
||||
sqlite3async.h. Using the API usually consists of the following steps:
|
||||
|
||||
1. Register the asynchronous IO VFS with SQLite by calling the
|
||||
sqlite3async_initialize() function.
|
||||
|
||||
2. Create a background thread to perform write operations and call
|
||||
sqlite3async_run().
|
||||
|
||||
3. Use the normal SQLite API to read and write to databases via
|
||||
the asynchronous IO VFS.
|
||||
|
||||
Refer to sqlite3async.h for details.
|
||||
|
||||
|
||||
3. PORTING
|
||||
|
||||
Currently the asynchronous IO extension is compatible with win32 systems
|
||||
and systems that support the pthreads interface, including Mac OSX, Linux,
|
||||
and other varieties of Unix.
|
||||
|
||||
To port the asynchronous IO extension to another platform, the user must
|
||||
implement mutex and condition variable primitives for the new platform.
|
||||
Currently there is no externally available interface to allow this, but
|
||||
modifying the code within sqlite3async.c to include the new platforms
|
||||
concurrency primitives is relatively easy. Search within sqlite3async.c
|
||||
for the comment string "PORTING FUNCTIONS" for details. Then implement
|
||||
new versions of each of the following:
|
||||
|
||||
static void async_mutex_enter(int eMutex);
|
||||
static void async_mutex_leave(int eMutex);
|
||||
static void async_cond_wait(int eCond, int eMutex);
|
||||
static void async_cond_signal(int eCond);
|
||||
static void async_sched_yield(void);
|
||||
|
||||
The functionality required of each of the above functions is described
|
||||
in comments in sqlite3async.c.
|
||||
@@ -1,222 +0,0 @@
|
||||
|
||||
#ifndef __SQLITEASYNC_H_
|
||||
#define __SQLITEASYNC_H_ 1
|
||||
|
||||
/*
|
||||
** Make sure we can call this stuff from C++.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SQLITEASYNC_VFSNAME "sqlite3async"
|
||||
|
||||
/*
|
||||
** THREAD SAFETY NOTES:
|
||||
**
|
||||
** Of the four API functions in this file, the following are not threadsafe:
|
||||
**
|
||||
** sqlite3async_initialize()
|
||||
** sqlite3async_shutdown()
|
||||
**
|
||||
** Care must be taken that neither of these functions is called while
|
||||
** another thread may be calling either any sqlite3async_XXX() function
|
||||
** or an sqlite3_XXX() API function related to a database handle that
|
||||
** is using the asynchronous IO VFS.
|
||||
**
|
||||
** These functions:
|
||||
**
|
||||
** sqlite3async_run()
|
||||
** sqlite3async_control()
|
||||
**
|
||||
** are threadsafe. It is quite safe to call either of these functions even
|
||||
** if another thread may also be calling one of them or an sqlite3_XXX()
|
||||
** function related to a database handle that uses the asynchronous IO VFS.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Initialize the asynchronous IO VFS and register it with SQLite using
|
||||
** sqlite3_vfs_register(). If the asynchronous VFS is already initialized
|
||||
** and registered, this function is a no-op. The asynchronous IO VFS
|
||||
** is registered as "sqlite3async".
|
||||
**
|
||||
** The asynchronous IO VFS does not make operating system IO requests
|
||||
** directly. Instead, it uses an existing VFS implementation for all
|
||||
** required file-system operations. If the first parameter to this function
|
||||
** is NULL, then the current default VFS is used for IO. If it is not
|
||||
** NULL, then it must be the name of an existing VFS. In other words, the
|
||||
** first argument to this function is passed to sqlite3_vfs_find() to
|
||||
** locate the VFS to use for all real IO operations. This VFS is known
|
||||
** as the "parent VFS".
|
||||
**
|
||||
** If the second parameter to this function is non-zero, then the
|
||||
** asynchronous IO VFS is registered as the default VFS for all SQLite
|
||||
** database connections within the process. Otherwise, the asynchronous IO
|
||||
** VFS is only used by connections opened using sqlite3_open_v2() that
|
||||
** specifically request VFS "sqlite3async".
|
||||
**
|
||||
** If a parent VFS cannot be located, then SQLITE_ERROR is returned.
|
||||
** In the unlikely event that operating system specific initialization
|
||||
** fails (win32 systems create the required critical section and event
|
||||
** objects within this function), then SQLITE_ERROR is also returned.
|
||||
** Finally, if the call to sqlite3_vfs_register() returns an error, then
|
||||
** the error code is returned to the user by this function. In all three
|
||||
** of these cases, intialization has failed and the asynchronous IO VFS
|
||||
** is not registered with SQLite.
|
||||
**
|
||||
** Otherwise, if no error occurs, SQLITE_OK is returned.
|
||||
*/
|
||||
int sqlite3async_initialize(const char *zParent, int isDefault);
|
||||
|
||||
/*
|
||||
** This function unregisters the asynchronous IO VFS using
|
||||
** sqlite3_vfs_unregister().
|
||||
**
|
||||
** On win32 platforms, this function also releases the small number of
|
||||
** critical section and event objects created by sqlite3async_initialize().
|
||||
*/
|
||||
void sqlite3async_shutdown(void);
|
||||
|
||||
/*
|
||||
** This function may only be called when the asynchronous IO VFS is
|
||||
** installed (after a call to sqlite3async_initialize()). It processes
|
||||
** zero or more queued write operations before returning. It is expected
|
||||
** (but not required) that this function will be called by a different
|
||||
** thread than those threads that use SQLite. The "background thread"
|
||||
** that performs IO.
|
||||
**
|
||||
** How many queued write operations are performed before returning
|
||||
** depends on the global setting configured by passing the SQLITEASYNC_HALT
|
||||
** verb to sqlite3async_control() (see below for details). By default
|
||||
** this function never returns - it processes all pending operations and
|
||||
** then blocks waiting for new ones.
|
||||
**
|
||||
** If multiple simultaneous calls are made to sqlite3async_run() from two
|
||||
** or more threads, then the calls are serialized internally.
|
||||
*/
|
||||
void sqlite3async_run(void);
|
||||
|
||||
/*
|
||||
** This function may only be called when the asynchronous IO VFS is
|
||||
** installed (after a call to sqlite3async_initialize()). It is used
|
||||
** to query or configure various parameters that affect the operation
|
||||
** of the asynchronous IO VFS. At present there are three parameters
|
||||
** supported:
|
||||
**
|
||||
** * The "halt" parameter, which configures the circumstances under
|
||||
** which the sqlite3async_run() parameter is configured.
|
||||
**
|
||||
** * The "delay" parameter. Setting the delay parameter to a non-zero
|
||||
** value causes the sqlite3async_run() function to sleep for the
|
||||
** configured number of milliseconds between each queued write
|
||||
** operation.
|
||||
**
|
||||
** * The "lockfiles" parameter. This parameter determines whether or
|
||||
** not the asynchronous IO VFS locks the database files it operates
|
||||
** on. Disabling file locking can improve throughput.
|
||||
**
|
||||
** This function is always passed two arguments. When setting the value
|
||||
** of a parameter, the first argument must be one of SQLITEASYNC_HALT,
|
||||
** SQLITEASYNC_DELAY or SQLITEASYNC_LOCKFILES. The second argument must
|
||||
** be passed the new value for the parameter as type "int".
|
||||
**
|
||||
** When querying the current value of a paramter, the first argument must
|
||||
** be one of SQLITEASYNC_GET_HALT, GET_DELAY or GET_LOCKFILES. The second
|
||||
** argument to this function must be of type (int *). The current value
|
||||
** of the queried parameter is copied to the memory pointed to by the
|
||||
** second argument. For example:
|
||||
**
|
||||
** int eCurrentHalt;
|
||||
** int eNewHalt = SQLITEASYNC_HALT_IDLE;
|
||||
**
|
||||
** sqlite3async_control(SQLITEASYNC_HALT, eNewHalt);
|
||||
** sqlite3async_control(SQLITEASYNC_GET_HALT, &eCurrentHalt);
|
||||
** assert( eNewHalt==eCurrentHalt );
|
||||
**
|
||||
** See below for more detail on each configuration parameter.
|
||||
**
|
||||
** SQLITEASYNC_HALT:
|
||||
**
|
||||
** This is used to set the value of the "halt" parameter. The second
|
||||
** argument must be one of the SQLITEASYNC_HALT_XXX symbols defined
|
||||
** below (either NEVER, IDLE and NOW).
|
||||
**
|
||||
** If the parameter is set to NEVER, then calls to sqlite3async_run()
|
||||
** never return. This is the default setting. If the parameter is set
|
||||
** to IDLE, then calls to sqlite3async_run() return as soon as the
|
||||
** queue of pending write operations is empty. If the parameter is set
|
||||
** to NOW, then calls to sqlite3async_run() return as quickly as
|
||||
** possible, without processing any pending write requests.
|
||||
**
|
||||
** If an attempt is made to set this parameter to an integer value other
|
||||
** than SQLITEASYNC_HALT_NEVER, IDLE or NOW, then sqlite3async_control()
|
||||
** returns SQLITE_MISUSE and the current value of the parameter is not
|
||||
** modified.
|
||||
**
|
||||
** Modifying the "halt" parameter affects calls to sqlite3async_run()
|
||||
** made by other threads that are currently in progress.
|
||||
**
|
||||
** SQLITEASYNC_DELAY:
|
||||
**
|
||||
** This is used to set the value of the "delay" parameter. If set to
|
||||
** a non-zero value, then after completing a pending write request, the
|
||||
** sqlite3async_run() function sleeps for the configured number of
|
||||
** milliseconds.
|
||||
**
|
||||
** If an attempt is made to set this parameter to a negative value,
|
||||
** sqlite3async_control() returns SQLITE_MISUSE and the current value
|
||||
** of the parameter is not modified.
|
||||
**
|
||||
** Modifying the "delay" parameter affects calls to sqlite3async_run()
|
||||
** made by other threads that are currently in progress.
|
||||
**
|
||||
** SQLITEASYNC_LOCKFILES:
|
||||
**
|
||||
** This is used to set the value of the "lockfiles" parameter. This
|
||||
** parameter must be set to either 0 or 1. If set to 1, then the
|
||||
** asynchronous IO VFS uses the xLock() and xUnlock() methods of the
|
||||
** parent VFS to lock database files being read and/or written. If
|
||||
** the parameter is set to 0, then these locks are omitted.
|
||||
**
|
||||
** This parameter may only be set when there are no open database
|
||||
** connections using the VFS and the queue of pending write requests
|
||||
** is empty. Attempting to set it when this is not true, or to set it
|
||||
** to a value other than 0 or 1 causes sqlite3async_control() to return
|
||||
** SQLITE_MISUSE and the value of the parameter to remain unchanged.
|
||||
**
|
||||
** If this parameter is set to zero, then it is only safe to access the
|
||||
** database via the asynchronous IO VFS from within a single process. If
|
||||
** while writing to the database via the asynchronous IO VFS the database
|
||||
** is also read or written from within another process, or via another
|
||||
** connection that does not use the asynchronous IO VFS within the same
|
||||
** process, the results are undefined (and may include crashes or database
|
||||
** corruption).
|
||||
**
|
||||
** Alternatively, if this parameter is set to 1, then it is safe to access
|
||||
** the database from multiple connections within multiple processes using
|
||||
** either the asynchronous IO VFS or the parent VFS directly.
|
||||
*/
|
||||
int sqlite3async_control(int op, ...);
|
||||
|
||||
/*
|
||||
** Values that can be used as the first argument to sqlite3async_control().
|
||||
*/
|
||||
#define SQLITEASYNC_HALT 1
|
||||
#define SQLITEASYNC_GET_HALT 2
|
||||
#define SQLITEASYNC_DELAY 3
|
||||
#define SQLITEASYNC_GET_DELAY 4
|
||||
#define SQLITEASYNC_LOCKFILES 5
|
||||
#define SQLITEASYNC_GET_LOCKFILES 6
|
||||
|
||||
/*
|
||||
** If the first argument to sqlite3async_control() is SQLITEASYNC_HALT,
|
||||
** the second argument should be one of the following.
|
||||
*/
|
||||
#define SQLITEASYNC_HALT_NEVER 0 /* Never halt (default value) */
|
||||
#define SQLITEASYNC_HALT_NOW 1 /* Halt as soon as possible */
|
||||
#define SQLITEASYNC_HALT_IDLE 2 /* Halt when write-queue is empty */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of the 'extern "C"' block */
|
||||
#endif
|
||||
#endif /* ifndef __SQLITEASYNC_H_ */
|
||||
@@ -1,773 +0,0 @@
|
||||
/*
|
||||
** 2023 November 4
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
********************************************************************************
|
||||
** This file implements various interfaces used for console and stream I/O
|
||||
** by the SQLite project command-line tools, as explained in console_io.h .
|
||||
** Functions prefixed by "SQLITE_INTERNAL_LINKAGE" behave as described there.
|
||||
*/
|
||||
|
||||
#ifndef SQLITE_CDECL
|
||||
# define SQLITE_CDECL
|
||||
#endif
|
||||
|
||||
#ifndef SHELL_NO_SYSINC
|
||||
# include <stdarg.h>
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
# include <limits.h>
|
||||
# include <assert.h>
|
||||
# include "sqlite3.h"
|
||||
#endif
|
||||
#ifndef HAVE_CONSOLE_IO_H
|
||||
# include "console_io.h"
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable : 4204)
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
# if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT
|
||||
# ifndef SHELL_NO_SYSINC
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
# undef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# endif
|
||||
# define CIO_WIN_WC_XLATE 1 /* Use WCHAR Windows APIs for console I/O */
|
||||
# else
|
||||
# ifndef SHELL_NO_SYSINC
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# define CIO_WIN_WC_XLATE 0 /* Use plain C library stream I/O at console */
|
||||
# endif
|
||||
#else
|
||||
# define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */
|
||||
#endif
|
||||
|
||||
#if CIO_WIN_WC_XLATE
|
||||
static HANDLE handleOfFile(FILE *pf){
|
||||
int fileDesc = _fileno(pf);
|
||||
union { intptr_t osfh; HANDLE fh; } fid = {
|
||||
(fileDesc>=0)? _get_osfhandle(fileDesc) : (intptr_t)INVALID_HANDLE_VALUE
|
||||
};
|
||||
return fid.fh;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
typedef struct PerStreamTags {
|
||||
# if CIO_WIN_WC_XLATE
|
||||
HANDLE hx;
|
||||
DWORD consMode;
|
||||
char acIncomplete[4];
|
||||
# else
|
||||
short reachesConsole;
|
||||
# endif
|
||||
FILE *pf;
|
||||
} PerStreamTags;
|
||||
|
||||
/* Define NULL-like value for things which can validly be 0. */
|
||||
# define SHELL_INVALID_FILE_PTR ((FILE *)~0)
|
||||
# if CIO_WIN_WC_XLATE
|
||||
# define SHELL_INVALID_CONS_MODE 0xFFFF0000
|
||||
# endif
|
||||
|
||||
# if CIO_WIN_WC_XLATE
|
||||
# define PST_INITIALIZER { INVALID_HANDLE_VALUE, SHELL_INVALID_CONS_MODE, \
|
||||
{0,0,0,0}, SHELL_INVALID_FILE_PTR }
|
||||
# else
|
||||
# define PST_INITIALIZER { 0, SHELL_INVALID_FILE_PTR }
|
||||
# endif
|
||||
|
||||
/* Quickly say whether a known output is going to the console. */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
static short pstReachesConsole(PerStreamTags *ppst){
|
||||
return (ppst->hx != INVALID_HANDLE_VALUE);
|
||||
}
|
||||
# else
|
||||
# define pstReachesConsole(ppst) 0
|
||||
# endif
|
||||
|
||||
# if CIO_WIN_WC_XLATE
|
||||
static void restoreConsoleArb(PerStreamTags *ppst){
|
||||
if( pstReachesConsole(ppst) ) SetConsoleMode(ppst->hx, ppst->consMode);
|
||||
}
|
||||
# else
|
||||
# define restoreConsoleArb(ppst)
|
||||
# endif
|
||||
|
||||
/* Say whether FILE* appears to be a console, collect associated info. */
|
||||
static short streamOfConsole(FILE *pf, /* out */ PerStreamTags *ppst){
|
||||
# if CIO_WIN_WC_XLATE
|
||||
short rv = 0;
|
||||
DWORD dwCM = SHELL_INVALID_CONS_MODE;
|
||||
HANDLE fh = handleOfFile(pf);
|
||||
ppst->pf = pf;
|
||||
if( INVALID_HANDLE_VALUE != fh ){
|
||||
rv = (GetFileType(fh) == FILE_TYPE_CHAR && GetConsoleMode(fh,&dwCM));
|
||||
}
|
||||
ppst->hx = (rv)? fh : INVALID_HANDLE_VALUE;
|
||||
ppst->consMode = dwCM;
|
||||
return rv;
|
||||
# else
|
||||
ppst->pf = pf;
|
||||
ppst->reachesConsole = ( (short)isatty(fileno(pf)) );
|
||||
return ppst->reachesConsole;
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
# define ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
|
||||
# endif
|
||||
|
||||
# if CIO_WIN_WC_XLATE
|
||||
/* Define console modes for use with the Windows Console API. */
|
||||
# define SHELL_CONI_MODE \
|
||||
(ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT | 0x80 \
|
||||
| ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT)
|
||||
# define SHELL_CONO_MODE (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT \
|
||||
| ENABLE_VIRTUAL_TERMINAL_PROCESSING)
|
||||
# endif
|
||||
|
||||
typedef struct ConsoleInfo {
|
||||
PerStreamTags pstSetup[3];
|
||||
PerStreamTags pstDesignated[3];
|
||||
StreamsAreConsole sacSetup;
|
||||
} ConsoleInfo;
|
||||
|
||||
static short isValidStreamInfo(PerStreamTags *ppst){
|
||||
return (ppst->pf != SHELL_INVALID_FILE_PTR);
|
||||
}
|
||||
|
||||
static ConsoleInfo consoleInfo = {
|
||||
{ /* pstSetup */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
|
||||
{ /* pstDesignated[] */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER },
|
||||
SAC_NoConsole /* sacSetup */
|
||||
};
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE FILE* invalidFileStream = (FILE *)~0;
|
||||
|
||||
# if CIO_WIN_WC_XLATE
|
||||
static void maybeSetupAsConsole(PerStreamTags *ppst, short odir){
|
||||
if( pstReachesConsole(ppst) ){
|
||||
DWORD cm = odir? SHELL_CONO_MODE : SHELL_CONI_MODE;
|
||||
SetConsoleMode(ppst->hx, cm);
|
||||
}
|
||||
}
|
||||
# else
|
||||
# define maybeSetupAsConsole(ppst,odir)
|
||||
# endif
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void){
|
||||
# if CIO_WIN_WC_XLATE
|
||||
int ix = 0;
|
||||
while( ix < 6 ){
|
||||
PerStreamTags *ppst = (ix<3)?
|
||||
&consoleInfo.pstSetup[ix] : &consoleInfo.pstDesignated[ix-3];
|
||||
maybeSetupAsConsole(ppst, (ix % 3)>0);
|
||||
++ix;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE StreamsAreConsole
|
||||
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){
|
||||
StreamsAreConsole rv = SAC_NoConsole;
|
||||
FILE* apf[3] = { pfIn, pfOut, pfErr };
|
||||
int ix;
|
||||
for( ix = 2; ix >= 0; --ix ){
|
||||
PerStreamTags *ppst = &consoleInfo.pstSetup[ix];
|
||||
if( streamOfConsole(apf[ix], ppst) ){
|
||||
rv |= (SAC_InConsole<<ix);
|
||||
}
|
||||
consoleInfo.pstDesignated[ix] = *ppst;
|
||||
if( ix > 0 ) fflush(apf[ix]);
|
||||
}
|
||||
consoleInfo.sacSetup = rv;
|
||||
consoleRenewSetup();
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ){
|
||||
# if CIO_WIN_WC_XLATE
|
||||
static ConsoleInfo *pci = &consoleInfo;
|
||||
if( pci->sacSetup ){
|
||||
int ix;
|
||||
for( ix=0; ix<3; ++ix ){
|
||||
if( pci->sacSetup & (SAC_InConsole<<ix) ){
|
||||
PerStreamTags *ppst = &pci->pstSetup[ix];
|
||||
SetConsoleMode(ppst->hx, ppst->consMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#ifdef SQLITE_CIO_INPUT_REDIR
|
||||
/* Say whether given FILE* is among those known, via either
|
||||
** consoleClassifySetup() or set{Output,Error}Stream, as
|
||||
** readable, and return an associated PerStreamTags pointer
|
||||
** if so. Otherwise, return 0.
|
||||
*/
|
||||
static PerStreamTags * isKnownReadable(FILE *pf){
|
||||
static PerStreamTags *apst[] = {
|
||||
&consoleInfo.pstDesignated[0], &consoleInfo.pstSetup[0], 0
|
||||
};
|
||||
int ix = 0;
|
||||
do {
|
||||
if( apst[ix]->pf == pf ) break;
|
||||
} while( apst[++ix] != 0 );
|
||||
return apst[ix];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
/* Say whether given FILE* is among those known, via either
|
||||
** consoleClassifySetup() or set{Output,Error}Stream, as
|
||||
** writable, and return an associated PerStreamTags pointer
|
||||
** if so. Otherwise, return 0.
|
||||
*/
|
||||
static PerStreamTags * isKnownWritable(FILE *pf){
|
||||
static PerStreamTags *apst[] = {
|
||||
&consoleInfo.pstDesignated[1], &consoleInfo.pstDesignated[2],
|
||||
&consoleInfo.pstSetup[1], &consoleInfo.pstSetup[2], 0
|
||||
};
|
||||
int ix = 0;
|
||||
do {
|
||||
if( apst[ix]->pf == pf ) break;
|
||||
} while( apst[++ix] != 0 );
|
||||
return apst[ix];
|
||||
}
|
||||
|
||||
static FILE *designateEmitStream(FILE *pf, unsigned chix){
|
||||
FILE *rv = consoleInfo.pstDesignated[chix].pf;
|
||||
if( pf == invalidFileStream ) return rv;
|
||||
else{
|
||||
/* Setting a possibly new output stream. */
|
||||
PerStreamTags *ppst = isKnownWritable(pf);
|
||||
if( ppst != 0 ){
|
||||
PerStreamTags pst = *ppst;
|
||||
consoleInfo.pstDesignated[chix] = pst;
|
||||
}else streamOfConsole(pf, &consoleInfo.pstDesignated[chix]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf){
|
||||
return designateEmitStream(pf, 1);
|
||||
}
|
||||
# ifdef CONSIO_SET_ERROR_STREAM
|
||||
SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf){
|
||||
return designateEmitStream(pf, 2);
|
||||
}
|
||||
# endif
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#ifndef SQLITE_CIO_NO_SETMODE
|
||||
# if CIO_WIN_WC_XLATE
|
||||
static void setModeFlushQ(FILE *pf, short bFlush, int mode){
|
||||
if( bFlush ) fflush(pf);
|
||||
_setmode(_fileno(pf), mode);
|
||||
}
|
||||
# else
|
||||
# define setModeFlushQ(f, b, m) if(b) fflush(f)
|
||||
# endif
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *pf, short bFlush){
|
||||
setModeFlushQ(pf, bFlush, _O_BINARY);
|
||||
}
|
||||
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *pf, short bFlush){
|
||||
setModeFlushQ(pf, bFlush, _O_TEXT);
|
||||
}
|
||||
# undef setModeFlushQ
|
||||
|
||||
#else /* defined(SQLITE_CIO_NO_SETMODE) */
|
||||
# define setBinaryMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
|
||||
# define setTextMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0)
|
||||
#endif /* defined(SQLITE_CIO_NO_SETMODE) */
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
# if CIO_WIN_WC_XLATE
|
||||
/* Write buffer cBuf as output to stream known to reach console,
|
||||
** limited to ncTake char's. Return ncTake on success, else 0. */
|
||||
static int conZstrEmit(PerStreamTags *ppst, const char *z, int ncTake){
|
||||
int rv = 0;
|
||||
if( z!=NULL ){
|
||||
int nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, 0,0);
|
||||
if( nwc > 0 ){
|
||||
WCHAR *zw = sqlite3_malloc64(nwc*sizeof(WCHAR));
|
||||
if( zw!=NULL ){
|
||||
nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, zw,nwc);
|
||||
if( nwc > 0 ){
|
||||
/* Translation from UTF-8 to UTF-16, then WCHARs out. */
|
||||
if( WriteConsoleW(ppst->hx, zw,nwc, 0, NULL) ){
|
||||
rv = ncTake;
|
||||
}
|
||||
}
|
||||
sqlite3_free(zw);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* For {f,o,e}PrintfUtf8() when stream is known to reach console. */
|
||||
static int conioVmPrintf(PerStreamTags *ppst, const char *zFormat, va_list ap){
|
||||
char *z = sqlite3_vmprintf(zFormat, ap);
|
||||
if( z ){
|
||||
int rv = conZstrEmit(ppst, z, (int)strlen(z));
|
||||
sqlite3_free(z);
|
||||
return rv;
|
||||
}else return 0;
|
||||
}
|
||||
# endif /* CIO_WIN_WC_XLATE */
|
||||
|
||||
# ifdef CONSIO_GET_EMIT_STREAM
|
||||
static PerStreamTags * getDesignatedEmitStream(FILE *pf, unsigned chix,
|
||||
PerStreamTags *ppst){
|
||||
PerStreamTags *rv = isKnownWritable(pf);
|
||||
short isValid = (rv!=0)? isValidStreamInfo(rv) : 0;
|
||||
if( rv != 0 && isValid ) return rv;
|
||||
streamOfConsole(pf, ppst);
|
||||
return ppst;
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Get stream info, either for designated output or error stream when
|
||||
** chix equals 1 or 2, or for an arbitrary stream when chix == 0.
|
||||
** In either case, ppst references a caller-owned PerStreamTags
|
||||
** struct which may be filled in if none of the known writable
|
||||
** streams is being held by consoleInfo. The ppf parameter is a
|
||||
** byref output when chix!=0 and a byref input when chix==0.
|
||||
*/
|
||||
static PerStreamTags *
|
||||
getEmitStreamInfo(unsigned chix, PerStreamTags *ppst,
|
||||
/* in/out */ FILE **ppf){
|
||||
PerStreamTags *ppstTry;
|
||||
FILE *pfEmit;
|
||||
if( chix > 0 ){
|
||||
ppstTry = &consoleInfo.pstDesignated[chix];
|
||||
if( !isValidStreamInfo(ppstTry) ){
|
||||
ppstTry = &consoleInfo.pstSetup[chix];
|
||||
pfEmit = ppst->pf;
|
||||
}else pfEmit = ppstTry->pf;
|
||||
if( !isValidStreamInfo(ppstTry) ){
|
||||
pfEmit = (chix > 1)? stderr : stdout;
|
||||
ppstTry = ppst;
|
||||
streamOfConsole(pfEmit, ppstTry);
|
||||
}
|
||||
*ppf = pfEmit;
|
||||
}else{
|
||||
ppstTry = isKnownWritable(*ppf);
|
||||
if( ppstTry != 0 ) return ppstTry;
|
||||
streamOfConsole(*ppf, ppst);
|
||||
return ppst;
|
||||
}
|
||||
return ppstTry;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...){
|
||||
va_list ap;
|
||||
int rv;
|
||||
FILE *pfOut;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# else
|
||||
getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# endif
|
||||
assert(zFormat!=0);
|
||||
va_start(ap, zFormat);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
rv = conioVmPrintf(ppst, zFormat, ap);
|
||||
}else{
|
||||
# endif
|
||||
rv = vfprintf(pfOut, zFormat, ap);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...){
|
||||
va_list ap;
|
||||
int rv;
|
||||
FILE *pfErr;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
|
||||
# else
|
||||
getEmitStreamInfo(2, &pst, &pfErr);
|
||||
# endif
|
||||
assert(zFormat!=0);
|
||||
va_start(ap, zFormat);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
rv = conioVmPrintf(ppst, zFormat, ap);
|
||||
}else{
|
||||
# endif
|
||||
rv = vfprintf(pfErr, zFormat, ap);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...){
|
||||
va_list ap;
|
||||
int rv;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
|
||||
# else
|
||||
getEmitStreamInfo(0, &pst, &pfO);
|
||||
# endif
|
||||
assert(zFormat!=0);
|
||||
va_start(ap, zFormat);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
maybeSetupAsConsole(ppst, 1);
|
||||
rv = conioVmPrintf(ppst, zFormat, ap);
|
||||
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
|
||||
}else{
|
||||
# endif
|
||||
rv = vfprintf(pfO, zFormat, ap);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO){
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
|
||||
# else
|
||||
getEmitStreamInfo(0, &pst, &pfO);
|
||||
# endif
|
||||
assert(z!=0);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
int rv;
|
||||
maybeSetupAsConsole(ppst, 1);
|
||||
rv = conZstrEmit(ppst, z, (int)strlen(z));
|
||||
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
|
||||
return rv;
|
||||
}else {
|
||||
# endif
|
||||
return (fputs(z, pfO)<0)? 0 : (int)strlen(z);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z){
|
||||
FILE *pfErr;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
|
||||
# else
|
||||
getEmitStreamInfo(2, &pst, &pfErr);
|
||||
# endif
|
||||
assert(z!=0);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
|
||||
else {
|
||||
# endif
|
||||
return (fputs(z, pfErr)<0)? 0 : (int)strlen(z);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){
|
||||
FILE *pfOut;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# else
|
||||
getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# endif
|
||||
assert(z!=0);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z));
|
||||
else {
|
||||
# endif
|
||||
return (fputs(z, pfOut)<0)? 0 : (int)strlen(z);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#if !(defined(SQLITE_CIO_NO_UTF8SCAN) && defined(SQLITE_CIO_NO_TRANSLATE))
|
||||
/* Skip over as much z[] input char sequence as is valid UTF-8,
|
||||
** limited per nAccept char's or whole characters and containing
|
||||
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
|
||||
** sequence z:return (inclusive:exclusive) is validated UTF-8.
|
||||
** Limit: nAccept>=0 => char count, nAccept<0 => character
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE const char*
|
||||
zSkipValidUtf8(const char *z, int nAccept, long ccm){
|
||||
int ng = (nAccept<0)? -nAccept : 0;
|
||||
const char *pcLimit = (nAccept>=0)? z+nAccept : 0;
|
||||
assert(z!=0);
|
||||
while( (pcLimit)? (z<pcLimit) : (ng-- != 0) ){
|
||||
char c = *z;
|
||||
if( (c & 0x80) == 0 ){
|
||||
if( ccm != 0L && c < 0x20 && ((1L<<c) & ccm) != 0 ) return z;
|
||||
++z; /* ASCII */
|
||||
}else if( (c & 0xC0) != 0xC0 ) return z; /* not a lead byte */
|
||||
else{
|
||||
const char *zt = z+1; /* Got lead byte, look at trail bytes.*/
|
||||
do{
|
||||
if( pcLimit && zt >= pcLimit ) return z;
|
||||
else{
|
||||
char ct = *zt++;
|
||||
if( ct==0 || (zt-z)>4 || (ct & 0xC0)!=0x80 ){
|
||||
/* Trailing bytes are too few, too many, or invalid. */
|
||||
return z;
|
||||
}
|
||||
}
|
||||
} while( ((c <<= 1) & 0x40) == 0x40 ); /* Eat lead byte's count. */
|
||||
z = zt;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
#endif /*!(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))*/
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
# ifdef CONSIO_SPUTB
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept){
|
||||
assert(pfO!=0);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO);
|
||||
if( pstReachesConsole(ppst) ){
|
||||
int rv;
|
||||
maybeSetupAsConsole(ppst, 1);
|
||||
rv = conZstrEmit(ppst, cBuf, nAccept);
|
||||
if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst);
|
||||
return rv;
|
||||
}else {
|
||||
# endif
|
||||
return (int)fwrite(cBuf, 1, nAccept, pfO);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
oPutbUtf8(const char *cBuf, int nAccept){
|
||||
FILE *pfOut;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
# if CIO_WIN_WC_XLATE
|
||||
PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# else
|
||||
getEmitStreamInfo(1, &pst, &pfOut);
|
||||
# endif
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
return conZstrEmit(ppst, cBuf, nAccept);
|
||||
}else {
|
||||
# endif
|
||||
return (int)fwrite(cBuf, 1, nAccept, pfOut);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
** Flush the given output stream. Return non-zero for success, else 0.
|
||||
*/
|
||||
#if !defined(SQLITE_CIO_NO_FLUSH) && !defined(SQLITE_CIO_NO_SETMODE)
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
fFlushBuffer(FILE *pfOut){
|
||||
# if CIO_WIN_WC_XLATE && !defined(SHELL_OMIT_FIO_DUPE)
|
||||
return FlushFileBuffers(handleOfFile(pfOut))? 1 : 0;
|
||||
# else
|
||||
return fflush(pfOut);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CIO_WIN_WC_XLATE \
|
||||
&& !defined(SHELL_OMIT_FIO_DUPE) \
|
||||
&& defined(SQLITE_USE_ONLY_WIN32)
|
||||
static struct FileAltIds {
|
||||
int fd;
|
||||
HANDLE fh;
|
||||
} altIdsOfFile(FILE *pf){
|
||||
struct FileAltIds rv = { _fileno(pf) };
|
||||
union { intptr_t osfh; HANDLE fh; } fid = {
|
||||
(rv.fd>=0)? _get_osfhandle(rv.fd) : (intptr_t)INVALID_HANDLE_VALUE
|
||||
};
|
||||
rv.fh = fid.fh;
|
||||
return rv;
|
||||
}
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE size_t
|
||||
cfWrite(const void *buf, size_t osz, size_t ocnt, FILE *pf){
|
||||
size_t rv = 0;
|
||||
struct FileAltIds fai = altIdsOfFile(pf);
|
||||
int fmode = _setmode(fai.fd, _O_BINARY);
|
||||
_setmode(fai.fd, fmode);
|
||||
while( rv < ocnt ){
|
||||
size_t nbo = osz;
|
||||
while( nbo > 0 ){
|
||||
DWORD dwno = (nbo>(1L<<24))? 1L<<24 : (DWORD)nbo;
|
||||
BOOL wrc = TRUE;
|
||||
BOOL genCR = (fmode & _O_TEXT)!=0;
|
||||
if( genCR ){
|
||||
const char *pnl = (const char*)memchr(buf, '\n', nbo);
|
||||
if( pnl ) nbo = pnl - (const char*)buf;
|
||||
else genCR = 0;
|
||||
}
|
||||
if( dwno>0 ) wrc = WriteFile(fai.fh, buf, dwno, 0,0);
|
||||
if( genCR && wrc ){
|
||||
wrc = WriteFile(fai.fh, "\r\n", 2, 0,0);
|
||||
++dwno; /* Skip over the LF */
|
||||
}
|
||||
if( !wrc ) return rv;
|
||||
buf = (const char*)buf + dwno;
|
||||
nbo += dwno;
|
||||
}
|
||||
++rv;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* An fgets() equivalent, using Win32 file API for actual input.
|
||||
** Input ends when given buffer is filled or a newline is read.
|
||||
** If the FILE object is in text mode, swallows 0x0D. (ASCII CR)
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE char *
|
||||
cfGets(char *cBuf, int n, FILE *pf){
|
||||
int nci = 0;
|
||||
struct FileAltIds fai = altIdsOfFile(pf);
|
||||
int fmode = _setmode(fai.fd, _O_BINARY);
|
||||
BOOL eatCR = (fmode & _O_TEXT)!=0;
|
||||
_setmode(fai.fd, fmode);
|
||||
while( nci < n-1 ){
|
||||
DWORD nr;
|
||||
if( !ReadFile(fai.fh, cBuf+nci, 1, &nr, 0) || nr==0 ) break;
|
||||
if( nr>0 && (!eatCR || cBuf[nci]!='\r') ){
|
||||
nci += nr;
|
||||
if( cBuf[nci-nr]=='\n' ) break;
|
||||
}
|
||||
}
|
||||
if( nci < n ) cBuf[nci] = 0;
|
||||
return (nci>0)? cBuf : 0;
|
||||
}
|
||||
# else
|
||||
# define cfWrite(b,os,no,f) fwrite(b,os,no,f)
|
||||
# define cfGets(b,n,f) fgets(b,n,f)
|
||||
# endif
|
||||
|
||||
# ifdef CONSIO_EPUTB
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
ePutbUtf8(const char *cBuf, int nAccept){
|
||||
FILE *pfErr;
|
||||
PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */
|
||||
PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pstReachesConsole(ppst) ){
|
||||
return conZstrEmit(ppst, cBuf, nAccept);
|
||||
}else {
|
||||
# endif
|
||||
return (int)cfWrite(cBuf, 1, nAccept, pfErr);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# endif /* defined(CONSIO_EPUTB) */
|
||||
|
||||
SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){
|
||||
if( pfIn==0 ) pfIn = stdin;
|
||||
# if CIO_WIN_WC_XLATE
|
||||
if( pfIn == consoleInfo.pstSetup[0].pf
|
||||
&& (consoleInfo.sacSetup & SAC_InConsole)!=0 ){
|
||||
# if CIO_WIN_WC_XLATE==1
|
||||
# define SHELL_GULP 150 /* Count of WCHARS to be gulped at a time */
|
||||
WCHAR wcBuf[SHELL_GULP+1];
|
||||
int lend = 0, noc = 0;
|
||||
if( ncMax > 0 ) cBuf[0] = 0;
|
||||
while( noc < ncMax-8-1 && !lend ){
|
||||
/* There is room for at least 2 more characters and a 0-terminator. */
|
||||
int na = (ncMax > SHELL_GULP*4+1 + noc)? SHELL_GULP : (ncMax-1 - noc)/4;
|
||||
# undef SHELL_GULP
|
||||
DWORD nbr = 0;
|
||||
BOOL bRC = ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf, na, &nbr, 0);
|
||||
if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){
|
||||
/* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */
|
||||
DWORD nbrx;
|
||||
bRC &= ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf+nbr, 1, &nbrx, 0);
|
||||
if( bRC ) nbr += nbrx;
|
||||
}
|
||||
if( !bRC || (noc==0 && nbr==0) ) return 0;
|
||||
if( nbr > 0 ){
|
||||
int nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,0,0,0,0);
|
||||
if( nmb != 0 && noc+nmb <= ncMax ){
|
||||
int iseg = noc;
|
||||
nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,cBuf+noc,nmb,0,0);
|
||||
noc += nmb;
|
||||
/* Fixup line-ends as coded by Windows for CR (or "Enter".)
|
||||
** This is done without regard for any setMode{Text,Binary}()
|
||||
** call that might have been done on the interactive input.
|
||||
*/
|
||||
if( noc > 0 ){
|
||||
if( cBuf[noc-1]=='\n' ){
|
||||
lend = 1;
|
||||
if( noc > 1 && cBuf[noc-2]=='\r' ) cBuf[--noc-1] = '\n';
|
||||
}
|
||||
}
|
||||
/* Check for ^Z (anywhere in line) too, to act as EOF. */
|
||||
while( iseg < noc ){
|
||||
if( cBuf[iseg]=='\x1a' ){
|
||||
noc = iseg; /* Chop ^Z and anything following. */
|
||||
lend = 1; /* Counts as end of line too. */
|
||||
break;
|
||||
}
|
||||
++iseg;
|
||||
}
|
||||
}else break; /* Drop apparent garbage in. (Could assert.) */
|
||||
}else break;
|
||||
}
|
||||
/* If got nothing, (after ^Z chop), must be at end-of-file. */
|
||||
if( noc > 0 ){
|
||||
cBuf[noc] = 0;
|
||||
return cBuf;
|
||||
}else return 0;
|
||||
# endif
|
||||
}else{
|
||||
# endif
|
||||
return cfGets(cBuf, ncMax, pfIn);
|
||||
# if CIO_WIN_WC_XLATE
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(default : 4204)
|
||||
#endif
|
||||
|
||||
#undef SHELL_INVALID_FILE_PTR
|
||||
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
** 2023 November 1
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
********************************************************************************
|
||||
** This file exposes various interfaces used for console and other I/O
|
||||
** by the SQLite project command-line tools. These interfaces are used
|
||||
** at either source conglomeration time, compilation time, or run time.
|
||||
** This source provides for either inclusion into conglomerated,
|
||||
** "single-source" forms or separate compilation then linking.
|
||||
**
|
||||
** Platform dependencies are "hidden" here by various stratagems so
|
||||
** that, provided certain conditions are met, the programs using this
|
||||
** source or object code compiled from it need no explicit conditional
|
||||
** compilation in their source for their console and stream I/O.
|
||||
**
|
||||
** The symbols and functionality exposed here are not a public API.
|
||||
** This code may change in tandem with other project code as needed.
|
||||
**
|
||||
** When this .h file and its companion .c are directly incorporated into
|
||||
** a source conglomeration (such as shell.c), the preprocessor symbol
|
||||
** CIO_WIN_WC_XLATE is defined as 0 or 1, reflecting whether console I/O
|
||||
** translation for Windows is effected for the build.
|
||||
*/
|
||||
#define HAVE_CONSOLE_IO_H 1
|
||||
#ifndef SQLITE_INTERNAL_LINKAGE
|
||||
# define SQLITE_INTERNAL_LINKAGE extern /* external to translation unit */
|
||||
# include <stdio.h>
|
||||
#else
|
||||
# define SHELL_NO_SYSINC /* Better yet, modify mkshellc.tcl for this. */
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE3_H
|
||||
# include "sqlite3.h"
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_CIO_NO_CLASSIFY
|
||||
|
||||
/* Define enum for use with following function. */
|
||||
typedef enum StreamsAreConsole {
|
||||
SAC_NoConsole = 0,
|
||||
SAC_InConsole = 1, SAC_OutConsole = 2, SAC_ErrConsole = 4,
|
||||
SAC_AnyConsole = 0x7
|
||||
} StreamsAreConsole;
|
||||
|
||||
/*
|
||||
** Classify the three standard I/O streams according to whether
|
||||
** they are connected to a console attached to the process.
|
||||
**
|
||||
** Returns the bit-wise OR of SAC_{In,Out,Err}Console values,
|
||||
** or SAC_NoConsole if none of the streams reaches a console.
|
||||
**
|
||||
** This function should be called before any I/O is done with
|
||||
** the given streams. As a side-effect, the given inputs are
|
||||
** recorded so that later I/O operations on them may be done
|
||||
** differently than the C library FILE* I/O would be done,
|
||||
** iff the stream is used for the I/O functions that follow,
|
||||
** and to support the ones that use an implicit stream.
|
||||
**
|
||||
** On some platforms, stream or console mode alteration (aka
|
||||
** "Setup") may be made which is undone by consoleRestore().
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE StreamsAreConsole
|
||||
consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr );
|
||||
/* A usual call for convenience: */
|
||||
#define SQLITE_STD_CONSOLE_INIT() consoleClassifySetup(stdin,stdout,stderr)
|
||||
|
||||
/*
|
||||
** After an initial call to consoleClassifySetup(...), renew
|
||||
** the same setup it effected. (A call not after is an error.)
|
||||
** This will restore state altered by consoleRestore();
|
||||
**
|
||||
** Applications which run an inferior (child) process which
|
||||
** inherits the same I/O streams may call this function after
|
||||
** such a process exits to guard against console mode changes.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void);
|
||||
|
||||
/*
|
||||
** Undo any side-effects left by consoleClassifySetup(...).
|
||||
**
|
||||
** This should be called after consoleClassifySetup() and
|
||||
** before the process terminates normally. It is suitable
|
||||
** for use with the atexit() C library procedure. After
|
||||
** this call, no console I/O should be done until one of
|
||||
** console{Classify or Renew}Setup(...) is called again.
|
||||
**
|
||||
** Applications which run an inferior (child) process that
|
||||
** inherits the same I/O streams might call this procedure
|
||||
** before so that said process will have a console setup
|
||||
** however users have configured it or come to expect.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void );
|
||||
|
||||
#else /* defined(SQLITE_CIO_NO_CLASSIFY) */
|
||||
# define consoleClassifySetup(i,o,e)
|
||||
# define consoleRenewSetup()
|
||||
# define consoleRestore()
|
||||
#endif /* defined(SQLITE_CIO_NO_CLASSIFY) */
|
||||
|
||||
#ifndef SQLITE_CIO_NO_REDIRECT
|
||||
/*
|
||||
** Set stream to be used for the functions below which write
|
||||
** to "the designated X stream", where X is Output or Error.
|
||||
** Returns the previous value.
|
||||
**
|
||||
** Alternatively, pass the special value, invalidFileStream,
|
||||
** to get the designated stream value without setting it.
|
||||
**
|
||||
** Before the designated streams are set, they default to
|
||||
** those passed to consoleClassifySetup(...), and before
|
||||
** that is called they default to stdout and stderr.
|
||||
**
|
||||
** It is error to close a stream so designated, then, without
|
||||
** designating another, use the corresponding {o,e}Emit(...).
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE FILE *invalidFileStream;
|
||||
SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf);
|
||||
# ifdef CONSIO_SET_ERROR_STREAM
|
||||
SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf);
|
||||
# endif
|
||||
#else
|
||||
# define setOutputStream(pf)
|
||||
# define setErrorStream(pf)
|
||||
#endif /* !defined(SQLITE_CIO_NO_REDIRECT) */
|
||||
|
||||
#ifndef SQLITE_CIO_NO_TRANSLATE
|
||||
/*
|
||||
** Emit output like fprintf(). If the output is going to the
|
||||
** console and translation from UTF-8 is necessary, perform
|
||||
** the needed translation. Otherwise, write formatted output
|
||||
** to the provided stream almost as-is, possibly with newline
|
||||
** translation as specified by set{Binary,Text}Mode().
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...);
|
||||
/* Like fPrintfUtf8 except stream is always the designated output. */
|
||||
SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...);
|
||||
/* Like fPrintfUtf8 except stream is always the designated error. */
|
||||
SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...);
|
||||
|
||||
/*
|
||||
** Emit output like fputs(). If the output is going to the
|
||||
** console and translation from UTF-8 is necessary, perform
|
||||
** the needed translation. Otherwise, write given text to the
|
||||
** provided stream almost as-is, possibly with newline
|
||||
** translation as specified by set{Binary,Text}Mode().
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO);
|
||||
/* Like fPutsUtf8 except stream is always the designated output. */
|
||||
SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z);
|
||||
/* Like fPutsUtf8 except stream is always the designated error. */
|
||||
SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z);
|
||||
|
||||
/*
|
||||
** Emit output like fPutsUtf8(), except that the length of the
|
||||
** accepted char or character sequence is limited by nAccept.
|
||||
**
|
||||
** Returns the number of accepted char values.
|
||||
*/
|
||||
#ifdef CONSIO_SPUTB
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
fPutbUtf8(FILE *pfOut, const char *cBuf, int nAccept);
|
||||
/* Like fPutbUtf8 except stream is always the designated output. */
|
||||
#endif
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
oPutbUtf8(const char *cBuf, int nAccept);
|
||||
/* Like fPutbUtf8 except stream is always the designated error. */
|
||||
#ifdef CONSIO_EPUTB
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
ePutbUtf8(const char *cBuf, int nAccept);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Flush the given output stream. Return non-zero for success, else 0.
|
||||
*/
|
||||
#if !defined(SQLITE_CIO_NO_FLUSH) && !defined(SQLITE_CIO_NO_SETMODE)
|
||||
SQLITE_INTERNAL_LINKAGE int
|
||||
fFlushBuffer(FILE *pfOut);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Collect input like fgets(...) with special provisions for input
|
||||
** from the console on such platforms as require same. Newline
|
||||
** translation may be done as set by set{Binary,Text}Mode().
|
||||
** As a convenience, pfIn==NULL is treated as stdin.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn);
|
||||
/* Like fGetsUtf8 except stream is always the designated input. */
|
||||
/* SQLITE_INTERNAL_LINKAGE char* iGetsUtf8(char *cBuf, int ncMax); */
|
||||
|
||||
#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */
|
||||
|
||||
#ifndef SQLITE_CIO_NO_SETMODE
|
||||
/*
|
||||
** Set given stream for binary mode, where newline translation is
|
||||
** not done, or for text mode where, for some platforms, newlines
|
||||
** are translated to the platform's conventional char sequence.
|
||||
** If bFlush true, flush the stream.
|
||||
**
|
||||
** An additional side-effect is that if the stream is one passed
|
||||
** to consoleClassifySetup() as an output, it is flushed first.
|
||||
**
|
||||
** Note that binary/text mode has no effect on console I/O
|
||||
** translation. On all platforms, newline to the console starts
|
||||
** a new line and CR,LF chars from the console become a newline.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *, short bFlush);
|
||||
SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *, short bFlush);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_CIO_PROMPTED_IN
|
||||
typedef struct Prompts {
|
||||
int numPrompts;
|
||||
const char **azPrompts;
|
||||
} Prompts;
|
||||
|
||||
/*
|
||||
** Macros for use of a line editor.
|
||||
**
|
||||
** The following macros define operations involving use of a
|
||||
** line-editing library or simple console interaction.
|
||||
** A "T" argument is a text (char *) buffer or filename.
|
||||
** A "N" argument is an integer.
|
||||
**
|
||||
** SHELL_ADD_HISTORY(T) // Record text as line(s) of history.
|
||||
** SHELL_READ_HISTORY(T) // Read history from file named by T.
|
||||
** SHELL_WRITE_HISTORY(T) // Write history to file named by T.
|
||||
** SHELL_STIFLE_HISTORY(N) // Limit history to N entries.
|
||||
**
|
||||
** A console program which does interactive console input is
|
||||
** expected to call:
|
||||
** SHELL_READ_HISTORY(T) before collecting such input;
|
||||
** SHELL_ADD_HISTORY(T) as record-worthy input is taken;
|
||||
** SHELL_STIFLE_HISTORY(N) after console input ceases; then
|
||||
** SHELL_WRITE_HISTORY(T) before the program exits.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Retrieve a single line of input text from an input stream.
|
||||
**
|
||||
** If pfIn is the input stream passed to consoleClassifySetup(),
|
||||
** and azPrompt is not NULL, then a prompt is issued before the
|
||||
** line is collected, as selected by the isContinuation flag.
|
||||
** Array azPrompt[{0,1}] holds the {main,continuation} prompt.
|
||||
**
|
||||
** If zBufPrior is not NULL then it is a buffer from a prior
|
||||
** call to this routine that can be reused, or will be freed.
|
||||
**
|
||||
** The result is stored in space obtained from malloc() and
|
||||
** must either be freed by the caller or else passed back to
|
||||
** this function as zBufPrior for reuse.
|
||||
**
|
||||
** This function may call upon services of a line-editing
|
||||
** library to interactively collect line edited input.
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE char *
|
||||
shellGetLine(FILE *pfIn, char *zBufPrior, int nLen,
|
||||
short isContinuation, Prompts azPrompt);
|
||||
#endif /* defined(SQLITE_CIO_PROMPTED_IN) */
|
||||
/*
|
||||
** TBD: Define an interface for application(s) to generate
|
||||
** completion candidates for use by the line-editor.
|
||||
**
|
||||
** This may be premature; the CLI is the only application
|
||||
** that does this. Yet, getting line-editing melded into
|
||||
** console I/O is desirable because a line-editing library
|
||||
** may have to establish console operating mode, possibly
|
||||
** in a way that interferes with the above functionality.
|
||||
*/
|
||||
|
||||
#if !(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))
|
||||
/* Skip over as much z[] input char sequence as is valid UTF-8,
|
||||
** limited per nAccept char's or whole characters and containing
|
||||
** no char cn such that ((1<<cn) & ccm)!=0. On return, the
|
||||
** sequence z:return (inclusive:exclusive) is validated UTF-8.
|
||||
** Limit: nAccept>=0 => char count, nAccept<0 => character
|
||||
*/
|
||||
SQLITE_INTERNAL_LINKAGE const char*
|
||||
zSkipValidUtf8(const char *z, int nAccept, long ccm);
|
||||
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
** 2014-09-08
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** This file contains the application interface definitions for the
|
||||
** user-authentication extension feature.
|
||||
**
|
||||
** To compile with the user-authentication feature, append this file to
|
||||
** end of an SQLite amalgamation header file ("sqlite3.h"), then add
|
||||
** the SQLITE_USER_AUTHENTICATION compile-time option. See the
|
||||
** user-auth.txt file in the same source directory as this file for
|
||||
** additional information.
|
||||
*/
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** If a database contains the SQLITE_USER table, then the
|
||||
** sqlite3_user_authenticate() interface must be invoked with an
|
||||
** appropriate username and password prior to enable read and write
|
||||
** access to the database.
|
||||
**
|
||||
** Return SQLITE_OK on success or SQLITE_ERROR if the username/password
|
||||
** combination is incorrect or unknown.
|
||||
**
|
||||
** If the SQLITE_USER table is not present in the database file, then
|
||||
** this interface is a harmless no-op returnning SQLITE_OK.
|
||||
*/
|
||||
int sqlite3_user_authenticate(
|
||||
sqlite3 *db, /* The database connection */
|
||||
const char *zUsername, /* Username */
|
||||
const char *aPW, /* Password or credentials */
|
||||
int nPW /* Number of bytes in aPW[] */
|
||||
);
|
||||
|
||||
/*
|
||||
** The sqlite3_user_add() interface can be used (by an admin user only)
|
||||
** to create a new user. When called on a no-authentication-required
|
||||
** database, this routine converts the database into an authentication-
|
||||
** required database, automatically makes the added user an
|
||||
** administrator, and logs in the current connection as that user.
|
||||
** The sqlite3_user_add() interface only works for the "main" database, not
|
||||
** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a
|
||||
** non-admin user results in an error.
|
||||
*/
|
||||
int sqlite3_user_add(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to be added */
|
||||
const char *aPW, /* Password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* True to give new user admin privilege */
|
||||
);
|
||||
|
||||
/*
|
||||
** The sqlite3_user_change() interface can be used to change a users
|
||||
** login credentials or admin privilege. Any user can change their own
|
||||
** login credentials. Only an admin user can change another users login
|
||||
** credentials or admin privilege setting. No user may change their own
|
||||
** admin privilege setting.
|
||||
*/
|
||||
int sqlite3_user_change(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to change */
|
||||
const char *aPW, /* New password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* Modified admin privilege for the user */
|
||||
);
|
||||
|
||||
/*
|
||||
** The sqlite3_user_delete() interface can be used (by an admin user only)
|
||||
** to delete a user. The currently logged-in user cannot be deleted,
|
||||
** which guarantees that there is always an admin user and hence that
|
||||
** the database cannot be converted into a no-authentication-required
|
||||
** database.
|
||||
*/
|
||||
int sqlite3_user_delete(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername /* Username to remove */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of the 'extern "C"' block */
|
||||
#endif
|
||||
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
@@ -1,176 +0,0 @@
|
||||
*********************************** NOTICE ************************************
|
||||
* This extension is deprecated. The SQLite developers do not maintain this *
|
||||
* extension. At some point in the future, it might disappear from the source *
|
||||
* tree. *
|
||||
* *
|
||||
* If you are using this extension and think it should be supported moving *
|
||||
* forward, visit the SQLite Forum (https://sqlite.org/forum) and argue your *
|
||||
* case there. *
|
||||
* *
|
||||
* This deprecation notice was added on 2024-01-22. *
|
||||
*******************************************************************************
|
||||
|
||||
Activate the user authentication logic by including the
|
||||
ext/userauth/userauth.c source code file in the build and
|
||||
adding the -DSQLITE_USER_AUTHENTICATION compile-time option.
|
||||
The ext/userauth/sqlite3userauth.h header file is available to
|
||||
applications to define the interface.
|
||||
|
||||
When using the SQLite amalgamation, it is sufficient to append
|
||||
the ext/userauth/userauth.c source file onto the end of the
|
||||
amalgamation.
|
||||
|
||||
The following new APIs are available when user authentication is
|
||||
activated:
|
||||
|
||||
int sqlite3_user_authenticate(
|
||||
sqlite3 *db, /* The database connection */
|
||||
const char *zUsername, /* Username */
|
||||
const char *aPW, /* Password or credentials */
|
||||
int nPW /* Number of bytes in aPW[] */
|
||||
);
|
||||
|
||||
int sqlite3_user_add(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to be added */
|
||||
const char *aPW, /* Password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* True to give new user admin privilege */
|
||||
);
|
||||
|
||||
int sqlite3_user_change(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to change */
|
||||
const void *aPW, /* Modified password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* Modified admin privilege for the user */
|
||||
);
|
||||
|
||||
int sqlite3_user_delete(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername /* Username to remove */
|
||||
);
|
||||
|
||||
With this extension, a database can be marked as requiring authentication.
|
||||
By default a database does not require authentication.
|
||||
|
||||
The sqlite3_open(), sqlite3_open16(), and sqlite3_open_v2() interfaces
|
||||
work as before: they open a new database connection. However, if the
|
||||
database being opened requires authentication, then attempts to read
|
||||
or write from the database will fail with an SQLITE_AUTH error until
|
||||
after sqlite3_user_authenticate() has been called successfully. The
|
||||
sqlite3_user_authenticate() call will return SQLITE_OK if the
|
||||
authentication credentials are accepted and SQLITE_ERROR if not.
|
||||
|
||||
Calling sqlite3_user_authenticate() on a no-authentication-required
|
||||
database connection is a harmless no-op.
|
||||
|
||||
If the database is encrypted, then sqlite3_key_v2() must be called first,
|
||||
with the correct decryption key, prior to invoking sqlite3_user_authenticate().
|
||||
|
||||
To recapitulate: When opening an existing unencrypted authentication-
|
||||
required database, the call sequence is:
|
||||
|
||||
sqlite3_open_v2()
|
||||
sqlite3_user_authenticate();
|
||||
/* Database is now usable */
|
||||
|
||||
To open an existing, encrypted, authentication-required database, the
|
||||
call sequence is:
|
||||
|
||||
sqlite3_open_v2();
|
||||
sqlite3_key_v2();
|
||||
sqlite3_user_authenticate();
|
||||
/* Database is now usable */
|
||||
|
||||
When opening a no-authentication-required database, the database
|
||||
connection is treated as if it was authenticated as an admin user.
|
||||
|
||||
When ATTACH-ing new database files to a connection, each newly attached
|
||||
database that is an authentication-required database is checked using
|
||||
the same username and password as supplied to the main database. If that
|
||||
check fails, then the ATTACH command fails with an SQLITE_AUTH error.
|
||||
|
||||
The sqlite3_user_add() interface can be used (by an admin user only)
|
||||
to create a new user. When called on a no-authentication-required
|
||||
database and when A is true, the sqlite3_user_add(D,U,P,N,A) routine
|
||||
converts the database into an authentication-required database and
|
||||
logs in the database connection D as user U with password P,N.
|
||||
To convert a no-authentication-required database into an authentication-
|
||||
required database, the isAdmin parameter must be true. If
|
||||
sqlite3_user_add(D,U,P,N,A) is called on a no-authentication-required
|
||||
database and A is false, then the call fails with an SQLITE_AUTH error.
|
||||
|
||||
Any call to sqlite3_user_add() by a non-admin user results in an error.
|
||||
|
||||
Hence, to create a new, unencrypted, authentication-required database,
|
||||
the call sequence is:
|
||||
|
||||
sqlite3_open_v2();
|
||||
sqlite3_user_add();
|
||||
|
||||
And to create a new, encrypted, authentication-required database, the call
|
||||
sequence is:
|
||||
|
||||
sqlite3_open_v2();
|
||||
sqlite3_key_v2();
|
||||
sqlite3_user_add();
|
||||
|
||||
The sqlite3_user_delete() interface can be used (by an admin user only)
|
||||
to delete a user. The currently logged-in user cannot be deleted,
|
||||
which guarantees that there is always an admin user and hence that
|
||||
the database cannot be converted into a no-authentication-required
|
||||
database.
|
||||
|
||||
The sqlite3_user_change() interface can be used to change a users
|
||||
login credentials or admin privilege. Any user can change their own
|
||||
password. Only an admin user can change another users login
|
||||
credentials or admin privilege setting. No user may change their own
|
||||
admin privilege setting.
|
||||
|
||||
The sqlite3_set_authorizer() callback is modified to take a 7th parameter
|
||||
which is the username of the currently logged in user, or NULL for a
|
||||
no-authentication-required database.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
Implementation notes:
|
||||
|
||||
An authentication-required database is identified by the presence of a
|
||||
new table:
|
||||
|
||||
CREATE TABLE sqlite_user(
|
||||
uname TEXT PRIMARY KEY,
|
||||
isAdmin BOOLEAN,
|
||||
pw BLOB
|
||||
) WITHOUT ROWID;
|
||||
|
||||
The sqlite_user table is inaccessible (unreadable and unwriteable) to
|
||||
non-admin users and is read-only for admin users. However, if the same
|
||||
database file is opened by a version of SQLite that omits
|
||||
the -DSQLITE_USER_AUTHENTICATION compile-time option, then the sqlite_user
|
||||
table will be readable by anybody and writeable by anybody if
|
||||
the "PRAGMA writable_schema=ON" statement is run first.
|
||||
|
||||
The sqlite_user.pw field is encoded by a built-in SQL function
|
||||
"sqlite_crypt(X,Y)". The two arguments are both BLOBs. The first argument
|
||||
is the plaintext password supplied to the sqlite3_user_authenticate()
|
||||
interface. The second argument is the sqlite_user.pw value and is supplied
|
||||
so that the function can extract the "salt" used by the password encoder.
|
||||
The result of sqlite_crypt(X,Y) is another blob which is the value that
|
||||
ends up being stored in sqlite_user.pw. To verify credentials X supplied
|
||||
by the sqlite3_user_authenticate() routine, SQLite runs:
|
||||
|
||||
sqlite_user.pw == sqlite_crypt(X, sqlite_user.pw)
|
||||
|
||||
To compute an appropriate sqlite_user.pw value from a new or modified
|
||||
password X, sqlite_crypt(X,NULL) is run. A new random salt is selected
|
||||
when the second argument is NULL.
|
||||
|
||||
The built-in version of of sqlite_crypt() uses a simple Ceasar-cypher
|
||||
which prevents passwords from being revealed by searching the raw database
|
||||
for ASCII text, but is otherwise trivally broken. For better password
|
||||
security, the database should be encrypted using the SQLite Encryption
|
||||
Extension or similar technology. Or, the application can use the
|
||||
sqlite3_create_function() interface to provide an alternative
|
||||
implementation of sqlite_crypt() that computes a stronger password hash,
|
||||
perhaps using a cryptographic hash function like SHA1.
|
||||
@@ -1,355 +0,0 @@
|
||||
/*
|
||||
** 2014-09-08
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** This file contains the bulk of the implementation of the
|
||||
** user-authentication extension feature. Some parts of the user-
|
||||
** authentication code are contained within the SQLite core (in the
|
||||
** src/ subdirectory of the main source code tree) but those parts
|
||||
** that could reasonable be separated out are moved into this file.
|
||||
**
|
||||
** To compile with the user-authentication feature, append this file to
|
||||
** end of an SQLite amalgamation, then add the SQLITE_USER_AUTHENTICATION
|
||||
** compile-time option. See the user-auth.txt file in the same source
|
||||
** directory as this file for additional information.
|
||||
*/
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
#ifndef SQLITEINT_H
|
||||
# include "sqliteInt.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Prepare an SQL statement for use by the user authentication logic.
|
||||
** Return a pointer to the prepared statement on success. Return a
|
||||
** NULL pointer if there is an error of any kind.
|
||||
*/
|
||||
static sqlite3_stmt *sqlite3UserAuthPrepare(
|
||||
sqlite3 *db,
|
||||
const char *zFormat,
|
||||
...
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
char *zSql;
|
||||
int rc;
|
||||
va_list ap;
|
||||
u64 savedFlags = db->flags;
|
||||
|
||||
va_start(ap, zFormat);
|
||||
zSql = sqlite3_vmprintf(zFormat, ap);
|
||||
va_end(ap);
|
||||
if( zSql==0 ) return 0;
|
||||
db->flags |= SQLITE_WriteSchema;
|
||||
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
|
||||
db->flags = savedFlags;
|
||||
sqlite3_free(zSql);
|
||||
if( rc ){
|
||||
sqlite3_finalize(pStmt);
|
||||
pStmt = 0;
|
||||
}
|
||||
return pStmt;
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to see if the sqlite_user table exists in database zDb.
|
||||
*/
|
||||
static int userTableExists(sqlite3 *db, const char *zDb){
|
||||
int rc;
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
sqlite3BtreeEnterAll(db);
|
||||
if( db->init.busy==0 ){
|
||||
char *zErr = 0;
|
||||
sqlite3Init(db, &zErr);
|
||||
sqlite3DbFree(db, zErr);
|
||||
}
|
||||
rc = sqlite3FindTable(db, "sqlite_user", zDb)!=0;
|
||||
sqlite3BtreeLeaveAll(db);
|
||||
sqlite3_mutex_leave(db->mutex);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Check to see if database zDb has a "sqlite_user" table and if it does
|
||||
** whether that table can authenticate zUser with nPw,zPw. Write one of
|
||||
** the UAUTH_* user authorization level codes into *peAuth and return a
|
||||
** result code.
|
||||
*/
|
||||
static int userAuthCheckLogin(
|
||||
sqlite3 *db, /* The database connection to check */
|
||||
const char *zDb, /* Name of specific database to check */
|
||||
u8 *peAuth /* OUT: One of UAUTH_* constants */
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
int rc;
|
||||
|
||||
*peAuth = UAUTH_Unknown;
|
||||
if( !userTableExists(db, "main") ){
|
||||
*peAuth = UAUTH_Admin; /* No sqlite_user table. Everybody is admin. */
|
||||
return SQLITE_OK;
|
||||
}
|
||||
if( db->auth.zAuthUser==0 ){
|
||||
*peAuth = UAUTH_Fail;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
pStmt = sqlite3UserAuthPrepare(db,
|
||||
"SELECT pw=sqlite_crypt(?1,pw), isAdmin FROM \"%w\".sqlite_user"
|
||||
" WHERE uname=?2", zDb);
|
||||
if( pStmt==0 ) return SQLITE_NOMEM;
|
||||
sqlite3_bind_blob(pStmt, 1, db->auth.zAuthPW, db->auth.nAuthPW,SQLITE_STATIC);
|
||||
sqlite3_bind_text(pStmt, 2, db->auth.zAuthUser, -1, SQLITE_STATIC);
|
||||
rc = sqlite3_step(pStmt);
|
||||
if( rc==SQLITE_ROW && sqlite3_column_int(pStmt,0) ){
|
||||
*peAuth = sqlite3_column_int(pStmt, 1) + UAUTH_User;
|
||||
}else{
|
||||
*peAuth = UAUTH_Fail;
|
||||
}
|
||||
return sqlite3_finalize(pStmt);
|
||||
}
|
||||
int sqlite3UserAuthCheckLogin(
|
||||
sqlite3 *db, /* The database connection to check */
|
||||
const char *zDb, /* Name of specific database to check */
|
||||
u8 *peAuth /* OUT: One of UAUTH_* constants */
|
||||
){
|
||||
int rc;
|
||||
u8 savedAuthLevel;
|
||||
assert( zDb!=0 );
|
||||
assert( peAuth!=0 );
|
||||
savedAuthLevel = db->auth.authLevel;
|
||||
db->auth.authLevel = UAUTH_Admin;
|
||||
rc = userAuthCheckLogin(db, zDb, peAuth);
|
||||
db->auth.authLevel = savedAuthLevel;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** If the current authLevel is UAUTH_Unknown, the take actions to figure
|
||||
** out what authLevel should be
|
||||
*/
|
||||
void sqlite3UserAuthInit(sqlite3 *db){
|
||||
if( db->auth.authLevel==UAUTH_Unknown ){
|
||||
u8 authLevel = UAUTH_Fail;
|
||||
sqlite3UserAuthCheckLogin(db, "main", &authLevel);
|
||||
db->auth.authLevel = authLevel;
|
||||
if( authLevel<UAUTH_Admin ) db->flags &= ~SQLITE_WriteSchema;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of the sqlite_crypt(X,Y) function.
|
||||
**
|
||||
** If Y is NULL then generate a new hash for password X and return that
|
||||
** hash. If Y is not null, then generate a hash for password X using the
|
||||
** same salt as the previous hash Y and return the new hash.
|
||||
*/
|
||||
void sqlite3CryptFunc(
|
||||
sqlite3_context *context,
|
||||
int NotUsed,
|
||||
sqlite3_value **argv
|
||||
){
|
||||
const char *zIn;
|
||||
int nIn, ii;
|
||||
u8 *zOut;
|
||||
char zSalt[8];
|
||||
zIn = sqlite3_value_blob(argv[0]);
|
||||
nIn = sqlite3_value_bytes(argv[0]);
|
||||
if( sqlite3_value_type(argv[1])==SQLITE_BLOB
|
||||
&& sqlite3_value_bytes(argv[1])==nIn+sizeof(zSalt)
|
||||
){
|
||||
memcpy(zSalt, sqlite3_value_blob(argv[1]), sizeof(zSalt));
|
||||
}else{
|
||||
sqlite3_randomness(sizeof(zSalt), zSalt);
|
||||
}
|
||||
zOut = sqlite3_malloc( nIn+sizeof(zSalt) );
|
||||
if( zOut==0 ){
|
||||
sqlite3_result_error_nomem(context);
|
||||
}else{
|
||||
memcpy(zOut, zSalt, sizeof(zSalt));
|
||||
for(ii=0; ii<nIn; ii++){
|
||||
zOut[ii+sizeof(zSalt)] = zIn[ii]^zSalt[ii&0x7];
|
||||
}
|
||||
sqlite3_result_blob(context, zOut, nIn+sizeof(zSalt), sqlite3_free);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** If a database contains the SQLITE_USER table, then the
|
||||
** sqlite3_user_authenticate() interface must be invoked with an
|
||||
** appropriate username and password prior to enable read and write
|
||||
** access to the database.
|
||||
**
|
||||
** Return SQLITE_OK on success or SQLITE_ERROR if the username/password
|
||||
** combination is incorrect or unknown.
|
||||
**
|
||||
** If the SQLITE_USER table is not present in the database file, then
|
||||
** this interface is a harmless no-op returnning SQLITE_OK.
|
||||
*/
|
||||
int sqlite3_user_authenticate(
|
||||
sqlite3 *db, /* The database connection */
|
||||
const char *zUsername, /* Username */
|
||||
const char *zPW, /* Password or credentials */
|
||||
int nPW /* Number of bytes in aPW[] */
|
||||
){
|
||||
int rc;
|
||||
u8 authLevel = UAUTH_Fail;
|
||||
db->auth.authLevel = UAUTH_Unknown;
|
||||
sqlite3_free(db->auth.zAuthUser);
|
||||
sqlite3_free(db->auth.zAuthPW);
|
||||
memset(&db->auth, 0, sizeof(db->auth));
|
||||
db->auth.zAuthUser = sqlite3_mprintf("%s", zUsername);
|
||||
if( db->auth.zAuthUser==0 ) return SQLITE_NOMEM;
|
||||
db->auth.zAuthPW = sqlite3_malloc( nPW+1 );
|
||||
if( db->auth.zAuthPW==0 ) return SQLITE_NOMEM;
|
||||
memcpy(db->auth.zAuthPW,zPW,nPW);
|
||||
db->auth.nAuthPW = nPW;
|
||||
rc = sqlite3UserAuthCheckLogin(db, "main", &authLevel);
|
||||
db->auth.authLevel = authLevel;
|
||||
sqlite3ExpirePreparedStatements(db, 0);
|
||||
if( rc ){
|
||||
return rc; /* OOM error, I/O error, etc. */
|
||||
}
|
||||
if( authLevel<UAUTH_User ){
|
||||
return SQLITE_AUTH; /* Incorrect username and/or password */
|
||||
}
|
||||
return SQLITE_OK; /* Successful login */
|
||||
}
|
||||
|
||||
/*
|
||||
** The sqlite3_user_add() interface can be used (by an admin user only)
|
||||
** to create a new user. When called on a no-authentication-required
|
||||
** database, this routine converts the database into an authentication-
|
||||
** required database, automatically makes the added user an
|
||||
** administrator, and logs in the current connection as that user.
|
||||
** The sqlite3_user_add() interface only works for the "main" database, not
|
||||
** for any ATTACH-ed databases. Any call to sqlite3_user_add() by a
|
||||
** non-admin user results in an error.
|
||||
*/
|
||||
int sqlite3_user_add(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to be added */
|
||||
const char *aPW, /* Password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* True to give new user admin privilege */
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
int rc;
|
||||
sqlite3UserAuthInit(db);
|
||||
if( db->auth.authLevel<UAUTH_Admin ) return SQLITE_AUTH;
|
||||
if( !userTableExists(db, "main") ){
|
||||
if( !isAdmin ) return SQLITE_AUTH;
|
||||
pStmt = sqlite3UserAuthPrepare(db,
|
||||
"CREATE TABLE sqlite_user(\n"
|
||||
" uname TEXT PRIMARY KEY,\n"
|
||||
" isAdmin BOOLEAN,\n"
|
||||
" pw BLOB\n"
|
||||
") WITHOUT ROWID;");
|
||||
if( pStmt==0 ) return SQLITE_NOMEM;
|
||||
sqlite3_step(pStmt);
|
||||
rc = sqlite3_finalize(pStmt);
|
||||
if( rc ) return rc;
|
||||
}
|
||||
pStmt = sqlite3UserAuthPrepare(db,
|
||||
"INSERT INTO sqlite_user(uname,isAdmin,pw)"
|
||||
" VALUES(%Q,%d,sqlite_crypt(?1,NULL))",
|
||||
zUsername, isAdmin!=0);
|
||||
if( pStmt==0 ) return SQLITE_NOMEM;
|
||||
sqlite3_bind_blob(pStmt, 1, aPW, nPW, SQLITE_STATIC);
|
||||
sqlite3_step(pStmt);
|
||||
rc = sqlite3_finalize(pStmt);
|
||||
if( rc ) return rc;
|
||||
if( db->auth.zAuthUser==0 ){
|
||||
assert( isAdmin!=0 );
|
||||
sqlite3_user_authenticate(db, zUsername, aPW, nPW);
|
||||
}
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** The sqlite3_user_change() interface can be used to change a users
|
||||
** login credentials or admin privilege. Any user can change their own
|
||||
** login credentials. Only an admin user can change another users login
|
||||
** credentials or admin privilege setting. No user may change their own
|
||||
** admin privilege setting.
|
||||
*/
|
||||
int sqlite3_user_change(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername, /* Username to change */
|
||||
const char *aPW, /* Modified password or credentials */
|
||||
int nPW, /* Number of bytes in aPW[] */
|
||||
int isAdmin /* Modified admin privilege for the user */
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
int rc;
|
||||
u8 authLevel;
|
||||
|
||||
authLevel = db->auth.authLevel;
|
||||
if( authLevel<UAUTH_User ){
|
||||
/* Must be logged in to make a change */
|
||||
return SQLITE_AUTH;
|
||||
}
|
||||
if( strcmp(db->auth.zAuthUser, zUsername)!=0 ){
|
||||
if( db->auth.authLevel<UAUTH_Admin ){
|
||||
/* Must be an administrator to change a different user */
|
||||
return SQLITE_AUTH;
|
||||
}
|
||||
}else if( isAdmin!=(authLevel==UAUTH_Admin) ){
|
||||
/* Cannot change the isAdmin setting for self */
|
||||
return SQLITE_AUTH;
|
||||
}
|
||||
db->auth.authLevel = UAUTH_Admin;
|
||||
if( !userTableExists(db, "main") ){
|
||||
/* This routine is a no-op if the user to be modified does not exist */
|
||||
}else{
|
||||
pStmt = sqlite3UserAuthPrepare(db,
|
||||
"UPDATE sqlite_user SET isAdmin=%d, pw=sqlite_crypt(?1,NULL)"
|
||||
" WHERE uname=%Q", isAdmin, zUsername);
|
||||
if( pStmt==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
sqlite3_bind_blob(pStmt, 1, aPW, nPW, SQLITE_STATIC);
|
||||
sqlite3_step(pStmt);
|
||||
rc = sqlite3_finalize(pStmt);
|
||||
}
|
||||
}
|
||||
db->auth.authLevel = authLevel;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** The sqlite3_user_delete() interface can be used (by an admin user only)
|
||||
** to delete a user. The currently logged-in user cannot be deleted,
|
||||
** which guarantees that there is always an admin user and hence that
|
||||
** the database cannot be converted into a no-authentication-required
|
||||
** database.
|
||||
*/
|
||||
int sqlite3_user_delete(
|
||||
sqlite3 *db, /* Database connection */
|
||||
const char *zUsername /* Username to remove */
|
||||
){
|
||||
sqlite3_stmt *pStmt;
|
||||
if( db->auth.authLevel<UAUTH_Admin ){
|
||||
/* Must be an administrator to delete a user */
|
||||
return SQLITE_AUTH;
|
||||
}
|
||||
if( strcmp(db->auth.zAuthUser, zUsername)==0 ){
|
||||
/* Cannot delete self */
|
||||
return SQLITE_AUTH;
|
||||
}
|
||||
if( !userTableExists(db, "main") ){
|
||||
/* This routine is a no-op if the user to be deleted does not exist */
|
||||
return SQLITE_OK;
|
||||
}
|
||||
pStmt = sqlite3UserAuthPrepare(db,
|
||||
"DELETE FROM sqlite_user WHERE uname=%Q", zUsername);
|
||||
if( pStmt==0 ) return SQLITE_NOMEM;
|
||||
sqlite3_step(pStmt);
|
||||
return sqlite3_finalize(pStmt);
|
||||
}
|
||||
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
@@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -9,12 +9,17 @@
|
||||
#
|
||||
# - This file must remain devoid of GNU Make-isms. i.e. it must be
|
||||
# POSIX Make compatible. "bmake" (BSD make) is available on most
|
||||
# Linux systems, so compatibility is relatively easy to test.
|
||||
# Linux systems, so compatibility is relatively easy to test. As a
|
||||
# harmless exception, this file sometimes uses $(MAKEFILE_LIST) as a
|
||||
# dependency. That var, in GNU Make, lists all of the makefile
|
||||
# currently loaded.
|
||||
#
|
||||
# The variables listed below must be defined before this script is
|
||||
# invoked. This file will use defaults, very possibly invalid, for any
|
||||
# which are not defined.
|
||||
########################################################################
|
||||
.POSIX: #maintenance reminder: X:=Y is not POSIX-portable
|
||||
all:
|
||||
#
|
||||
# $(TOP) =
|
||||
#
|
||||
@@ -68,7 +73,7 @@ B.exe ?=
|
||||
# The DLL resp. static library counterparts of $(B.exe).
|
||||
#
|
||||
B.dll ?= .so
|
||||
B.lib ?= .lib
|
||||
B.lib ?= .a
|
||||
#
|
||||
# $(T.exe) =
|
||||
#
|
||||
@@ -117,12 +122,11 @@ B.tclsh ?= $(JIMSH)
|
||||
# Various system-level directories, mostly needed for installation and
|
||||
# for finding system-level dependencies.
|
||||
#
|
||||
# Aside from ${prefix}, we do not need to (and intentionally do not)
|
||||
# export any of the dozen-ish shorthand ${XYZdir} vars the autotools
|
||||
# conventionally defines.
|
||||
#
|
||||
prefix ?= /usr/local
|
||||
exec_prefix ?= $(prefix)
|
||||
libdir ?= $(prefix)/lib
|
||||
pkgconfigdir ?= $(libdir)/pkgconfig
|
||||
bindir ?= $(prefix)/bin
|
||||
includedir ?= $(prefix)/include
|
||||
#
|
||||
# $(LDFLAGS.{feature}) and $(CFLAGS.{feature}) =
|
||||
#
|
||||
@@ -212,25 +216,12 @@ OPT_FEATURE_FLAGS ?=
|
||||
#
|
||||
SHELL_OPT ?=
|
||||
#
|
||||
# The following TCL_vars come from tclConfig.sh
|
||||
# TCL_CONFIG_SH must, for some of the build targets, refer to a valid
|
||||
# tclConfig.sh. That script will be used to populate most of the other
|
||||
# TCL-related vars the build needs.
|
||||
#
|
||||
# Potential TODO: a shell script, similar tool/tclConfigShToTcl.sh,
|
||||
# which emits these vars in a format which we can include from this
|
||||
# makefile.
|
||||
#
|
||||
TCL_INCLUDE_SPEC ?=
|
||||
TCL_LIB_SPEC ?=
|
||||
TCL_STUB_LIB_SPEC ?=
|
||||
TCL_EXEC_PREFIX ?=
|
||||
TCL_VERSION ?=
|
||||
TCLLIBDIR ?=
|
||||
TCL_CONFIG_SH ?=
|
||||
#
|
||||
# $(TCLLIB_RPATH) is the -rpath flag for libtclsqlite3, not
|
||||
# libsqlite3, and will usually differ from $(LDFLAGS.rpath).
|
||||
#
|
||||
TCLLIB_RPATH ?=
|
||||
#
|
||||
# $(HAVE_WASI_SDK) =
|
||||
#
|
||||
# 1 when building with the WASI SDK. This disables certain build
|
||||
@@ -255,9 +246,15 @@ all: sqlite3.h sqlite3.c
|
||||
|
||||
#
|
||||
# $(CFLAGS) should ideally only contain flags which are relevant for
|
||||
# all binaries built for the target platform.
|
||||
# all binaries built for the target platform. However, many people
|
||||
# like to pass it to "make" without realizing that it applies to
|
||||
# dozens of apps, and they override core flags when doing so. To help
|
||||
# work around that, we expect core-most CFLAGS (only), e.g. -fPIC, to
|
||||
# be set in $(CFLAGS.core). That enables people to pass their other
|
||||
# CFLAGS without triggering, e.g., "recompile with -fPIC" errors.
|
||||
#
|
||||
T.cc += $(CFLAGS)
|
||||
CFLAGS.core ?=
|
||||
T.cc += $(CFLAGS.core) $(CFLAGS)
|
||||
|
||||
#
|
||||
# The difference between $(OPT_FEATURE_FLAGS) and $(OPTS) is that the
|
||||
@@ -307,8 +304,8 @@ T.cc.sqlite ?= $(T.cc)
|
||||
#
|
||||
CFLAGS.intree_includes = \
|
||||
-I. -I$(TOP)/src -I$(TOP)/ext/rtree -I$(TOP)/ext/icu \
|
||||
-I$(TOP)/ext/fts3 -I$(TOP)/ext/async -I$(TOP)/ext/session \
|
||||
-I$(TOP)/ext/misc -I$(TOP)/ext/userauth
|
||||
-I$(TOP)/ext/fts3 -I$(TOP)/ext/session \
|
||||
-I$(TOP)/ext/misc
|
||||
T.cc.sqlite += $(CFLAGS.intree_includes)
|
||||
|
||||
#
|
||||
@@ -330,11 +327,17 @@ T.link = $(T.cc.sqlite) $(T.link.extras)
|
||||
T.link.shared = $(T.link) $(LDFLAGS.shobj)
|
||||
|
||||
#
|
||||
# LDFLAGS.libsqlite3 should be used with any target which either
|
||||
# results in building libsqlite3.so, compiles sqlite3.c directly, or
|
||||
# links in either of $(LIBOBJSO) or $(LIBOBJS1). Note that these
|
||||
# flags are for the target build platform, not necessarily localhost.
|
||||
# i.e. it should be used with $(T.cc.sqlite) or $(T.link) but not $(B.cc).
|
||||
# LDFLAGS.libsqlite3 should be used with any deliverable for which any
|
||||
# of the following apply:
|
||||
#
|
||||
# - Results in building libsqlite3.so
|
||||
# - Compiles sqlite3.c in to an application
|
||||
# - Links with libsqlite3.a
|
||||
# - Links in either of $(LIBOBJSO) or $(LIBOBJS1)
|
||||
#
|
||||
# Note that these flags are for the target build platform, not
|
||||
# necessarily localhost. i.e. it should be used with $(T.cc.sqlite)
|
||||
# or $(T.link) but not $(B.cc).
|
||||
#
|
||||
LDFLAGS.libsqlite3 = \
|
||||
$(LDFLAGS.rpath) $(LDFLAGS.pthread) \
|
||||
@@ -352,16 +355,16 @@ LDFLAGS.libsqlite3 = \
|
||||
# moral of this story is that spaces in installation paths will break
|
||||
# the install process.
|
||||
#
|
||||
install-dir.bin = $(DESTDIR)$(bindir)
|
||||
install-dir.lib = $(DESTDIR)$(libdir)
|
||||
install-dir.bin = $(DESTDIR)$(prefix)/bin
|
||||
install-dir.lib = $(DESTDIR)$(prefix)/lib
|
||||
install-dir.include = $(DESTDIR)$(prefix)/include
|
||||
install-dir.pkgconfig = $(DESTDIR)$(pkgconfigdir)
|
||||
install-dir.pkgconfig = $(DESTDIR)$(prefix)/lib/pkgconfig
|
||||
install-dir.man1 = $(DESTDIR)$(prefix)/share/man/man1
|
||||
install-dir.all = $(install-dir.bin) $(install-dir.include) \
|
||||
$(install-dir.lib) $(install-dir.man1) \
|
||||
$(install-dir.pkgconfig)
|
||||
$(install-dir.all):
|
||||
$(INSTALL) -d $@
|
||||
$(INSTALL) -d "$@"
|
||||
|
||||
#
|
||||
# After jimsh is compiled, we run some sanity checks to ensure that
|
||||
@@ -399,7 +402,7 @@ distclean: distclean-jimsh
|
||||
# in other flavors of Make.
|
||||
#
|
||||
MAKE_SANITY_CHECK = .main.mk.checks
|
||||
$(MAKE_SANITY_CHECK): $(MAKEFILE_LIST)
|
||||
$(MAKE_SANITY_CHECK): $(MAKEFILE_LIST) $(TOP)/auto.def
|
||||
@if [ x = "x$(TOP)" ]; then echo "Missing TOP var" 1>&2; exit 1; fi
|
||||
@if [ ! -d "$(TOP)" ]; then echo "$(TOP) is not a directory" 1>&2; exit 1; fi
|
||||
@if [ ! -f "$(TOP)/auto.def" ]; then echo "$(TOP) does not appear to be the top-most source dir" 1>&2; exit 1; fi
|
||||
@@ -435,25 +438,26 @@ LIBOBJS0 = alter.o analyze.o attach.o auth.o \
|
||||
random.o resolve.o rowset.o rtree.o \
|
||||
sqlite3session.o select.o sqlite3rbu.o status.o stmt.o \
|
||||
table.o threads.o tokenize.o treeview.o trigger.o \
|
||||
update.o upsert.o userauth.o utf.o util.o vacuum.o \
|
||||
update.o upsert.o utf.o util.o vacuum.o \
|
||||
vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o vdbesort.o \
|
||||
vdbetrace.o vdbevtab.o vtab.o \
|
||||
wal.o walker.o where.o wherecode.o whereexpr.o \
|
||||
window.o
|
||||
LIBOBJS = $(LIBOBJS0)
|
||||
|
||||
#
|
||||
# Object files for the amalgamation.
|
||||
#
|
||||
LIBOBJS1 = sqlite3.o
|
||||
|
||||
# Determine the real value of LIBOBJ based on the 'configure' script
|
||||
#
|
||||
# Determine the real value of LIBOBJ based on whether the amalgamation
|
||||
# is enabled or not.
|
||||
#
|
||||
LIBOBJ = $(LIBOBJS$(USE_AMALGAMATION))
|
||||
#LIBSRC0 = $(SRC)
|
||||
#LIBSRC1 = sqlite3.c
|
||||
#LIBSRC = $(LIBSRC$(USE_AMALGAMATION))
|
||||
$(LIBOBJ): $(MAKE_SANITY_CHECK)
|
||||
|
||||
#
|
||||
# All of the source code files.
|
||||
#
|
||||
SRC = \
|
||||
@@ -593,9 +597,6 @@ SRC += \
|
||||
SRC += \
|
||||
$(TOP)/ext/session/sqlite3session.c \
|
||||
$(TOP)/ext/session/sqlite3session.h
|
||||
SRC += \
|
||||
$(TOP)/ext/userauth/userauth.c \
|
||||
$(TOP)/ext/userauth/sqlite3userauth.h
|
||||
SRC += \
|
||||
$(TOP)/ext/rbu/sqlite3rbu.h \
|
||||
$(TOP)/ext/rbu/sqlite3rbu.c
|
||||
@@ -626,7 +627,6 @@ TESTSRC = \
|
||||
$(TOP)/src/test8.c \
|
||||
$(TOP)/src/test9.c \
|
||||
$(TOP)/src/test_autoext.c \
|
||||
$(TOP)/src/test_async.c \
|
||||
$(TOP)/src/test_backup.c \
|
||||
$(TOP)/src/test_bestindex.c \
|
||||
$(TOP)/src/test_blob.c \
|
||||
@@ -708,7 +708,6 @@ TESTSRC += \
|
||||
$(TOP)/ext/misc/unionvtab.c \
|
||||
$(TOP)/ext/misc/wholenumber.c \
|
||||
$(TOP)/ext/misc/zipfile.c \
|
||||
$(TOP)/ext/userauth/userauth.c \
|
||||
$(TOP)/ext/rtree/test_rtreedoc.c
|
||||
|
||||
# Source code to the library files needed by the test fixture
|
||||
@@ -763,7 +762,6 @@ TESTSRC2 = \
|
||||
$(TOP)/ext/fts3/fts3_term.c \
|
||||
$(TOP)/ext/fts3/fts3_tokenizer.c \
|
||||
$(TOP)/ext/fts3/fts3_write.c \
|
||||
$(TOP)/ext/async/sqlite3async.c \
|
||||
$(TOP)/ext/session/sqlite3session.c \
|
||||
$(TOP)/ext/misc/stmt.c \
|
||||
fts5.c
|
||||
@@ -812,8 +810,6 @@ EXTHDR += \
|
||||
$(TOP)/ext/icu/sqliteicu.h
|
||||
EXTHDR += \
|
||||
$(TOP)/ext/rtree/sqlite3rtree.h
|
||||
EXTHDR += \
|
||||
$(TOP)/ext/userauth/sqlite3userauth.h
|
||||
|
||||
#
|
||||
# Executables needed for testing
|
||||
@@ -912,11 +908,54 @@ has_tclsh85:
|
||||
sh $(TOP)/tool/cktclsh.sh 8.5 $(TCLSH_CMD)
|
||||
touch has_tclsh85
|
||||
|
||||
has_tclconfig:
|
||||
#
|
||||
# $(T.tcl.env.sh) is a shell script intended for source'ing to set
|
||||
# various TCL config info in the current shell context:
|
||||
#
|
||||
# - All info exported by tclConfig.sh
|
||||
#
|
||||
# - TCLLIBDIR = the first entry from TCL's $auto_path which refers to
|
||||
# an existing dir, then append /sqlite3 to it. If TCLLIBDIR is
|
||||
# provided via the environment, that value is used instead.
|
||||
#
|
||||
# Maintenance reminder: the ./ at the start of the name is required or /bin/sh
|
||||
# refuses to source it:
|
||||
#
|
||||
# . .tclenv.sh ==> .tclenv.sh: not found
|
||||
# . ./.tclenv.sh ==> fine
|
||||
#
|
||||
# It took half an hour to figure that out.
|
||||
#
|
||||
T.tcl.env.sh = ./.tclenv.sh
|
||||
$(T.tcl.env.sh): $(TCLSH_CMD) $(TCL_CONFIG_SH) $(MAKEFILE_LIST)
|
||||
@if [ x = "x$(TCL_CONFIG_SH)" ]; then \
|
||||
echo 'TCL_CONFIG_SH must be set to point to a "tclConfig.sh"' 1>&2; exit 1; \
|
||||
fi
|
||||
touch has_tclconfig
|
||||
@if [ x != "x$(TCLLIBDIR)" ]; then echo TCLLIBDIR="$(TCLLIBDIR)"; else \
|
||||
ld= ; \
|
||||
for d in `echo "puts stdout \\$$auto_path" | $(TCLSH_CMD)`; do \
|
||||
if [ -d "$$d" ]; then ld=$$d; break; fi; \
|
||||
done; \
|
||||
if [ x = "x$$ld" ]; then echo "Cannot determine TCLLIBDIR" 1>&2; exit 1; fi; \
|
||||
echo "TCLLIBDIR=$$ld/sqlite3"; \
|
||||
fi > $@; \
|
||||
echo ". \"$(TCL_CONFIG_SH)\" || exit \$$?" >> $@
|
||||
|
||||
#
|
||||
# $(T.tcl.env.source) is shell code to be run as part of any
|
||||
# compilation or link step which requires vars from
|
||||
# $(TCL_CONFIG_SH). All targets which use this should also have a
|
||||
# dependency on $(T.tcl.env.sh).
|
||||
#
|
||||
T.tcl.env.source = . $(T.tcl.env.sh) || exit $$?
|
||||
|
||||
#
|
||||
# $(T.compile.tcl) and $(T.link.tcl) are TCL-specific counterparts for $(T.compile)
|
||||
# and $(T.link) which first invoke $(T.tcl.env.source). Any targets which used them
|
||||
# must have a dependency on $(T.tcl.env.sh)
|
||||
#
|
||||
T.compile.tcl = $(T.tcl.env.source); $(T.compile)
|
||||
T.link.tcl = $(T.tcl.env.source); $(T.link)
|
||||
|
||||
#
|
||||
# This target creates a directory named "tsrc" and fills it with
|
||||
@@ -1231,19 +1270,19 @@ whereexpr.o: $(TOP)/src/whereexpr.c $(DEPS_OBJ_COMMON)
|
||||
window.o: $(TOP)/src/window.c $(DEPS_OBJ_COMMON)
|
||||
$(T.cc.sqlite) $(CFLAGS.libsqlite3) -c $(TOP)/src/window.c
|
||||
|
||||
tclsqlite.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile) -DUSE_TCL_STUBS=1 $(TCL_INCLUDE_SPEC) $(CFLAGS.intree_includes) \
|
||||
tclsqlite.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile.tcl) -DUSE_TCL_STUBS=1 $$TCL_INCLUDE_SPEC $(CFLAGS.intree_includes) \
|
||||
-c $(TOP)/src/tclsqlite.c
|
||||
|
||||
tclsqlite-shell.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c $(TCL_INCLUDE_SPEC)
|
||||
tclsqlite-shell.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile.tcl) -DTCLSH -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
|
||||
|
||||
tclsqlite-stubs.o: $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $(TCL_INCLUDE_SPEC)
|
||||
tclsqlite-stubs.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
|
||||
$(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
|
||||
|
||||
tclsqlite3$(T.exe): has_tclconfig tclsqlite-shell.o $(libsqlite3.LIB)
|
||||
$(T.link) -o $@ tclsqlite-shell.o \
|
||||
$(libsqlite3.LIB) $(TCL_INCLUDE_SPEC) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
|
||||
tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.SO)
|
||||
$(T.link.tcl) -o $@ tclsqlite-shell.o \
|
||||
$(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
|
||||
|
||||
# Rules to build opcodes.c and opcodes.h
|
||||
#
|
||||
@@ -1300,59 +1339,22 @@ so: $(libsqlite3.SO)-$(ENABLE_SHARED)
|
||||
all: so
|
||||
|
||||
#
|
||||
# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION) and
|
||||
# create symlinks which point to it. Do we really need all of this
|
||||
# hoop-jumping? Can we not simply install the .so as-is to
|
||||
# libsqlite3.so (without the versioned bits)?
|
||||
# Install the $(libsqlite3.SO) as $(libsqlite3.SO).$(PACKAGE_VERSION)
|
||||
# and create symlinks which point to it:
|
||||
#
|
||||
# Regarding the historcal installation name of libsqlite3.so.0.8.6:
|
||||
#
|
||||
# The historical SQLite build always used a version number of 0.8.6
|
||||
# for reasons lost to history but having something to do with libtool
|
||||
# (which is not longer used in this tree). In order to retain filename
|
||||
# compatibility for systems which have libraries installed using those
|
||||
# conventions:
|
||||
#
|
||||
# 1) If libsqlite3.so.0.8.6 is found in the target installation
|
||||
# directory then it is re-linked to point to the new
|
||||
# names. libsqlite3.so.0 historically symlinks to
|
||||
# libsqlite3.so.0.8.6, and that link is left in place. We cannot
|
||||
# retain both the old and new installation because they both share
|
||||
# the high-level name $(libsqlite3.SO). The down-side of this is
|
||||
# that it may well upset packaging tools when we replace
|
||||
# libsqlite3.so (from a legacy package) with a new symlink.
|
||||
#
|
||||
# 2) If INSTALL_SO_086_LINKS=1 and point (1) does not apply then links
|
||||
# to the legacy-style names are created. The primary intent of this
|
||||
# is to enable chains of operations such as the hypothetical (apt
|
||||
# remove sqlite3-3.47.0 && apt install sqlite3-3.48.0). In such
|
||||
# cases, condition (1) would never trigger but applications might
|
||||
# still expect to see the legacy file names.
|
||||
#
|
||||
# In either case we also delete libsqlite3.la because it cannot work
|
||||
# with the non-libtool library this installation installs.
|
||||
# - libsqlite3.so.$(PACKAGE_VERSION)
|
||||
# - libsqlite3.so.3 =symlink-> libsqlite3.so.$(PACKAGE_VERSION)
|
||||
# - libsqlite3.so =symlink-> libsqlite3.so.3
|
||||
#
|
||||
install-so-1: $(install-dir.lib) $(libsqlite3.SO)
|
||||
$(INSTALL) $(libsqlite3.SO) $(install-dir.lib)
|
||||
$(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)"
|
||||
@echo "Setting up SO symlinks..."; \
|
||||
cd $(install-dir.lib) || exit $$?; \
|
||||
rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).$(PACKAGE_VERSION) libsqlite3.la || exit $$?; \
|
||||
cd "$(install-dir.lib)" || exit $$?; \
|
||||
rm -f $(libsqlite3.SO).3 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
|
||||
mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).3 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).3 $(libsqlite3.SO) || exit $$?; \
|
||||
ls -la $(libsqlite3.SO) $(libsqlite3.SO).3* || exit $$?; \
|
||||
if [ -e $(libsqlite3.SO).0.8.6 ]; then \
|
||||
echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \
|
||||
rm -f $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.SO).0*; \
|
||||
elif [ x1 = "x$(INSTALL_SO_086_LINKS)" ]; then \
|
||||
echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINKS=1"; \
|
||||
rm -f $(libsqlite3.SO).0.8.6 $(libsqlite3.SO).0 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).0.8.6 $(libsqlite3.SO).0 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.SO).0*; \
|
||||
fi
|
||||
ls -la $(libsqlite3.SO) $(libsqlite3.SO).3*
|
||||
install-so-0 install-so-:
|
||||
install-so: install-so-$(ENABLE_SHARED)
|
||||
install: install-so
|
||||
@@ -1361,7 +1363,7 @@ install: install-so
|
||||
# Install $(libsqlite3.LIB)
|
||||
#
|
||||
install-lib-1: $(install-dir.lib) $(libsqlite3.LIB)
|
||||
$(INSTALL.noexec) $(libsqlite3.LIB) $(install-dir.lib)
|
||||
$(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)"
|
||||
install-lib-0 install-lib-:
|
||||
install-lib: install-lib-$(ENABLE_STATIC)
|
||||
install: install-lib
|
||||
@@ -1369,9 +1371,9 @@ install: install-lib
|
||||
#
|
||||
# Install C header files
|
||||
#
|
||||
install-includes: sqlite3.h $(install-dir.include)
|
||||
$(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" $(install-dir.include)
|
||||
install: install-includes
|
||||
install-headers: sqlite3.h $(install-dir.include)
|
||||
$(INSTALL.noexec) sqlite3.h "$(TOP)/src/sqlite3ext.h" "$(install-dir.include)"
|
||||
install: install-headers
|
||||
|
||||
#
|
||||
# libtclsqlite3...
|
||||
@@ -1379,21 +1381,24 @@ install: install-includes
|
||||
pkgIndex.tcl:
|
||||
echo 'package ifneeded sqlite3 $(PACKAGE_VERSION) [list load [file join $$dir libtclsqlite3[info sharedlibextension]] sqlite3]' > $@
|
||||
libtclsqlite3.SO = libtclsqlite3$(T.dll)
|
||||
$(libtclsqlite3.SO): tclsqlite.o $(libsqlite3.LIB)
|
||||
$(libtclsqlite3.SO): $(T.tcl.env.sh) tclsqlite.o $(LIBOBJ)
|
||||
$(T.tcl.env.source); \
|
||||
$(T.link.shared) -o $@ tclsqlite.o \
|
||||
$(TCL_INCLUDE_SPEC) $(TCL_STUB_LIB_SPEC) $(LDFLAGS.libsqlite3) \
|
||||
$(libsqlite3.LIB) $(TCLLIB_RPATH)
|
||||
$$TCL_INCLUDE_SPEC $$TCL_STUB_LIB_SPEC $(LDFLAGS.libsqlite3) \
|
||||
$(LIBOBJ) -Wl,-rpath,$$TCLLIBDIR
|
||||
# ^^^ that rpath bit is defined as TCL_LD_SEARCH_FLAGS in
|
||||
# tclConfig.sh, but it's defined in such a way as to be useless for a
|
||||
# _static_ makefile.
|
||||
$(libtclsqlite3.SO)-1: $(libtclsqlite3.SO)
|
||||
$(libtclsqlite3.SO)-0 $(libtclsqlite3.SO)-:
|
||||
libtcl: $(libtclsqlite3.SO)-$(HAVE_TCL)
|
||||
all: libtcl
|
||||
|
||||
install.tcldir = $(DESTDIR)$(TCLLIBDIR)
|
||||
install-tcl-1: $(libtclsqlite3.SO) pkgIndex.tcl
|
||||
@if [ "x$(DESTDIR)" = "x$(install.tcldir)" ]; then echo "TCLLIBDIR is not set." 1>&2; exit 1; fi
|
||||
$(INSTALL) -d $(install.tcldir)
|
||||
$(INSTALL) $(libtclsqlite3.SO) $(install.tcldir)
|
||||
$(INSTALL.noexec) pkgIndex.tcl $(install.tcldir)
|
||||
$(T.tcl.env.source); \
|
||||
$(INSTALL) -d "$(DESTDIR)$$TCLLIBDIR"; \
|
||||
$(INSTALL) $(libtclsqlite3.SO) "$(DESTDIR)$$TCLLIBDIR"; \
|
||||
$(INSTALL.noexec) pkgIndex.tcl "$(DESTDIR)$$TCLLIBDIR"
|
||||
install-tcl-0 install-tcl-:
|
||||
install-tcl: install-tcl-$(HAVE_TCL)
|
||||
install: install-tcl
|
||||
@@ -1421,14 +1426,14 @@ tclextension-install: tclsqlite3.c
|
||||
$(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --cc "$(T.cc)" $(CFLAGS.tclextension)
|
||||
|
||||
#
|
||||
# Install the SQLite TCL extension that is used by $TCLSH_CMD
|
||||
# Uninstall the SQLite TCL extension that is used by $TCLSH_CMD.
|
||||
#
|
||||
tclextension-uninstall:
|
||||
$(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall
|
||||
|
||||
#
|
||||
# List all installed the SQLite TCL extension that is are accessible
|
||||
# by $TCLSH_CMD, included prior versions.
|
||||
# List all installed the SQLite TCL extensions that is are accessible
|
||||
# by $TCLSH_CMD, including prior versions.
|
||||
#
|
||||
tclextension-list:
|
||||
$(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info
|
||||
@@ -1497,10 +1502,10 @@ TESTFIXTURE_SRC1 = sqlite3.c
|
||||
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)/src/tclsqlite.c
|
||||
TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
|
||||
|
||||
testfixture$(T.exe): has_tclconfig has_tclsh85 $(TESTFIXTURE_SRC)
|
||||
$(T.link) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
|
||||
testfixture$(T.exe): $(T.tcl.env.sh) has_tclsh85 $(TESTFIXTURE_SRC)
|
||||
$(T.link.tcl) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
|
||||
-o $@ $(TESTFIXTURE_SRC) \
|
||||
$(TCL_LIB_SPEC) $(TCL_INCLUDE_SPEC) \
|
||||
$$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC \
|
||||
$(CFLAGS.libsqlite3) $(LDFLAGS.libsqlite3)
|
||||
|
||||
coretestprogs: testfixture$(B.exe) sqlite3$(B.exe)
|
||||
@@ -1617,16 +1622,16 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \
|
||||
$(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in has_tclsh85
|
||||
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
|
||||
|
||||
sqlite3_analyzer$(T.exe): has_tclconfig sqlite3_analyzer.c
|
||||
$(T.link) sqlite3_analyzer.c -o $@ $(TCL_LIB_SPEC) $(TCL_INCLUDE_SPEC) $(LDFLAGS.libsqlite3)
|
||||
sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c
|
||||
$(T.link.tcl) sqlite3_analyzer.c -o $@ $$TCL_LIB_SPEC $$TCL_INCLUDE_SPEC $(LDFLAGS.libsqlite3)
|
||||
|
||||
sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl \
|
||||
$(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl \
|
||||
$(TOP)/tool/sqltclsh.c.in has_tclsh85
|
||||
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c
|
||||
|
||||
sqltclsh$(T.exe): has_tclconfig sqltclsh.c
|
||||
$(T.link) sqltclsh.c -o $@ $(TCL_INCLUDE_SPEC) $(CFLAGS.libsqlite3) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
|
||||
sqltclsh$(T.exe): $(T.tcl.env.sh) sqltclsh.c
|
||||
$(T.link.tcl) sqltclsh.c -o $@ $$TCL_INCLUDE_SPEC $(CFLAGS.libsqlite3) $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
|
||||
# xbin: target for generic binaries which aren't usually built. It is
|
||||
# used primarily for testing the build process.
|
||||
xbin: sqltclsh$(T.exe)
|
||||
@@ -1650,8 +1655,8 @@ CHECKER_DEPS =\
|
||||
sqlite3_checker.c: $(CHECKER_DEPS) has_tclsh85
|
||||
$(B.tclsh) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@
|
||||
|
||||
sqlite3_checker$(T.exe): has_tclconfig sqlite3_checker.c
|
||||
$(T.link) sqlite3_checker.c -o $@ $(TCL_INCLUDE_SPEC) $(CFLAGS.libsqlite3) $(TCL_LIB_SPEC) $(LDFLAGS.libsqlite3)
|
||||
sqlite3_checker$(T.exe): $(T.tcl.env.sh) sqlite3_checker.c
|
||||
$(T.link.tcl) sqlite3_checker.c -o $@ $$TCL_INCLUDE_SPEC $(CFLAGS.libsqlite3) $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
|
||||
xbin: sqlite3_checker$(T.exe)
|
||||
|
||||
dbdump$(T.exe): $(TOP)/ext/misc/dbdump.c sqlite3.o
|
||||
@@ -1813,7 +1818,7 @@ sqlite3$(T.exe)-0 sqlite3$(T.exe)-: sqlite3$(T.exe)
|
||||
all: sqlite3$(T.exe)-$(HAVE_WASI_SDK)
|
||||
|
||||
install-shell-0: sqlite3$(TEXT) $(install-dir.bin)
|
||||
$(INSTALL) -s sqlite3$(TEXT) $(install-dir.bin)
|
||||
$(INSTALL) -s sqlite3$(TEXT) "$(install-dir.bin)"
|
||||
install-shell-1 install-shell-:
|
||||
install: install-shell-$(HAVE_WASI_SDK)
|
||||
|
||||
@@ -1821,7 +1826,7 @@ sqldiff$(T.exe): $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o
|
||||
$(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3)
|
||||
|
||||
install-diff: sqldiff$(T.exe) $(install-dir.bin)
|
||||
$(INSTALL) -s sqldiff$(TEXT) $(install-dir.bin)
|
||||
$(INSTALL) -s sqldiff$(TEXT) "$(install-dir.bin)"
|
||||
#install: install-diff
|
||||
|
||||
dbhash$(T.exe): $(TOP)/tool/dbhash.c sqlite3.o sqlite3.h
|
||||
@@ -1844,18 +1849,18 @@ sqlite3_rsync$(T.exe): $(RSYNC_SRC)
|
||||
xbin: sqlite3_rsync$(T.exe)
|
||||
|
||||
install-rsync: sqlite3_rsync$(T.exe) $(install-dir.bin)
|
||||
$(INSTALL) sqlite3_rsync$(TEXT) $(install-dir.bin)
|
||||
$(INSTALL) sqlite3_rsync$(TEXT) "$(install-dir.bin)"
|
||||
#install: install-rsync
|
||||
|
||||
install-man1: $(install-dir.man1)
|
||||
$(INSTALL.noexec) $(TOP)/sqlite3.1 $(install-dir.man1)
|
||||
$(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)"
|
||||
install: install-man1
|
||||
|
||||
#
|
||||
# sqlite3.pc is typically generated by the configure script but could
|
||||
# conceivably be generated by hand.
|
||||
install-pc: sqlite3.pc $(install-dir.pkgconfig)
|
||||
$(INSTALL.noexec) sqlite3.pc $(install-dir.pkgconfig)
|
||||
$(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)"
|
||||
|
||||
scrub$(T.exe): $(TOP)/ext/misc/scrub.c sqlite3.o
|
||||
$(T.link) -o $@ -I. -DSCRUB_STANDALONE \
|
||||
@@ -1970,8 +1975,6 @@ mptest: mptester$(T.exe)
|
||||
# Source and header files that shell.c depends on
|
||||
SHELL_DEP = \
|
||||
$(TOP)/src/shell.c.in \
|
||||
$(TOP)/ext/consio/console_io.c \
|
||||
$(TOP)/ext/consio/console_io.h \
|
||||
$(TOP)/ext/expert/sqlite3expert.c \
|
||||
$(TOP)/ext/expert/sqlite3expert.h \
|
||||
$(TOP)/ext/intck/sqlite3intck.c \
|
||||
@@ -2052,9 +2055,6 @@ fts3_write.o: $(TOP)/ext/fts3/fts3_write.c $(DEPS_EXT_COMMON)
|
||||
rtree.o: $(TOP)/ext/rtree/rtree.c $(DEPS_EXT_COMMON)
|
||||
$(T.cc.extension) -c $(TOP)/ext/rtree/rtree.c
|
||||
|
||||
userauth.o: $(TOP)/ext/userauth/userauth.c $(DEPS_EXT_COMMON)
|
||||
$(T.cc.extension) -c $(TOP)/ext/userauth/userauth.c
|
||||
|
||||
sqlite3session.o: $(TOP)/ext/session/sqlite3session.c $(DEPS_EXT_COMMON)
|
||||
$(T.cc.extension) -c $(TOP)/ext/session/sqlite3session.c
|
||||
|
||||
@@ -2129,8 +2129,8 @@ tidy: tidy-.
|
||||
rm -f sessionfuzz$(T.exe) changesetfuzz$(T.exe)
|
||||
rm -f dbdump$(T.exe) dbtotxt$(T.exe) atrc$(T.exe)
|
||||
rm -f threadtest5$(T.exe)
|
||||
rm -f src-verify$(B.exe) has_tclsh* has_tclconfig
|
||||
rm -f tclsqlite3.c
|
||||
rm -f src-verify$(B.exe)
|
||||
rm -f tclsqlite3.c has_tclsh* $(T.tcl.env.sh)
|
||||
rm -f sqlite3rc.h sqlite3.def
|
||||
|
||||
#
|
||||
@@ -2143,3 +2143,11 @@ clean: clean-. tidy
|
||||
# Clean up everything. No exceptions.
|
||||
distclean-.:
|
||||
distclean: distclean-. clean
|
||||
|
||||
|
||||
# Show important variable settings.
|
||||
show-variables:
|
||||
@echo "CC = $(CC)"
|
||||
@echo "B.cc = $(B.cc)"
|
||||
@echo "T.cc = $(T.cc)"
|
||||
@echo "T.cc.sqlite = $(T.cc.sqlite)"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
C Merge\slatest\strunk\schanges\sinto\sthis\sbranch.
|
||||
D 2024-10-28T10:39:14.631
|
||||
D 2024-11-01T19:41:22.452
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2
|
||||
F Makefile.in 02ea00ff433902dba369d4a55b3aeb6bb1ffe2d82f777194984b8cdd7ed7c3ad
|
||||
F Makefile.linux-generic 8df0e6ee5e4671f844caf27f88d2be7421e904639f7a0ffdce0e2cd4ea11e8c0
|
||||
F Makefile.msc d2d927177660945599ba88ea32f1ab5c261a96a8797380b99766e27f3aea7e4f
|
||||
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
|
||||
F Makefile.in 3a98abc984222a31c8597a0cd516c8dd9b72554d784a87c915d2e586db4ddb18
|
||||
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
|
||||
F Makefile.msc a92237976eb92c5efaa0dd2524746aec12c196e12df8d4dbff9543a4648c3312
|
||||
F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159
|
||||
F VERSION 8dc0c3df15fd5ff0622f88fc483533fce990b1cbb2f5fb9fdfb4dbd71eef2889
|
||||
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
|
||||
@@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
|
||||
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
|
||||
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
|
||||
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
|
||||
F auto.def 57635a8f8c2e5e91e4c21094a70bbb56473811366e75679ceec9b6626e49a826
|
||||
F auto.def 9cf971c8877aa7b999c3b3b41fe802feea49a50ea98afc0f9964cfc5cc69057b
|
||||
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
|
||||
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
|
||||
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
|
||||
@@ -47,9 +47,9 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
|
||||
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
|
||||
F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14
|
||||
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
|
||||
F autosetup/hwaci-common.tcl 064900a2e7512e6e1ce9f25bb74d6850574d294b026885f0329dbe69585407dd
|
||||
F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6
|
||||
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
|
||||
F autosetup/proj.tcl 68362ca12e1a32fe73ece32b59a8e8e02a3983295f2dd82c9c4700507bade02c w autosetup/hwaci-common.tcl
|
||||
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
|
||||
F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
|
||||
F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9
|
||||
@@ -68,11 +68,6 @@ F doc/vdbesort-memory.md 4da2639c14cd24a31e0af694b1a8dd37eaf277aff3867e9a8cc1404
|
||||
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
|
||||
F doc/wal-lock.md 781726aaba20bafeceb7ba9f91d5c98c6731691b30c954e37cf0b49a053d461d
|
||||
F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
|
||||
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
|
||||
F ext/async/sqlite3async.c 6f247666b495c477628dd19364d279c78ea48cd90c72d9f9b98ad1aff3294f94
|
||||
F ext/async/sqlite3async.h 46b47c79357b97ad85d20d2795942c0020dc20c532114a49808287f04aa5309a
|
||||
F ext/consio/console_io.c d2b74afae8d301de2e8447b1045fcd33eb59df13bf581d906d99c74fe5d2b13f x
|
||||
F ext/consio/console_io.h b5ebe34aa15b357621ebbea3d3f2e2b24750d4280b5802516409e23947fd9ee5
|
||||
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
|
||||
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
|
||||
F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c
|
||||
@@ -620,9 +615,6 @@ F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009e
|
||||
F ext/session/sqlite3session.c 3d0a7f0f7a1c946e01818c716a55a40ae30542a29a9045cb05daf7fb658cdafa
|
||||
F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b
|
||||
F ext/session/test_session.c aa29abdcc9011ac02f4fa38e8ede226106eaeee7c3ea7d8b2b999a124e0c368c
|
||||
F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
|
||||
F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
|
||||
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
||||
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
||||
F ext/wasm/GNUmakefile 311aa0d5edc7006409962cc77cc26560d92f9be69c2c4302e8bbc68189fd02db
|
||||
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
|
||||
@@ -705,35 +697,32 @@ F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471
|
||||
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
|
||||
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
|
||||
F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
|
||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
|
||||
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
|
||||
F main.mk 3f3abb991f6e4e2d306491060b06c0b861b6ca886fcce06651483ecba12a3f6c
|
||||
F main.mk 741ad81800eb48eeb09c9093fc7436aef9d635aaca7376faec3ed088173066fe
|
||||
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
|
||||
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
|
||||
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
|
||||
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
|
||||
F mptest/mptest.c aa41ace6dbc5050d76b02548d3521e6bbccae4f0
|
||||
F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d
|
||||
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 acdff36db796e2d00225b911d3047d580cd136547298435426ce9d40347973cc
|
||||
F sqlite3.pc.in 0977c03a4da7c4204bd60e784a0efb8d51a190448aba78a4e973fe7192bdaf03
|
||||
F sqlite3.pc.in 2d5c88643679fc199dafc9afb6ea8868ea3192d941c2e57dbe06395149d892ba
|
||||
F sqlite_cfg.h.in be1d075cf77134d53fdf5cc2c0919842e7e02a648c66a56e735af25ccdcaff91
|
||||
F src/alter.c aa93e37e4a36a0525bbb2a2aeda20d2018f0aa995542c7dc658e031375e3f532
|
||||
F src/analyze.c 9a8b67239d899ac12289db5db3f5bfe7f7a0ad1277f80f87ead1d048085876eb
|
||||
F src/attach.c 08235ab62ed5ccc93c22bf36e640d19effcd632319615851bccf724ec9341333
|
||||
F src/auth.c 4c1ea890e0069ad73bead5d17a5b12c34cfa4f1a24175c8147ea439b64be271c
|
||||
F src/attach.c f35bb8cc1fcdde8f6815a7ef09ae413bcac71821d530796800ba24b3c7da1e80
|
||||
F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc
|
||||
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
|
||||
F src/bitvec.c 9eac5f42c11914d5ef00a75605bb205e934f435c579687f985f1f8b0995c8645
|
||||
F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
|
||||
F src/btree.c 63ca6b647342e8cef643863cd0962a542f133e1069460725ba4461dcda92b03c
|
||||
F src/btree.h 18e5e7b2124c23426a283523e5f31a4bff029131b795bb82391f9d2f3136fc50
|
||||
F src/btreeInt.h 98aadb6dcb77b012cab2574d6a728fad56b337fc946839b9898c4b4c969e30b6
|
||||
F src/build.c 3a1840d9d171ce2d24f4c1f7acda7266ab796c664290c1acba65ff98ce2bd01e
|
||||
F src/build.c c6b09342d870a509529244ed8e19b4175a261f2e3163c199241d69e1d8a57607
|
||||
F src/callback.c db3a45e376deff6a16c0058163fe0ae2b73a2945f3f408ca32cf74960b28d490
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c b224d3db0f28c4a5f1407c50107a0a8133bd244ff3c7f6f8cedeb896a8cf1b64
|
||||
F src/ctime.c d35723024b963edce9c0fad5b3303e8bb9266083784844baed10a6dedfe26f3b
|
||||
F src/date.c 89ce1ff20512a7fa5070ba6e7dd5c171148ca7d580955795bf97c79c2456144a
|
||||
F src/dbpage.c db1be8adaf1f839ad733c08baeac5c22aa912f7b535865c0c061382602081360
|
||||
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
|
||||
@@ -741,7 +730,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
|
||||
F src/expr.c a9d9f5fdfbdd3b2c94d7af1b11f181464b8a641736cf32cb92fa3c5e7ecb30df
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
|
||||
F src/func.c 1d093b93b8f097665721e59a1c404d7db4dc591e1a777a7a1022dfbda21e108b
|
||||
F src/func.c fa138d44348e189817542f6efa6232420b3e0081c835ced65883adc7fd777d65
|
||||
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
|
||||
F src/hash.c 9ee4269fb1d6632a6fecfb9479c93a1f29271bddbbaf215dd60420bcb80c7220
|
||||
F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51
|
||||
@@ -751,7 +740,7 @@ F src/insert.c f8d1a0f8ee258411009c6b7f2d93170e351bd19f5ad89d57e1180644297cbe70
|
||||
F src/json.c 68a98c020c22127f2d65f08855f7fc7460ff352a6ce0b543d8931dde83319c22
|
||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
|
||||
F src/main.c d55d27db5a3b7bb12e1b723e350efd833586f22baa4b15ca2c0b4bde9a44ae29
|
||||
F src/main.c f6daba376adac080fe9287c6746fb15e12c7e47d022f2e9f2986ed364b7e0329
|
||||
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
|
||||
@@ -781,7 +770,7 @@ F src/parse.y a7a8d42eeff01d267444ddb476029b0b1726fb70ae3d77984140f17ad02e2d61
|
||||
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
|
||||
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
|
||||
F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319
|
||||
F src/pragma.c cd613126f7cdd0c2ded4648c3c7b7b0239e678d7f3489e88c4b6d6858372fd07
|
||||
F src/pragma.c a2ec3657a953fa7dea7c1e680e4358b6ce6ae570b6c5234e0f5ef219d308d223
|
||||
F src/pragma.h e690a356c18e98414d2e870ea791c1be1545a714ba623719deb63f7f226d8bb7
|
||||
F src/prepare.c 3ba0ad907b7773ed642f66cea8a2c9c8edc18841aa1050b6218dbb3479e86225
|
||||
F src/printf.c 6a87534ebfb9e5346011191b1f3a7ebc457f5938c7e4feeea478ecf53f6a41b2
|
||||
@@ -789,17 +778,17 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
|
||||
F src/resolve.c c8a5372b97b2a2e972a280676f06ddb5b74e885d3b1f5ce383f839907b57ef68
|
||||
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
|
||||
F src/select.c 4b14337a2742f0c0beeba490e9a05507e9b4b12184b9cd12773501d08d48e3fe
|
||||
F src/shell.c.in 2fb0947424944f8baa1b4efdfd9eca70dc0691bbc1cb4d283db7fc142937fa3a
|
||||
F src/sqlite.h.in 29fc900a58f394c7488d093fd7a8dcb14d3fa6399d5178cb20adcf88dbedfe39
|
||||
F src/shell.c.in 4eb010971da0a4b103af5853152e9c95b991174df75528fda6f333037f0007a0
|
||||
F src/sqlite.h.in 599203aa6cf3a662f879e7581f4b7f2678738c0b7c71ddda3c0cb5c59867c399
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
|
||||
F src/sqliteInt.h baae24292817e13e7fe748851c62efc381dcc4dac241b1182eac3d2f05eae52c
|
||||
F src/sqliteInt.h 77be043f8694f4a8702d0ee882022b2e5a6489a0493e77c5d9a73f1efc5a2cc1
|
||||
F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728
|
||||
F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
|
||||
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
|
||||
F src/tclsqlite.c 47d4bb6eb06aab48d643eeb8c4f65b5fa9529fa5526fdcbf223ea32277ed1b56
|
||||
F src/tclsqlite.c ff2dc3ec1bd318ee7a45d6b246a367703d5fb2a4c8da99d675ee7eb987b3a153
|
||||
F src/tclsqlite.h 65e2c761446e1c9fa0342b7d2612a703483643c8b6a316d12a65b745a4727395
|
||||
F src/test1.c 370668f1832dc7bc2ab0212d807d880b6cdb0d5949550489593ce0cdb4a61012
|
||||
F src/test1.c 9df74d1d8c0513b0f906942d004b7d7aff5c6f47320a921a0b890748bac0e34d
|
||||
F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3
|
||||
F src/test3.c e7573aa0f78ee4e070a4bc8c3493941c1aa64d5c66d4825c74c0f055451f432b
|
||||
F src/test4.c 13e57ae7ec7a959ee180970aef09deed141252fe9bb07c61054f0dfa4f1dfd5d
|
||||
@@ -807,13 +796,12 @@ F src/test5.c bb87279ed12e199486894e6c83e58dc8cd1de9524ace171d59219d3ab696a0c1
|
||||
F src/test6.c 763b92489f11f4a77b773f0d3b8369ab0edd5292ac794043062c337019f12d8a
|
||||
F src/test8.c 206d8f3cc73950d252906656e2646b5de0d580b07187b635fcb3edd8c2c5fbc0
|
||||
F src/test9.c 7a708ad27f8fda79113e5e15de66632710958c401e64c2f22bc04e2f5a7a1b62
|
||||
F src/test_async.c 0101173cf8137ba5473a84a695281fa9dedc2a1d155998c68623f2978017ad98
|
||||
F src/test_autoext.c 14d4bbd3d0bd1eec0f6d16b29e28cf1e2d0b020d454835f0721a5f68121ac10f
|
||||
F src/test_backup.c bd901e3c116c7f3b3bbbd4aae4ce87d99b400c9cbb0a9e7b4610af451d9719a7
|
||||
F src/test_bestindex.c 3401bee51665cbf7f9ed2552b5795452a8b86365e4c9ece745b54155a55670c6
|
||||
F src/test_blob.c bcdf6a6c22d0bcc13c41479d63692ef413add2a4d30e1e26b9f74ab85b9fb4d5
|
||||
F src/test_btree.c 28283787d32b8fa953eb77412ad0de2c9895260e4e5bd5a94b3c7411664f90d5
|
||||
F src/test_config.c e8d041a84151cbaee4dd82eb32e4153abe06856bcfab4771968a8cf930a86332
|
||||
F src/test_config.c bff5e1625c007f14a9ea4d346b6a741149b5e1f885c1c7ae69bb28a8ddade151
|
||||
F src/test_delete.c e2fe07646dff6300b48d49b2fee2fe192ed389e834dd635e3b3bac0ce0bf9f8f
|
||||
F src/test_demovfs.c 3efa2adf4f21e10d95521721687d5ca047aea91fa62dd8cc22ac9e5a9c942383
|
||||
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
|
||||
@@ -840,7 +828,7 @@ F src/test_schema.c b06d3ddc3edc173c143878f3edb869dd200d57d918ae2f38820534f9a5e3
|
||||
F src/test_sqllog.c 540feaea7280cd5f926168aee9deb1065ae136d0bbbe7361e2ef3541783e187a
|
||||
F src/test_superlock.c 18355ca274746aa6909e3744163e5deb1196a85d5bc64b9cd377273cef626da7
|
||||
F src/test_syscall.c 9ad7ab39910c16d29411678d91b0d27a7a996a718df5ee93dcd635e846d0275c
|
||||
F src/test_tclsh.c 6077f2bdc6b4ea2bace2a0cd6ea48e0a4651007ae7382c13efc0c495eb0c6956
|
||||
F src/test_tclsh.c c01706ac60bd3176754d3ccd37da74c6ad97c2e14489f8ed71b497c1c0ac0dd4
|
||||
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
|
||||
F src/test_thread.c d7a8bcea7445f37cc2a1f7f81dd6059634f45e0c61bfe80182b02872fb0328bb
|
||||
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
|
||||
@@ -858,7 +846,7 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
|
||||
F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba
|
||||
F src/util.c ceebf912f673247e305f16f97f0bb7285fca1d37413b79680714a553a9021d33
|
||||
F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40
|
||||
F src/vdbe.c 1f56a0ae24115c2e37213e77cf79aa3b8c8d0366755707385564f6b8dd83d0fb
|
||||
F src/vdbe.c 8a6eb02823b424b273614bae41579392a5c495424592b60423dd2c443a583df0
|
||||
F src/vdbe.h c2549a215898a390de6669cfa32adba56f0d7e17ba5a7f7b14506d6fd5f0c36a
|
||||
F src/vdbeInt.h af7d7e8291edd0b19f2cd698e60e4d4031078f9a2f2328ac8f0b7efb134f8a1d
|
||||
F src/vdbeapi.c 53c7e26a2c0821a892b20eee2cde4656e31998212f3d515576c780dfaa45fd17
|
||||
@@ -922,11 +910,6 @@ F test/analyzeE.test d2ec7921c162cdc33ac8e7eb01f9ebf78100610af7c94c8552bbf551de1
|
||||
F test/analyzeF.test 40b5cc3ad7b10e81020d7ca86f1417647ecfae7477cfd88acc5aa7ae1068f949
|
||||
F test/analyzeG.test 623be33038c49648872746c8dd8b23b5792c08fef173c55e82f1b12fca259852
|
||||
F test/analyzer1.test 459fa02c445ddbf0101a3bad47b34290a35f2e49
|
||||
F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b
|
||||
F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b
|
||||
F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7
|
||||
F test/async4.test 1787e3952128aa10238bf39945126de7ca23685a
|
||||
F test/async5.test 383ab533fdb9f7ad228cc99ee66e1acb34cc0dc0
|
||||
F test/atof1.test 7ec56debc04b32e8f9dc87239f4bbb07d84550fb83dd7475b0ead9e83beb35da
|
||||
F test/atomic.test 065a453dde33c77ff586d91ccaa6ed419829d492dbb1a5694b8a09f3f9d7d061
|
||||
F test/atomic2.test b6863b4aa552543874f80b42fb3063f1c8c2e3d8e56b6562f00a3cc347b5c1da
|
||||
@@ -1420,7 +1403,7 @@ F test/literal2.tcl 1499037beaf661aeecdbe48801220a181d805372a64c6128d5f26bb6a4a8
|
||||
F test/literal2.test b149e16b5fc9ee6249069a8858ed41052f222014fe0ba7ad43c2fb989c2dada2
|
||||
F test/loadext.test faa4f6eed07a5aac35d57fdd7bc07f8fc82464cfd327567c10cf0ba3c86cde04
|
||||
F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7
|
||||
F test/lock.test be4fe08118fb988fed741f429b7dd5d65e1c90db
|
||||
F test/lock.test 05f346b65040b9a27c032c984e1e509dfef1661135b4f26a3ab6d21358277803
|
||||
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
|
||||
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
|
||||
F test/lock4.test 27143363eda1622f03c133efc8db808fc331afd973486cb571ea71cd717d37b8
|
||||
@@ -1429,7 +1412,7 @@ F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
|
||||
F test/lock7.test 49f1eaff1cdc491cc5dee3669f3c671d9f172431
|
||||
F test/lock_common.tcl 2f3f7f2e9637f93ccf609df48ef5b27a50278b6b1cd752b445d52262e5841413
|
||||
F test/lookaside.test 5a828e7256f1ee4da8e1bdaa03373a3ccdb0f1ff98dfa82e9b76cb41a45b1083
|
||||
F test/main.test 1b07447e484d3a3ca8c620c6551258fa51f9cc9fdd56648e8949ea8c836be961
|
||||
F test/main.test e8752d76233b1c8906cd2c98ad920dba868bd63c87d51d8a2ea5e9cba55dd496
|
||||
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
|
||||
F test/malloc.test 18dd1c4188c81ca79cf123527c71b19ee0c31feb9947fdffb0dc6ceb1436816a
|
||||
F test/malloc3.test 6e88bae6312854a4adb4ecc2a6a5ea8c59b4db778b724ba718e1c43fc8c3c136
|
||||
@@ -1462,7 +1445,7 @@ F test/memdb1.test c737ac9aa5895092332b1dde24fae7ae494b7fcbcd346d22d600891096a38
|
||||
F test/memdb2.test 4ba1fc09e2f51df80d148a540e4a3fa66d0462e91167b27497084de4d1f6b5b4
|
||||
F test/memjournal.test 70f3a00c7f84ee2978ad14e831231caa1e7f23915a2c54b4f775a021d5740c6c
|
||||
F test/memjournal2.test dbc2c5cb5f7b38950f4f6dc3e73fcecf0fcbed3fc32c7ce913bba164d288da1e
|
||||
F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2
|
||||
F test/memleak.test c7478f1195d64887dd1c677edc39fa03b5bf29024e6dcc5b5cc554d7ed00b01f
|
||||
F test/memsubsys1.test 86b8158752af9188ed5b32a30674a1ef71183e6bc4e6808e815cd658ca9058a6
|
||||
F test/memsubsys2.test 774b93cb09ca50d1b759bb7c645baa2a9ce172edc3a3da67d5150a26a9fc2a08
|
||||
F test/merge1.test 7dd9dc6838bcd0623a069485fe3a8dd498a051c16e1877cf84f506c0d6a29b43
|
||||
@@ -1541,7 +1524,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/pendingrace.test e99efc5ab3584da3dfc8cd6a0ec4e5a42214820574f5ea24ee93f1d84655f463
|
||||
F test/percentile.test 52ba89d6ee6b65f770972b67dace358bab7cdbd532803d3db157845268e789cd
|
||||
F test/permutations.test 405542f1d659942994a6b38a9e024cf5cfd23eaa68c806aeb24a72d7c9186e80
|
||||
F test/permutations.test 37650c5286f7d6f322af95cad876b69c6c2c79c28dc649f09de07d3312b1213c
|
||||
F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f
|
||||
F test/pragma.test 11cb9310c42f921918f7f563e3c0b6e70f9f9c3a6a1cf12af8fccb6c574f3882
|
||||
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
|
||||
@@ -1737,7 +1720,7 @@ F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d163
|
||||
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
|
||||
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
|
||||
F test/tester.tcl 7b44f1a9b9a2de8112695b908afc21dd9a68cd2d44e84b73f1b27b53492c0d59
|
||||
F test/testrunner.tcl 4e764b0da245add9670d1010a69a3ac5474a5dfe15e1d3183294c23cca43ef13 x
|
||||
F test/testrunner.tcl 3c6acf0eecd2b5459082639183f2b4f667aa0b74ddab24e4d37295112c7a5325 x
|
||||
F test/testrunner_data.tcl ba4aeea28aa03cfa6fe7e57782ddecb7a7b91c3a0b3251583cb4f0ee002de6a6
|
||||
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
|
||||
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
|
||||
@@ -1787,7 +1770,6 @@ F test/tkt-8454a207b9.test ead80b7a01438ca1436cee029694a96c821346cf1e24f06de12f8
|
||||
F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356
|
||||
F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed
|
||||
F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5
|
||||
F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223
|
||||
F test/tkt-99378177930f87bd.test 9d6cff39b50d062c813ae1cb0ebbd1b7acf81ecc23ae5d5215e5bb05667dc137
|
||||
F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667
|
||||
F test/tkt-9d68c883.test 16f7cb96781ba579bc2e19bb14b4ad609d9774b6
|
||||
@@ -1961,7 +1943,6 @@ F test/upsert5.test 9953b180d02d1369cdbb6c73c900834e5fef8cb78e98e07511c8762ec21c
|
||||
F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
|
||||
F test/uri.test c1abaaaa28e9422d61e5f3f9cbc8ef993ec49fe802f581520731708561d49384
|
||||
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
|
||||
F test/userauth01.test e740a2697a7b40d7c5003a7d7edaee16acd349a9
|
||||
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
|
||||
F test/vacuum-into.test 77845cee98770c416dae9b0da6bb3229753861f2da65c11b4f9715d081712d8a
|
||||
F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d
|
||||
@@ -2156,7 +2137,7 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
|
||||
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
|
||||
F tool/mkautoconfamal.sh cbdcf993fa83dccbef7fb77b39cdeb31ef9f77d9d88c9e343b58d35ca3898a6a
|
||||
F tool/mkccode.tcl 4cb8ad7e7330aaed052b0657a1bfacbc67103c400e41860aff643a482cfc2d3e x
|
||||
F tool/mkctimec.tcl e3af51acc2ef92062fe6d622de010a27a34b497258a248dada04388b916c61c6 x
|
||||
F tool/mkctimec.tcl ef6a67ec82e5b6fc19152a4c79f237227b18bf67ff16d155bac7adb94355d9cf x
|
||||
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
|
||||
F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a
|
||||
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
|
||||
@@ -2167,8 +2148,8 @@ F tool/mkshellc.tcl 2bc29c201933ae72a16a79070fe80aded80c24ea487ecd2f8df20c2973c8
|
||||
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
|
||||
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
|
||||
F tool/mksqlite3c-noext.tcl 4f7cfef5152b0c91920355cbfc1d608a4ad242cb819f1aea07f6d0274f584a7f
|
||||
F tool/mksqlite3c.tcl 98a250d6f2ea60343268e32e2997790e678205ce128aa0d0a67a3f70811615af
|
||||
F tool/mksqlite3h.tcl 2a6ba8955adf9cfabd0617ee5949760e531e0b75b703b5faf8d1150657b5628f
|
||||
F tool/mksqlite3c.tcl 9e88a30981280e33489fe4782f4ab1e5349ba1866603fba7f1a948d5599b9124
|
||||
F tool/mksqlite3h.tcl 7a4648fef5efb33308d575c7775eb242855d71d5bf89065df3f006b9a634a0a1
|
||||
F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b
|
||||
F tool/mktoolzip.tcl 34b4e92be544f820e2cc26f143f7d5aec511e826ec394cc82969a5dcf7c7a27c
|
||||
F tool/mkvsix.tcl 67b40996a50f985a573278eea32fc5a5eb6110bdf14d33f1d8086e48c69e540a
|
||||
@@ -2199,7 +2180,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d
|
||||
F tool/split-sqlite3c.tcl 5aa60643afca558bc732b1444ae81a522326f91e1dc5665b369c54f09e20de60
|
||||
F tool/sqldiff.c 2a0987d183027c795ced13d6749061c1d2f38e24eddb428f56fa64c3a8f51e4b
|
||||
F tool/sqlite3_analyzer.c.in 348ba349bbdc93c9866439f9f935d7284866a2a4e6898bc906ae1204ade56918
|
||||
F tool/sqlite3_rsync.c 6c9cac5a9197f591985b271aeff803ec4fb4db36c8eab97e1331ff64aa1b8d94
|
||||
F tool/sqlite3_rsync.c 9a1cca2ab1271c59b37a6493c15dc1bcd0ab9149197a9125926bc08dd26b83fb
|
||||
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
|
||||
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
|
||||
F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4
|
||||
@@ -2209,6 +2190,7 @@ F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43
|
||||
F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37
|
||||
F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d
|
||||
F tool/symbols.sh 1612bd947750e21e7b47befad5f6b3825b06cce0705441f903bf35ced65ae9b9
|
||||
F tool/tclConfigShToMake.sh 7c065d81c2d178e15e45a77372c6e5a38b5a1b08755301cd6f20a3a862db7312 x
|
||||
F tool/tclConfigShToTcl.sh 44ec55046d86a3febb2cb3e099399b41794e80e9cd138eee7b9b016f819e882b x
|
||||
F tool/varint.c 5d94cb5003db9dbbcbcc5df08d66f16071aee003
|
||||
F tool/vdbe-compress.tcl fa2f37ab39b2a0087fafb6a7f3ce19503e25e624ffa8ed9951717ab72920c088
|
||||
@@ -2217,29 +2199,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
|
||||
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
|
||||
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
F vsixtest/App.xaml b76d3b48860e7454775c47ea38ffea9c4abe3e85
|
||||
F vsixtest/App.xaml.cpp 41158ee43269820136fa3bba00c0bd91b26cc38b650ee392aec2a8d823e54318
|
||||
F vsixtest/App.xaml.h 4a9768e2983d05600ad1e1c2f1b00a132967da9f
|
||||
F vsixtest/Assets/LockScreenLogo.scale-200.png e820c9a3deb909197081b0bf3216c06e13905f0a
|
||||
F vsixtest/Assets/SplashScreen.scale-200.png cab70988ca71bebec7bfeb3b6dbafe17b9ab0b4a
|
||||
F vsixtest/Assets/Square150x150Logo.scale-200.png e17b40817db7a239fc239d83efcc951fb824e3ff
|
||||
F vsixtest/Assets/Square44x44Logo.scale-200.png 2f166237094dea94d952d10b9eeae81806844f1c
|
||||
F vsixtest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png 5f6a6d391b95a3061ccca6e6fdd6955ede63b4ed
|
||||
F vsixtest/Assets/StoreLogo.png 0828b7257db74a4ecd5eeb6b7b4971f0fdc4d9d1
|
||||
F vsixtest/Assets/Wide310x150Logo.scale-200.png 04ddefe5bc5f43ae12a7433f6f236ddab101ac42
|
||||
F vsixtest/MainPage.xaml 34f49897e3ca533a7e74506ba0759b66eebce151
|
||||
F vsixtest/MainPage.xaml.cpp 7f31fc6de751b64676c0924c97a5485d950a91d7
|
||||
F vsixtest/MainPage.xaml.h cc05cca10d50a003f6c6e4448b701cdd07f52f29
|
||||
F vsixtest/Package.appxmanifest 6b6db1eb7df3a315c5d681059754d5f0e0c47a93
|
||||
F vsixtest/pch.cpp cb823cfac36f1a39a7eb0acbd7e9a0b0de8f23af
|
||||
F vsixtest/pch.h 9cab7980f2ac4baa40807d8b5e52af32a21cf78c
|
||||
F vsixtest/vsixtest.sln 77cadbe4e96c1fe1bf51cd77de9e9b0a12ada547
|
||||
F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080bb302912
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 740a37c5d54b57befa86a6bb299ffa89ed4243d10db885a08ab5c63238460dad d64dcb1a897f6cc690c680cdaf85272e2dd249f36798219834116b1375f74d34
|
||||
R 8b8a720d047d766fbd0819b9a2f0b104
|
||||
P bce9a524de6dda87daa90395cd55713d2d3ccfc090e53a947548e434db5eef5e 2dcc465a7090811ddbc210673f37b4c3a4439c501874abefd403efe1e98f5b17
|
||||
R 86617b1841d68e4c10c087c197cdd65c
|
||||
U dan
|
||||
Z c21264d65e469a1605c6df634f0238d3
|
||||
Z c01ad82d76d71ffe9e5032c32219c470
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
||||
@@ -1 +1 @@
|
||||
bce9a524de6dda87daa90395cd55713d2d3ccfc090e53a947548e434db5eef5e
|
||||
790c56d493c66a2136e24d349d169639809d70bfab6996975a403be568a267a5
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
%define name sqlite
|
||||
%define version SQLITE_VERSION
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
Summary: SQLite is a C library that implements an embeddable SQL database engine
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Group: System/Libraries
|
||||
URL: http://www.sqlite.org/
|
||||
License: Public Domain
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
SQLite is a software library that implements a self-contained, serverless,
|
||||
zero-configuration, transactional SQL database engine.
|
||||
Programs that link with the SQLite library can have SQL database access
|
||||
without running a separate RDBMS process. The distribution comes with a
|
||||
standalone command-line access program (sqlite) that can be used to
|
||||
administer an SQLite database and which serves as an example of how to
|
||||
use the SQLite library.
|
||||
|
||||
%package -n %{name}-devel
|
||||
Summary: Header files and libraries for developing apps which will use sqlite
|
||||
Group: Development/C
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description -n %{name}-devel
|
||||
The sqlite-devel package contains the header files and libraries needed
|
||||
to develop programs that use the SQLite database library.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}
|
||||
|
||||
%build
|
||||
CFLAGS="%optflags -DNDEBUG=1" CXXFLAGS="%optflags -DNDEBUG=1" ./configure --prefix=%{_prefix}
|
||||
|
||||
make
|
||||
make doc
|
||||
|
||||
%install
|
||||
install -d $RPM_BUILD_ROOT/%{_prefix}
|
||||
install -d $RPM_BUILD_ROOT/%{_prefix}/bin
|
||||
install -d $RPM_BUILD_ROOT/%{_prefix}/include
|
||||
install -d $RPM_BUILD_ROOT/%{_prefix}/lib
|
||||
make install prefix=$RPM_BUILD_ROOT/%{_prefix}
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%clean
|
||||
rm -fr $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%{_libdir}/*.so*
|
||||
%{_bindir}/*
|
||||
|
||||
%files -n %{name}-devel
|
||||
%defattr(-, root, root)
|
||||
%{_libdir}/pkgconfig/sqlite3.pc
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/*.la
|
||||
%{_includedir}/*
|
||||
%doc doc/*
|
||||
@@ -9,5 +9,5 @@ Name: SQLite
|
||||
Description: SQL database engine
|
||||
Version: @PACKAGE_VERSION@
|
||||
Libs: -L${libdir} -lsqlite3
|
||||
Libs.private: @LDFLAGS_MATH@ @LDFLAGS_ZLIB@ @LDFLAGS_ICU@
|
||||
Libs.private: @LDFLAGS_MATH@ @LDFLAGS_ICU@
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -227,15 +227,6 @@ static void attachFunc(
|
||||
sqlite3BtreeLeaveAll(db);
|
||||
assert( zErrDyn==0 || rc!=SQLITE_OK );
|
||||
}
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
if( rc==SQLITE_OK && !REOPEN_AS_MEMDB(db) ){
|
||||
u8 newAuth = 0;
|
||||
rc = sqlite3UserAuthCheckLogin(db, zName, &newAuth);
|
||||
if( newAuth<db->auth.authLevel ){
|
||||
rc = SQLITE_AUTH_USER;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if( rc ){
|
||||
if( ALWAYS(!REOPEN_AS_MEMDB(db)) ){
|
||||
int iDb = db->nDb - 1;
|
||||
|
||||
@@ -112,11 +112,7 @@ int sqlite3AuthReadCol(
|
||||
int rc; /* Auth callback return code */
|
||||
|
||||
if( db->init.busy ) return SQLITE_OK;
|
||||
rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
,db->auth.zAuthUser
|
||||
#endif
|
||||
);
|
||||
rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext);
|
||||
if( rc==SQLITE_DENY ){
|
||||
char *z = sqlite3_mprintf("%s.%s", zTab, zCol);
|
||||
if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
|
||||
@@ -223,11 +219,7 @@ int sqlite3AuthCheck(
|
||||
testcase( zArg3==0 );
|
||||
testcase( pParse->zAuthContext==0 );
|
||||
|
||||
rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
,db->auth.zAuthUser
|
||||
#endif
|
||||
);
|
||||
rc = db->xAuth(db->pAuthArg,code,zArg1,zArg2,zArg3,pParse->zAuthContext);
|
||||
if( rc==SQLITE_DENY ){
|
||||
sqlite3ErrorMsg(pParse, "not authorized");
|
||||
pParse->rc = SQLITE_AUTH;
|
||||
|
||||
@@ -189,17 +189,6 @@ void sqlite3FinishCoding(Parse *pParse){
|
||||
}
|
||||
sqlite3VdbeAddOp0(v, OP_Halt);
|
||||
|
||||
#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE)
|
||||
if( pParse->nTableLock>0 && db->init.busy==0 ){
|
||||
sqlite3UserAuthInit(db);
|
||||
if( db->auth.authLevel<UAUTH_User ){
|
||||
sqlite3ErrorMsg(pParse, "user not authenticated");
|
||||
pParse->rc = SQLITE_AUTH_USER;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The cookie mask contains one bit for each database file open.
|
||||
** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are
|
||||
** set for each database that is used. Generate code to start a
|
||||
@@ -328,16 +317,6 @@ void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
|
||||
pParse->nested--;
|
||||
}
|
||||
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
/*
|
||||
** Return TRUE if zTable is the name of the system table that stores the
|
||||
** list of users and their access credentials.
|
||||
*/
|
||||
int sqlite3UserAuthTable(const char *zTable){
|
||||
return sqlite3_stricmp(zTable, "sqlite_user")==0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Locate the in-memory structure that describes a particular database
|
||||
** table given the name of that table and (optionally) the name of the
|
||||
@@ -356,13 +335,6 @@ Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
|
||||
|
||||
/* All mutexes are required for schema access. Make sure we hold them. */
|
||||
assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) );
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
/* Only the admin user is allowed to know that the sqlite_user table
|
||||
** exists */
|
||||
if( db->auth.authLevel<UAUTH_Admin && sqlite3UserAuthTable(zName)!=0 ){
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if( zDatabase ){
|
||||
for(i=0; i<db->nDb; i++){
|
||||
if( sqlite3StrICmp(zDatabase, db->aDb[i].zDbSName)==0 ) break;
|
||||
@@ -4021,9 +3993,6 @@ void sqlite3CreateIndex(
|
||||
if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
|
||||
&& db->init.busy==0
|
||||
&& pTblName!=0
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
&& sqlite3UserAuthTable(pTab->zName)==0
|
||||
#endif
|
||||
){
|
||||
sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
|
||||
goto exit_create_index;
|
||||
|
||||
@@ -767,9 +767,6 @@ static const char * const sqlite3azCompileOpt[] = {
|
||||
#ifdef SQLITE_UNTESTABLE
|
||||
"UNTESTABLE",
|
||||
#endif
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
"USER_AUTHENTICATION",
|
||||
#endif
|
||||
#ifdef SQLITE_USE_ALLOCA
|
||||
"USE_ALLOCA",
|
||||
#endif
|
||||
|
||||
@@ -2678,9 +2678,6 @@ void sqlite3RegisterBuiltinFunctions(void){
|
||||
SFUNCTION(load_extension, 1, 0, 0, loadExt ),
|
||||
SFUNCTION(load_extension, 2, 0, 0, loadExt ),
|
||||
#endif
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
FUNCTION(sqlite_crypt, 2, 0, 0, sqlite3CryptFunc ),
|
||||
#endif
|
||||
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
|
||||
DFUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ),
|
||||
DFUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ),
|
||||
|
||||
@@ -1423,10 +1423,6 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
|
||||
sqlite3Error(db, SQLITE_OK); /* Deallocates any cached error strings. */
|
||||
sqlite3ValueFree(db->pErr);
|
||||
sqlite3CloseExtensions(db);
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
sqlite3_free(db->auth.zAuthUser);
|
||||
sqlite3_free(db->auth.zAuthPW);
|
||||
#endif
|
||||
|
||||
db->eOpenState = SQLITE_STATE_ERROR;
|
||||
|
||||
|
||||
@@ -1144,12 +1144,6 @@ void sqlite3Pragma(
|
||||
** in auto-commit mode. */
|
||||
mask &= ~(SQLITE_ForeignKeys);
|
||||
}
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
if( db->auth.authLevel==UAUTH_User ){
|
||||
/* Do not allow non-admin users to modify the schema arbitrarily */
|
||||
mask &= ~(SQLITE_WriteSchema);
|
||||
}
|
||||
#endif
|
||||
|
||||
if( sqlite3GetBoolean(zRight, 0) ){
|
||||
if( (mask & SQLITE_WriteSchema)==0
|
||||
|
||||
@@ -104,9 +104,6 @@ typedef unsigned short int u16;
|
||||
typedef sqlite3_int64 i64;
|
||||
typedef sqlite3_uint64 u64;
|
||||
typedef unsigned char u8;
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
# include "sqlite3userauth.h"
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -5798,15 +5795,22 @@ static char **readline_completion(const char *zText, int iStart, int iEnd){
|
||||
** Linenoise completion callback. Note that the 3rd argument is from
|
||||
** the "msteveb" version of linenoise, not the "antirez" version.
|
||||
*/
|
||||
static void linenoise_completion(const char *zLine, linenoiseCompletions *lc,
|
||||
void *pUserData){
|
||||
static void linenoise_completion(
|
||||
const char *zLine,
|
||||
linenoiseCompletions *lc
|
||||
#if HAVE_LINENOISE==2
|
||||
,void *pUserData
|
||||
#endif
|
||||
){
|
||||
i64 nLine = strlen(zLine);
|
||||
i64 i, iStart;
|
||||
sqlite3_stmt *pStmt = 0;
|
||||
char *zSql;
|
||||
char zBuf[1000];
|
||||
|
||||
#if HAVE_LINENOISE==2
|
||||
UNUSED_PARAMETER(pUserData);
|
||||
#endif
|
||||
if( nLine>(i64)sizeof(zBuf)-30 ) return;
|
||||
if( zLine[0]=='.' || zLine[0]=='#') return;
|
||||
for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
|
||||
@@ -11758,69 +11762,6 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
}else
|
||||
#endif
|
||||
|
||||
#if SQLITE_USER_AUTHENTICATION
|
||||
if( c=='u' && cli_strncmp(azArg[0], "user", n)==0 ){
|
||||
if( nArg<2 ){
|
||||
eputz("Usage: .user SUBCOMMAND ...\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
open_db(p, 0);
|
||||
if( cli_strcmp(azArg[1],"login")==0 ){
|
||||
if( nArg!=4 ){
|
||||
eputz("Usage: .user login USER PASSWORD\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3],
|
||||
strlen30(azArg[3]));
|
||||
if( rc ){
|
||||
sqlite3_fprintf(stderr,"Authentication failed for user %s\n", azArg[2]);
|
||||
rc = 1;
|
||||
}
|
||||
}else if( cli_strcmp(azArg[1],"add")==0 ){
|
||||
if( nArg!=5 ){
|
||||
eputz("Usage: .user add USER PASSWORD ISADMIN\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
rc = sqlite3_user_add(p->db, azArg[2], azArg[3], strlen30(azArg[3]),
|
||||
booleanValue(azArg[4]));
|
||||
if( rc ){
|
||||
sqlite3_fprintf(stderr,"User-Add failed: %d\n", rc);
|
||||
rc = 1;
|
||||
}
|
||||
}else if( cli_strcmp(azArg[1],"edit")==0 ){
|
||||
if( nArg!=5 ){
|
||||
eputz("Usage: .user edit USER PASSWORD ISADMIN\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
rc = sqlite3_user_change(p->db, azArg[2], azArg[3], strlen30(azArg[3]),
|
||||
booleanValue(azArg[4]));
|
||||
if( rc ){
|
||||
sqlite3_fprintf(stderr,"User-Edit failed: %d\n", rc);
|
||||
rc = 1;
|
||||
}
|
||||
}else if( cli_strcmp(azArg[1],"delete")==0 ){
|
||||
if( nArg!=3 ){
|
||||
eputz("Usage: .user delete USER\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
rc = sqlite3_user_delete(p->db, azArg[2]);
|
||||
if( rc ){
|
||||
sqlite3_fprintf(stderr,"User-Delete failed: %d\n", rc);
|
||||
rc = 1;
|
||||
}
|
||||
}else{
|
||||
eputz("Usage: .user login|add|edit|delete ...\n");
|
||||
rc = 1;
|
||||
goto meta_command_exit;
|
||||
}
|
||||
}else
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
if( c=='v' && cli_strncmp(azArg[0], "version", n)==0 ){
|
||||
char *zPtrSz = sizeof(void*)==8 ? "64-bit" : "32-bit";
|
||||
sqlite3_fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
|
||||
@@ -13262,7 +13203,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
|
||||
if( zHistory ){ shell_read_history(zHistory); }
|
||||
#if (HAVE_READLINE || HAVE_EDITLINE) && !defined(SQLITE_OMIT_READLINE_COMPLETION)
|
||||
rl_attempted_completion_function = readline_completion;
|
||||
#elif HAVE_LINENOISE
|
||||
#elif HAVE_LINENOISE==1
|
||||
linenoiseSetCompletionCallback(linenoise_completion);
|
||||
#elif HAVE_LINENOISE==2
|
||||
linenoiseSetCompletionCallback(linenoise_completion, NULL);
|
||||
#endif
|
||||
data.in = 0;
|
||||
|
||||
@@ -10889,4 +10889,4 @@ int sqlite3_deserialize(
|
||||
#ifdef __cplusplus
|
||||
} /* End of the 'extern "C"' block */
|
||||
#endif
|
||||
#endif /* SQLITE3_H */
|
||||
/* #endif for SQLITE3_H will be added by mksqlite3.tcl */
|
||||
|
||||
@@ -1602,47 +1602,11 @@ struct FuncDefHash {
|
||||
};
|
||||
#define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ)
|
||||
|
||||
#if defined(SQLITE_USER_AUTHENTICATION)
|
||||
# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \
|
||||
See ext/userauth/user-auth.txt for details."
|
||||
#endif
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
/*
|
||||
** Information held in the "sqlite3" database connection object and used
|
||||
** to manage user authentication.
|
||||
*/
|
||||
typedef struct sqlite3_userauth sqlite3_userauth;
|
||||
struct sqlite3_userauth {
|
||||
u8 authLevel; /* Current authentication level */
|
||||
int nAuthPW; /* Size of the zAuthPW in bytes */
|
||||
char *zAuthPW; /* Password used to authenticate */
|
||||
char *zAuthUser; /* User name used to authenticate */
|
||||
};
|
||||
|
||||
/* Allowed values for sqlite3_userauth.authLevel */
|
||||
#define UAUTH_Unknown 0 /* Authentication not yet checked */
|
||||
#define UAUTH_Fail 1 /* User authentication failed */
|
||||
#define UAUTH_User 2 /* Authenticated as a normal user */
|
||||
#define UAUTH_Admin 3 /* Authenticated as an administrator */
|
||||
|
||||
/* Functions used only by user authorization logic */
|
||||
int sqlite3UserAuthTable(const char*);
|
||||
int sqlite3UserAuthCheckLogin(sqlite3*,const char*,u8*);
|
||||
void sqlite3UserAuthInit(sqlite3*);
|
||||
void sqlite3CryptFunc(sqlite3_context*,int,sqlite3_value**);
|
||||
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
/*
|
||||
** typedef for the authorization callback function.
|
||||
*/
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
|
||||
const char*, const char*);
|
||||
#else
|
||||
typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
|
||||
const char*);
|
||||
#endif
|
||||
typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*,
|
||||
const char*);
|
||||
|
||||
#ifndef SQLITE_OMIT_DEPRECATED
|
||||
/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
|
||||
@@ -1803,9 +1767,6 @@ struct sqlite3 {
|
||||
void (*xUnlockNotify)(void **, int); /* Unlock notify callback */
|
||||
sqlite3 *pNextBlocked; /* Next in list of all blocked connections */
|
||||
#endif
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
sqlite3_userauth auth; /* User authentication information */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -1155,9 +1155,6 @@ static int auth_callback(
|
||||
const char *zArg2,
|
||||
const char *zArg3,
|
||||
const char *zArg4
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
,const char *zArg5
|
||||
#endif
|
||||
){
|
||||
const char *zCode;
|
||||
Tcl_DString str;
|
||||
@@ -1217,9 +1214,6 @@ static int auth_callback(
|
||||
Tcl_DStringAppendElement(&str, zArg2 ? zArg2 : "");
|
||||
Tcl_DStringAppendElement(&str, zArg3 ? zArg3 : "");
|
||||
Tcl_DStringAppendElement(&str, zArg4 ? zArg4 : "");
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
Tcl_DStringAppendElement(&str, zArg5 ? zArg5 : "");
|
||||
#endif
|
||||
rc = Tcl_GlobalEval(pDb->interp, Tcl_DStringValue(&str));
|
||||
Tcl_DStringFree(&str);
|
||||
zReply = rc==TCL_OK ? Tcl_GetStringResult(pDb->interp) : "SQLITE_DENY";
|
||||
|
||||
@@ -8324,131 +8324,6 @@ static int SQLITE_TCLAPI sorter_test_sort4_helper(
|
||||
}
|
||||
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
#include "sqlite3userauth.h"
|
||||
/*
|
||||
** tclcmd: sqlite3_user_authenticate DB USERNAME PASSWORD
|
||||
*/
|
||||
static int SQLITE_TCLAPI test_user_authenticate(
|
||||
ClientData clientData, /* Unused */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
char *zUser = 0;
|
||||
char *zPasswd = 0;
|
||||
Tcl_Size nPasswd = 0;
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
|
||||
if( objc!=4 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zUser = Tcl_GetString(objv[2]);
|
||||
zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
|
||||
rc = sqlite3_user_authenticate(db, zUser, zPasswd, (int)nPasswd);
|
||||
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
/*
|
||||
** tclcmd: sqlite3_user_add DB USERNAME PASSWORD ISADMIN
|
||||
*/
|
||||
static int SQLITE_TCLAPI test_user_add(
|
||||
ClientData clientData, /* Unused */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
char *zUser = 0;
|
||||
char *zPasswd = 0;
|
||||
Tcl_Size nPasswd = 0;
|
||||
int isAdmin = 0;
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
|
||||
if( objc!=5 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD ISADMIN");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zUser = Tcl_GetString(objv[2]);
|
||||
zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
|
||||
Tcl_GetBooleanFromObj(interp, objv[4], &isAdmin);
|
||||
rc = sqlite3_user_add(db, zUser, zPasswd, (int)nPasswd, isAdmin);
|
||||
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
/*
|
||||
** tclcmd: sqlite3_user_change DB USERNAME PASSWORD ISADMIN
|
||||
*/
|
||||
static int SQLITE_TCLAPI test_user_change(
|
||||
ClientData clientData, /* Unused */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
char *zUser = 0;
|
||||
char *zPasswd = 0;
|
||||
Tcl_Size nPasswd = 0;
|
||||
int isAdmin = 0;
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
|
||||
if( objc!=5 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME PASSWORD ISADMIN");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zUser = Tcl_GetString(objv[2]);
|
||||
zPasswd = Tcl_GetStringFromObj(objv[3], &nPasswd);
|
||||
Tcl_GetBooleanFromObj(interp, objv[4], &isAdmin);
|
||||
rc = sqlite3_user_change(db, zUser, zPasswd, (int)nPasswd, isAdmin);
|
||||
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
/*
|
||||
** tclcmd: sqlite3_user_delete DB USERNAME
|
||||
*/
|
||||
static int SQLITE_TCLAPI test_user_delete(
|
||||
ClientData clientData, /* Unused */
|
||||
Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
|
||||
int objc, /* Number of arguments */
|
||||
Tcl_Obj *CONST objv[] /* Command arguments */
|
||||
){
|
||||
char *zUser = 0;
|
||||
sqlite3 *db;
|
||||
int rc;
|
||||
|
||||
if( objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "DB USERNAME");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zUser = Tcl_GetString(objv[2]);
|
||||
rc = sqlite3_user_delete(db, zUser);
|
||||
Tcl_SetResult(interp, (char *)t1ErrorName(rc), TCL_STATIC);
|
||||
return TCL_OK;
|
||||
}
|
||||
#endif /* SQLITE_USER_AUTHENTICATION */
|
||||
|
||||
/*
|
||||
** tclcmd: register_dbstat_vtab DB
|
||||
@@ -9169,12 +9044,6 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
|
||||
{ "load_static_extension", tclLoadStaticExtensionCmd },
|
||||
{ "sorter_test_fakeheap", sorter_test_fakeheap },
|
||||
{ "sorter_test_sort4_helper", sorter_test_sort4_helper },
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
{ "sqlite3_user_authenticate", test_user_authenticate, 0 },
|
||||
{ "sqlite3_user_add", test_user_add, 0 },
|
||||
{ "sqlite3_user_change", test_user_change, 0 },
|
||||
{ "sqlite3_user_delete", test_user_delete, 0 },
|
||||
#endif
|
||||
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
|
||||
{ "sqlite3_stmt_scanstatus", test_stmt_scanstatus, 0 },
|
||||
{ "sqlite3_stmt_scanstatus_reset", test_stmt_scanstatus_reset, 0 },
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
/*
|
||||
** 2005 December 14
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** This file contains a binding of the asynchronous IO extension interface
|
||||
** (defined in ext/async/sqlite3async.h) to Tcl.
|
||||
*/
|
||||
|
||||
#define TCL_THREADS
|
||||
#include "tclsqlite.h"
|
||||
|
||||
#ifdef SQLITE_ENABLE_ASYNCIO
|
||||
|
||||
#include "sqlite3async.h"
|
||||
#include "sqlite3.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* From main.c */
|
||||
extern const char *sqlite3ErrName(int);
|
||||
|
||||
|
||||
struct TestAsyncGlobal {
|
||||
int isInstalled; /* True when async VFS is installed */
|
||||
} testasync_g = { 0 };
|
||||
|
||||
TCL_DECLARE_MUTEX(testasync_g_writerMutex);
|
||||
|
||||
/*
|
||||
** sqlite3async_initialize PARENT-VFS ISDEFAULT
|
||||
*/
|
||||
static int SQLITE_TCLAPI testAsyncInit(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
const char *zParent;
|
||||
int isDefault;
|
||||
int rc;
|
||||
|
||||
if( objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "PARENT-VFS ISDEFAULT");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zParent = Tcl_GetString(objv[1]);
|
||||
if( !*zParent ) {
|
||||
zParent = 0;
|
||||
}
|
||||
if( Tcl_GetBooleanFromObj(interp, objv[2], &isDefault) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
rc = sqlite3async_initialize(zParent, isDefault);
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3async_shutdown
|
||||
*/
|
||||
static int SQLITE_TCLAPI testAsyncShutdown(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
sqlite3async_shutdown();
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
static Tcl_ThreadCreateType tclWriterThread(ClientData pIsStarted){
|
||||
Tcl_MutexLock(&testasync_g_writerMutex);
|
||||
*((int *)pIsStarted) = 1;
|
||||
sqlite3async_run();
|
||||
Tcl_MutexUnlock(&testasync_g_writerMutex);
|
||||
Tcl_ExitThread(0);
|
||||
TCL_THREAD_CREATE_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3async_start
|
||||
**
|
||||
** Start a new writer thread.
|
||||
*/
|
||||
static int SQLITE_TCLAPI testAsyncStart(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
volatile int isStarted = 0;
|
||||
ClientData threadData = (ClientData)&isStarted;
|
||||
|
||||
Tcl_ThreadId x;
|
||||
const int nStack = TCL_THREAD_STACK_DEFAULT;
|
||||
const int flags = TCL_THREAD_NOFLAGS;
|
||||
int rc;
|
||||
|
||||
rc = Tcl_CreateThread(&x, tclWriterThread, threadData, nStack, flags);
|
||||
if( rc!=TCL_OK ){
|
||||
Tcl_AppendResult(interp, "Tcl_CreateThread() failed", 0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
while( isStarted==0 ) { /* Busy loop */ }
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3async_wait
|
||||
**
|
||||
** Wait for the current writer thread to terminate.
|
||||
**
|
||||
** If the current writer thread is set to run forever then this
|
||||
** command would block forever. To prevent that, an error is returned.
|
||||
*/
|
||||
static int SQLITE_TCLAPI testAsyncWait(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
int eCond;
|
||||
if( objc!=1 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
sqlite3async_control(SQLITEASYNC_GET_HALT, &eCond);
|
||||
if( eCond==SQLITEASYNC_HALT_NEVER ){
|
||||
Tcl_AppendResult(interp, "would block forever", (char*)0);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
Tcl_MutexLock(&testasync_g_writerMutex);
|
||||
Tcl_MutexUnlock(&testasync_g_writerMutex);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** sqlite3async_control OPTION ?VALUE?
|
||||
*/
|
||||
static int SQLITE_TCLAPI testAsyncControl(
|
||||
void * clientData,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
int aeOpt[] = { SQLITEASYNC_HALT, SQLITEASYNC_DELAY, SQLITEASYNC_LOCKFILES };
|
||||
const char *azOpt[] = { "halt", "delay", "lockfiles", 0 };
|
||||
const char *az[] = { "never", "now", "idle", 0 };
|
||||
int iVal;
|
||||
int eOpt;
|
||||
|
||||
if( objc!=2 && objc!=3 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "OPTION ?VALUE?");
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if( Tcl_GetIndexFromObj(interp, objv[1], azOpt, "option", 0, &eOpt) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
eOpt = aeOpt[eOpt];
|
||||
|
||||
if( objc==3 ){
|
||||
switch( eOpt ){
|
||||
case SQLITEASYNC_HALT: {
|
||||
assert( SQLITEASYNC_HALT_NEVER==0 );
|
||||
assert( SQLITEASYNC_HALT_NOW==1 );
|
||||
assert( SQLITEASYNC_HALT_IDLE==2 );
|
||||
if( Tcl_GetIndexFromObj(interp, objv[2], az, "value", 0, &iVal) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLITEASYNC_DELAY:
|
||||
if( Tcl_GetIntFromObj(interp, objv[2], &iVal) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
case SQLITEASYNC_LOCKFILES:
|
||||
if( Tcl_GetBooleanFromObj(interp, objv[2], &iVal) ){
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rc = sqlite3async_control(eOpt, iVal);
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3async_control(
|
||||
eOpt==SQLITEASYNC_HALT ? SQLITEASYNC_GET_HALT :
|
||||
eOpt==SQLITEASYNC_DELAY ? SQLITEASYNC_GET_DELAY :
|
||||
SQLITEASYNC_GET_LOCKFILES, &iVal);
|
||||
}
|
||||
|
||||
if( rc!=SQLITE_OK ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3ErrName(rc), -1));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if( eOpt==SQLITEASYNC_HALT ){
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj(az[iVal], -1));
|
||||
}else{
|
||||
Tcl_SetObjResult(interp, Tcl_NewIntObj(iVal));
|
||||
}
|
||||
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
#endif /* SQLITE_ENABLE_ASYNCIO */
|
||||
|
||||
/*
|
||||
** This routine registers the custom TCL commands defined in this
|
||||
** module. This should be the only procedure visible from outside
|
||||
** of this module.
|
||||
*/
|
||||
int Sqlitetestasync_Init(Tcl_Interp *interp){
|
||||
#ifdef SQLITE_ENABLE_ASYNCIO
|
||||
Tcl_CreateObjCommand(interp,"sqlite3async_start",testAsyncStart,0,0);
|
||||
Tcl_CreateObjCommand(interp,"sqlite3async_wait",testAsyncWait,0,0);
|
||||
|
||||
Tcl_CreateObjCommand(interp,"sqlite3async_control",testAsyncControl,0,0);
|
||||
Tcl_CreateObjCommand(interp,"sqlite3async_initialize",testAsyncInit,0,0);
|
||||
Tcl_CreateObjCommand(interp,"sqlite3async_shutdown",testAsyncShutdown,0,0);
|
||||
#endif /* SQLITE_ENABLE_ASYNCIO */
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -745,12 +745,6 @@ Tcl_SetVar2(interp, "sqlite_options", "mergesort", "1", TCL_GLOBAL_ONLY);
|
||||
Tcl_SetVar2(interp, "sqlite_options", "secure_delete", "0", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_USER_AUTHENTICATION
|
||||
Tcl_SetVar2(interp, "sqlite_options", "userauth", "1", TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
Tcl_SetVar2(interp, "sqlite_options", "userauth", "0", TCL_GLOBAL_ONLY);
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_MULTIPLEX_EXT_OVWR
|
||||
Tcl_SetVar2(interp, "sqlite_options", "multiplex_ext_overwrite", "1", TCL_GLOBAL_ONLY);
|
||||
#else
|
||||
|
||||
@@ -59,7 +59,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
extern int Sqlitetest6_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest8_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest9_Init(Tcl_Interp*);
|
||||
extern int Sqlitetestasync_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest_autoext_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest_blob_Init(Tcl_Interp*);
|
||||
extern int Sqlitetest_demovfs_Init(Tcl_Interp *);
|
||||
@@ -131,7 +130,6 @@ const char *sqlite3TestInit(Tcl_Interp *interp){
|
||||
Sqlitetest6_Init(interp);
|
||||
Sqlitetest8_Init(interp);
|
||||
Sqlitetest9_Init(interp);
|
||||
Sqlitetestasync_Init(interp);
|
||||
Sqlitetest_autoext_Init(interp);
|
||||
Sqlitetest_blob_Init(interp);
|
||||
Sqlitetest_demovfs_Init(interp);
|
||||
|
||||
@@ -4538,9 +4538,11 @@ case OP_OpenEphemeral: { /* ncycle */
|
||||
}
|
||||
}
|
||||
pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
|
||||
assert( p->apCsr[pOp->p1]==pCx );
|
||||
if( rc ){
|
||||
assert( !sqlite3BtreeClosesWithCursor(pCx->ub.pBtx, pCx->uc.pCursor) );
|
||||
sqlite3BtreeClose(pCx->ub.pBtx);
|
||||
p->apCsr[pOp->p1] = 0; /* Not required; helps with static analysis */
|
||||
}else{
|
||||
assert( sqlite3BtreeClosesWithCursor(pCx->ub.pBtx, pCx->uc.pCursor) );
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file runs all tests.
|
||||
#
|
||||
# $Id: async.test,v 1.21 2009/06/05 17:09:12 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {[info commands sqlite3async_initialize] eq ""} {
|
||||
# The async logic is not built into this system
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
rename finish_test async_really_finish_test
|
||||
proc finish_test {} {
|
||||
catch {db close}
|
||||
catch {db2 close}
|
||||
catch {db3 close}
|
||||
}
|
||||
if {[info exists G(isquick)]} { set ASYNC_SAVE_ISQUICK $G(isquick) }
|
||||
set G(isquick) 1
|
||||
|
||||
set ASYNC_INCLUDE {
|
||||
insert.test
|
||||
insert2.test
|
||||
insert3.test
|
||||
lock.test
|
||||
lock2.test
|
||||
lock3.test
|
||||
select1.test
|
||||
select2.test
|
||||
select3.test
|
||||
select4.test
|
||||
trans.test
|
||||
}
|
||||
|
||||
# Enable asynchronous IO.
|
||||
sqlite3async_initialize "" 1
|
||||
|
||||
# This proc flushes the contents of the async-IO queue through to the
|
||||
# underlying VFS. A couple of the test scripts identified in $ASYNC_INCLUDE
|
||||
# above contain lines like "catch flush_async_queue" in places where
|
||||
# this is required for the tests to work in async mode.
|
||||
#
|
||||
proc flush_async_queue {} {
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
sqlite3async_control halt never
|
||||
}
|
||||
|
||||
rename do_test async_really_do_test
|
||||
proc do_test {name args} {
|
||||
uplevel async_really_do_test async_io-$name $args
|
||||
flush_async_queue
|
||||
}
|
||||
|
||||
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
|
||||
set tail [file tail $testfile]
|
||||
if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue
|
||||
source $testfile
|
||||
|
||||
# Make sure everything is flushed through. This is because [source]ing
|
||||
# the next test file will delete the database file on disk (using
|
||||
# [delete_file]). If the asynchronous backend still has the file
|
||||
# open, it will become confused.
|
||||
#
|
||||
flush_async_queue
|
||||
}
|
||||
|
||||
# Flush the write-queue and disable asynchronous IO. This should ensure
|
||||
# all allocated memory is cleaned up.
|
||||
set sqlite3async_trace 1
|
||||
flush_async_queue
|
||||
sqlite3async_shutdown
|
||||
set sqlite3async_trace 0
|
||||
|
||||
rename do_test {}
|
||||
rename async_really_do_test do_test
|
||||
rename finish_test {}
|
||||
rename async_really_finish_test finish_test
|
||||
|
||||
if {[info exists ASYNC_SAVE_ISQUICK]} { set G(isquick) $ASYNC_SAVE_ISQUICK }
|
||||
finish_test
|
||||
@@ -1,126 +0,0 @@
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# $Id: async2.test,v 1.12 2009/04/25 08:39:15 danielk1977 Exp $
|
||||
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {
|
||||
[info commands sqlite3async_initialize]=="" ||
|
||||
[info command sqlite3_memdebug_fail]==""
|
||||
} {
|
||||
# The async logic is not built into this system
|
||||
puts "Skipping async2 tests: not compiled with required features"
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
# Enable asynchronous IO.
|
||||
|
||||
set setup_script {
|
||||
CREATE TABLE counter(c);
|
||||
INSERT INTO counter(c) VALUES (1);
|
||||
}
|
||||
|
||||
set sql_script {
|
||||
BEGIN;
|
||||
UPDATE counter SET c = 2;
|
||||
CREATE TABLE t1(a PRIMARY KEY, b, c);
|
||||
CREATE TABLE t2(a PRIMARY KEY, b, c);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
UPDATE counter SET c = 3;
|
||||
INSERT INTO t1 VALUES('abcdefghij', 'four', 'score');
|
||||
INSERT INTO t2 VALUES('klmnopqrst', 'and', 'seven');
|
||||
COMMIT;
|
||||
|
||||
UPDATE counter SET c = 'FIN';
|
||||
}
|
||||
|
||||
db close
|
||||
|
||||
foreach err [list ioerr malloc-transient malloc-persistent] {
|
||||
set ::go 10
|
||||
for {set n 1} {$::go} {incr n} {
|
||||
set ::sqlite_io_error_pending 0
|
||||
sqlite3_memdebug_fail -1
|
||||
forcedelete test.db test.db-journal
|
||||
sqlite3 db test.db
|
||||
execsql $::setup_script
|
||||
db close
|
||||
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3 db test.db
|
||||
sqlite3_db_config_lookaside db 0 0 0
|
||||
|
||||
switch -- $err {
|
||||
ioerr { set ::sqlite_io_error_pending $n }
|
||||
malloc-persistent { sqlite3_memdebug_fail $n -repeat 1 }
|
||||
malloc-transient { sqlite3_memdebug_fail $n -repeat 0 }
|
||||
}
|
||||
|
||||
catchsql $::sql_script
|
||||
db close
|
||||
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
sqlite3async_control halt never
|
||||
sqlite3async_shutdown
|
||||
|
||||
set ::sqlite_io_error_pending 0
|
||||
sqlite3_memdebug_fail -1
|
||||
|
||||
sqlite3 db test.db
|
||||
set c [db one {SELECT c FROM counter LIMIT 1}]
|
||||
switch -- $c {
|
||||
1 {
|
||||
do_test async-$err-1.1.$n {
|
||||
execsql {
|
||||
SELECT name FROM sqlite_master;
|
||||
}
|
||||
} {counter}
|
||||
}
|
||||
2 {
|
||||
do_test async-$err-1.2.$n.1 {
|
||||
execsql {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {}
|
||||
do_test async-$err-1.2.$n.2 {
|
||||
execsql {
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {}
|
||||
}
|
||||
3 {
|
||||
do_test async-$err-1.3.$n.1 {
|
||||
execsql {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {abcdefghij four score}
|
||||
do_test async-$err-1.3.$n.2 {
|
||||
execsql {
|
||||
SELECT * FROM t2;
|
||||
}
|
||||
} {klmnopqrst and seven}
|
||||
}
|
||||
FIN {
|
||||
incr ::go -1
|
||||
}
|
||||
}
|
||||
|
||||
db close
|
||||
}
|
||||
}
|
||||
|
||||
catch {db close}
|
||||
|
||||
finish_test
|
||||
@@ -1,76 +0,0 @@
|
||||
# 2007 September 5
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# The focus of this file is testing the code in test_async.c.
|
||||
# Specifically, it tests that the xFullPathname() method of
|
||||
# of the asynchronous vfs works correctly.
|
||||
#
|
||||
# $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if { [info commands sqlite3async_initialize]=="" } {
|
||||
# The async logic is not built into this system
|
||||
puts "Skipping async3 tests: not compiled with required features"
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3async_initialize "" 1
|
||||
#set sqlite3async_trace 1
|
||||
sqlite3async_start
|
||||
|
||||
set paths {
|
||||
chocolate/banana/vanilla/file.db
|
||||
chocolate//banana/vanilla/file.db
|
||||
chocolate/./banana//vanilla/file.db
|
||||
chocolate/banana/./vanilla/file.db
|
||||
chocolate/banana/../banana/vanilla/file.db
|
||||
chocolate/banana/./vanilla/extra_bit/../file.db
|
||||
}
|
||||
|
||||
do_test async3-1.0 {
|
||||
file mkdir [file join chocolate banana vanilla]
|
||||
forcedelete chocolate/banana/vanilla/file.db
|
||||
forcedelete chocolate/banana/vanilla/file.db-journal
|
||||
} {}
|
||||
|
||||
do_test async3-1.1 {
|
||||
sqlite3 db chocolate/banana/vanilla/file.db
|
||||
execsql {
|
||||
CREATE TABLE abc(a, b, c);
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(1, 2, 3);
|
||||
}
|
||||
} {}
|
||||
|
||||
set N 2
|
||||
foreach p $paths {
|
||||
sqlite3 db2 $p
|
||||
do_test async3-1.$N.1 {
|
||||
execsql {SELECT * FROM abc} db2
|
||||
} {}
|
||||
do_test async3-1.$N.2 {
|
||||
catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
|
||||
} {1 {database is locked}}
|
||||
db2 close
|
||||
incr N
|
||||
}
|
||||
|
||||
db close
|
||||
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_wait
|
||||
sqlite3async_control halt never
|
||||
sqlite3async_shutdown
|
||||
finish_test
|
||||
@@ -1,168 +0,0 @@
|
||||
# 2009 April 25
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# $Id: async4.test,v 1.4 2009/06/05 17:09:12 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
# Do not use a codec for tests in this file, as the database file is
|
||||
# manipulated directly using tcl scripts (using the [hexio_write] command).
|
||||
#
|
||||
do_not_use_codec
|
||||
|
||||
# These tests only work for Tcl version 8.5 and later on Windows (for now)
|
||||
#
|
||||
if {$tcl_platform(platform)=="windows"} {
|
||||
scan $::tcl_version %f vx
|
||||
if {$vx<8.5} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if {[info commands sqlite3async_initialize] eq ""} {
|
||||
# The async logic is not built into this system
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
db close
|
||||
|
||||
# Test layout:
|
||||
#
|
||||
# async4.1.*: Test the lockfiles parameter.
|
||||
# async4.2.*: Test the delay parameter.
|
||||
|
||||
do_test async4.1.1 {
|
||||
sqlite3async_initialize {} 0
|
||||
sqlite3async_control lockfiles
|
||||
} {1}
|
||||
do_test async4.1.2 {
|
||||
sqlite3async_control lockfiles false
|
||||
} {0}
|
||||
do_test async4.1.3 {
|
||||
sqlite3async_control lockfiles
|
||||
} {0}
|
||||
do_test async4.1.4 {
|
||||
sqlite3async_control lockfiles true
|
||||
} {1}
|
||||
|
||||
do_test async4.1.5 {
|
||||
sqlite3 db test.db -vfs sqlite3async
|
||||
execsql { CREATE TABLE t1(a, b, c) }
|
||||
} {}
|
||||
do_test async4.1.6 {
|
||||
list [file exists test.db] [file size test.db]
|
||||
} {1 0}
|
||||
do_test async4.1.7 {
|
||||
sqlite3 db2 test.db
|
||||
catchsql { CREATE TABLE t2(a, b, c) } db2
|
||||
} {1 {database is locked}}
|
||||
do_test async4.1.8 {
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
} {}
|
||||
do_test async4.1.9 {
|
||||
catchsql { CREATE TABLE t2(a, b, c) } db2
|
||||
} {0 {}}
|
||||
do_test async4.1.10 {
|
||||
list [catch {sqlite3async_control lockfiles false} msg] $msg
|
||||
} {1 SQLITE_MISUSE}
|
||||
do_test async4.1.11 {
|
||||
db close
|
||||
list [catch {sqlite3async_control lockfiles false} msg] $msg
|
||||
} {1 SQLITE_MISUSE}
|
||||
do_test async4.1.12 {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
sqlite3async_control lockfiles false
|
||||
} {0}
|
||||
do_test async4.1.13 {
|
||||
sqlite3 db test.db -vfs sqlite3async
|
||||
execsql { CREATE TABLE t3(a, b, c) } db
|
||||
} {}
|
||||
do_test async4.1.14 {
|
||||
execsql {
|
||||
CREATE INDEX i1 ON t2(a);
|
||||
CREATE INDEX i2 ON t1(a);
|
||||
} db2
|
||||
} {}
|
||||
do_test async4.1.15 {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
hexio_write test.db 28 00000000
|
||||
execsql { pragma integrity_check } db2
|
||||
} {{*** in database main ***
|
||||
Page 5 is never used}}
|
||||
do_test async4.1.16 {
|
||||
db close
|
||||
db2 close
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
} {}
|
||||
do_test async4.1.17 {
|
||||
sqlite3async_control lockfiles true
|
||||
} {1}
|
||||
|
||||
do_test async4.2.1 {
|
||||
sqlite3async_control delay
|
||||
} {0}
|
||||
do_test async4.2.2 {
|
||||
sqlite3async_control delay 23
|
||||
} {23}
|
||||
do_test async4.2.3 {
|
||||
sqlite3async_control delay
|
||||
} {23}
|
||||
do_test async4.2.4 {
|
||||
sqlite3async_control delay 0
|
||||
} {0}
|
||||
do_test async4.2.5 {
|
||||
sqlite3 db test.db -vfs sqlite3async
|
||||
|
||||
execsql { CREATE TABLE t4(a, b) }
|
||||
set T1 [lindex [time {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
}] 0]
|
||||
|
||||
sqlite3async_control delay 100
|
||||
execsql { CREATE TABLE t5(a, b) }
|
||||
set T2 [lindex [time {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
}] 0]
|
||||
|
||||
expr {($T1+1000000) < $T2}
|
||||
} {1}
|
||||
|
||||
do_test async4.2.6 {
|
||||
sqlite3async_control delay 0
|
||||
execsql { CREATE TABLE t6(a, b) }
|
||||
set T1 [lindex [time {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
}] 0]
|
||||
|
||||
expr {($T1+1000000) < $T2}
|
||||
} {1}
|
||||
|
||||
do_test async4.2.7 {
|
||||
list [catch { sqlite3async_control delay -1 } msg] $msg
|
||||
} {1 SQLITE_MISUSE}
|
||||
|
||||
do_test async4.2.8 {
|
||||
db close
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
@@ -1,68 +0,0 @@
|
||||
# 2009 July 19
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file tests that asynchronous IO is compatible with multi-file
|
||||
# transactions.
|
||||
#
|
||||
# $Id: async5.test,v 1.1 2009/07/18 11:52:04 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {[info commands sqlite3async_initialize] eq ""} {
|
||||
# The async logic is not built into this system
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
db close
|
||||
forcedelete test2.db
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3async_control halt never
|
||||
sqlite3 db test.db
|
||||
|
||||
do_test async5-1.1 {
|
||||
execsql {
|
||||
ATTACH 'test2.db' AS next;
|
||||
CREATE TABLE main.t1(a, b);
|
||||
CREATE TABLE next.t2(a, b);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
INSERT INTO t2 VALUES(3, 4);
|
||||
COMMIT;
|
||||
}
|
||||
} {}
|
||||
do_test async5-1.2 {
|
||||
execsql { SELECT * FROM t1 }
|
||||
} {1 2}
|
||||
do_test async5-1.3 {
|
||||
execsql { SELECT * FROM t2 }
|
||||
} {3 4}
|
||||
do_test async5-1.4 {
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES('a', 'b');
|
||||
INSERT INTO t2 VALUES('c', 'd');
|
||||
COMMIT;
|
||||
}
|
||||
} {}
|
||||
do_test async5-1.5 {
|
||||
execsql { SELECT * FROM t1 }
|
||||
} {1 2 a b}
|
||||
do_test async5-1.6 {
|
||||
execsql { SELECT * FROM t2 }
|
||||
} {3 4 c d}
|
||||
|
||||
db close
|
||||
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
sqlite3async_control halt never
|
||||
sqlite3async_shutdown
|
||||
set sqlite3async_trace 0
|
||||
finish_test
|
||||
@@ -21,7 +21,7 @@ source $testdir/tester.tcl
|
||||
#
|
||||
do_test lock-1.0 {
|
||||
# Give a complex pathname to stress the path simplification logic in
|
||||
# the vxworks driver and in test_async.
|
||||
# the vxworks driver.
|
||||
file mkdir tempdir/t1/t2
|
||||
sqlite3 db2 ./tempdir/../tempdir/t1/.//t2/../../..//test.db
|
||||
set dummy {}
|
||||
|
||||
@@ -472,49 +472,6 @@ do_test main-3.6 {
|
||||
catchsql {SELECT 'abc' + #9}
|
||||
} {1 {near "#9": syntax error}}
|
||||
|
||||
# The following test-case tests the linked list code used to manage
|
||||
# sqlite3_vfs structures.
|
||||
if {$::tcl_platform(platform)=="unix"
|
||||
&& [info command sqlite3async_initialize]!=""} {
|
||||
ifcapable threadsafe {
|
||||
do_test main-4.1 {
|
||||
sqlite3_crash_enable 1
|
||||
sqlite3_crash_enable 0
|
||||
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3async_shutdown
|
||||
|
||||
sqlite3_crash_enable 1
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3_crash_enable 0
|
||||
sqlite3async_shutdown
|
||||
|
||||
sqlite3_crash_enable 1
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3async_shutdown
|
||||
sqlite3_crash_enable 0
|
||||
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3_crash_enable 1
|
||||
sqlite3_crash_enable 0
|
||||
sqlite3async_shutdown
|
||||
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3_crash_enable 1
|
||||
sqlite3async_shutdown
|
||||
sqlite3_crash_enable 0
|
||||
} {}
|
||||
do_test main-4.2 {
|
||||
set rc [catch {sqlite3 db test.db -vfs crash} msg]
|
||||
list $rc $msg
|
||||
} {1 {no such vfs: crash}}
|
||||
do_test main-4.3 {
|
||||
set rc [catch {sqlite3 db test.db -vfs async} msg]
|
||||
list $rc $msg
|
||||
} {1 {no such vfs: async}}
|
||||
}
|
||||
}
|
||||
|
||||
# Print the version number so that it can be picked up by releasetest.tcl.
|
||||
#
|
||||
puts [db one {SELECT 'VERSION: ' ||
|
||||
|
||||
@@ -38,8 +38,6 @@ set EXCLUDE {
|
||||
misuse.test
|
||||
memleak.test
|
||||
btree2.test
|
||||
async.test
|
||||
async2.test
|
||||
trans.test
|
||||
crash.test
|
||||
autovacuum_crash.test
|
||||
|
||||
@@ -108,14 +108,14 @@ if {$::tcl_platform(platform)!="unix"} {
|
||||
set alltests [test_set $alltests -exclude crash.test crash2.test]
|
||||
}
|
||||
set alltests [test_set $alltests -exclude {
|
||||
all.test async.test quick.test veryquick.test
|
||||
all.test quick.test veryquick.test
|
||||
memleak.test permutations.test soak.test fts3.test
|
||||
mallocAll.test rtree.test full.test extraquick.test
|
||||
session.test rbu.test
|
||||
}]
|
||||
|
||||
set allquicktests [test_set $alltests -exclude {
|
||||
async2.test async3.test backup_ioerr.test corrupt.test
|
||||
backup_ioerr.test corrupt.test
|
||||
corruptC.test crash.test crash2.test crash3.test crash4.test crash5.test
|
||||
crash6.test crash7.test delete3.test e_fts3.test fts3rnd.test
|
||||
fkey_malloc.test fuzz.test fuzz3.test fuzz_malloc.test in2.test loadext.test
|
||||
@@ -790,7 +790,7 @@ test_suite "inmemory_journal" -description {
|
||||
journal3.test 8_3_names.test shmlock.test
|
||||
pendingrace.test
|
||||
|
||||
pager1.test async4.test corrupt.test filefmt.test pager2.test
|
||||
pager1.test corrupt.test filefmt.test pager2.test
|
||||
corrupt5.test corruptA.test pageropt.test
|
||||
|
||||
# Exclude stmt.test, which expects sub-journals to use temporary files.
|
||||
@@ -951,12 +951,11 @@ test_suite "safe_append" -description {
|
||||
set ::G(perm:sqlite3_args) [list -vfs devsym]
|
||||
sqlite3_simulate_device -char safe_append
|
||||
} -files [
|
||||
test_set $::allquicktests shared_err.test -exclude async3.test
|
||||
test_set $::allquicktests shared_err.test
|
||||
]
|
||||
|
||||
# The set of tests to run on the alternative-pcache
|
||||
set perm-alt-pcache-testset {
|
||||
async.test
|
||||
attach.test
|
||||
delete.test delete2.test
|
||||
index.test
|
||||
@@ -997,7 +996,7 @@ test_suite "journaltest" -description {
|
||||
unregister_jt_vfs
|
||||
} -files [test_set $::allquicktests -exclude {
|
||||
wal* incrvacuum.test ioerr.test corrupt4.test io.test crash8.test
|
||||
async4.test bigfile.test backcompat.test e_wal* fstat.test mmap2.test
|
||||
bigfile.test backcompat.test e_wal* fstat.test mmap2.test
|
||||
pager1.test syscall.test tkt3457.test *malloc* mmap* multiplex* nolock*
|
||||
pager2.test *fault* rowal* snapshot* superlock* symlink.test
|
||||
delete_db.test shmlock.test chunksize.test
|
||||
|
||||
@@ -547,7 +547,7 @@ proc show_status {db cls} {
|
||||
|
||||
set srcdir [file dirname [file dirname $TRG(info_script)]]
|
||||
set line "Running: $S(running) (max: $nJob)"
|
||||
if {$S(running)>0 && $fin>10} {
|
||||
if {$S(running)>0 && $fin>10 && [string length $line]<69} {
|
||||
set tmleft [expr {($tm/$fin)*($totalw-$fin)}]
|
||||
if {$tmleft<0.02*$tm} {
|
||||
set tmleft [expr {$tm*0.02}]
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
# 2009 October 19
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {[info commands sqlite3async_initialize] eq ""} {
|
||||
# The async logic is not built into this system
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
# Create a database.
|
||||
do_test tkt-94c94-1.1 {
|
||||
execsql { CREATE TABLE t1(a, b) }
|
||||
} {}
|
||||
|
||||
# Grow the file to larger than 4096MB (2^32 bytes)
|
||||
db close
|
||||
if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} {
|
||||
puts "**** Unable to create a file larger than 4096 MB. *****"
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
# Switch to async mode.
|
||||
sqlite3async_initialize "" 1
|
||||
sqlite3 db test.db
|
||||
sqlite3 db2 test.db
|
||||
|
||||
# Read from and write to the db just past the 4096MB mark.
|
||||
#
|
||||
do_test tkt-94c94-2.1 {
|
||||
execsql { CREATE TABLE t2(x, y) } db
|
||||
} {}
|
||||
do_test tkt-94c94-2.2 {
|
||||
execsql { INSERT INTO t2 VALUES(1, 2) } db2
|
||||
} {}
|
||||
do_test tkt-94c94-2.3 {
|
||||
execsql { SELECT * FROM t2 } db
|
||||
} {1 2}
|
||||
do_test tkt-94c94-2.4 {
|
||||
sqlite3async_control halt idle
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
} {}
|
||||
do_test tkt-94c94-2.5 {
|
||||
execsql { SELECT * FROM t2 } db
|
||||
} {1 2}
|
||||
do_test tkt-94c94-2.6 {
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
} {}
|
||||
|
||||
db close
|
||||
db2 close
|
||||
sqlite3async_start
|
||||
sqlite3async_wait
|
||||
sqlite3async_control halt never
|
||||
sqlite3async_shutdown
|
||||
|
||||
finish_test
|
||||
@@ -1,257 +0,0 @@
|
||||
# 2014-09-10
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# This file implements tests of the SQLITE_USER_AUTHENTICATION extension.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix userauth01
|
||||
|
||||
ifcapable !userauth {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
# Create a no-authentication-required database
|
||||
#
|
||||
do_execsql_test userauth01-1.0 {
|
||||
CREATE TABLE t1(x);
|
||||
INSERT INTO t1 VALUES(1),(2.5),('three'),(x'4444'),(NULL);
|
||||
SELECT quote(x) FROM t1 ORDER BY x;
|
||||
SELECT name FROM sqlite_master;
|
||||
} {NULL 1 2.5 'three' X'4444' t1}
|
||||
|
||||
# Calling sqlite3_user_authenticate() on a no-authentication-required
|
||||
# database connection is a harmless no-op.
|
||||
#
|
||||
do_test userauth01-1.1 {
|
||||
sqlite3_user_authenticate db alice pw-4-alice
|
||||
execsql {
|
||||
SELECT quote(x) FROM t1 ORDER BY x;
|
||||
SELECT name FROM sqlite_master;
|
||||
}
|
||||
} {NULL 1 2.5 'three' X'4444' t1}
|
||||
|
||||
# If sqlite3_user_add(D,U,P,N,A) is called on a no-authentication-required
|
||||
# database and A is false, then the call fails with an SQLITE_AUTH error.
|
||||
#
|
||||
do_test userauth01-1.2 {
|
||||
sqlite3_user_add db bob pw-4-bob 0
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.3 {
|
||||
execsql {
|
||||
SELECT quote(x) FROM t1 ORDER BY x;
|
||||
SELECT name FROM sqlite_master;
|
||||
}
|
||||
} {NULL 1 2.5 'three' X'4444' t1}
|
||||
|
||||
# When called on a no-authentication-required
|
||||
# database and when A is true, the sqlite3_user_add(D,U,P,N,A) routine
|
||||
# converts the database into an authentication-required database and
|
||||
# logs the database connection D in using user U with password P,N.
|
||||
#
|
||||
do_test userauth01-1.4 {
|
||||
sqlite3_user_add db alice pw-4-alice 1
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.5 {
|
||||
execsql {
|
||||
SELECT quote(x) FROM t1 ORDER BY x;
|
||||
SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
|
||||
SELECT name FROM sqlite_master ORDER BY name;
|
||||
}
|
||||
} {NULL 1 2.5 'three' X'4444' alice 1 sqlite_user t1}
|
||||
|
||||
# The sqlite3_user_add() interface can be used (by an admin user only)
|
||||
# to create a new user.
|
||||
#
|
||||
do_test userauth01-1.6 {
|
||||
sqlite3_user_add db bob pw-4-bob 0
|
||||
sqlite3_user_add db cindy pw-4-cindy 0
|
||||
sqlite3_user_add db david pw-4-david 0
|
||||
execsql {
|
||||
SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
|
||||
}
|
||||
} {alice 1 bob 0 cindy 0 david 0}
|
||||
|
||||
# The sqlite_user table is inaccessible (unreadable and unwriteable) to
|
||||
# non-admin users and is read-only for admin users. However, if the same
|
||||
#
|
||||
do_test userauth01-1.7 {
|
||||
sqlite3 db2 test.db
|
||||
sqlite3_user_authenticate db2 cindy pw-4-cindy
|
||||
db2 eval {
|
||||
SELECT quote(x) FROM t1 ORDER BY x;
|
||||
SELECT name FROM sqlite_master ORDER BY name;
|
||||
}
|
||||
} {NULL 1 2.5 'three' X'4444' sqlite_user t1}
|
||||
do_test userauth01-1.8 {
|
||||
catchsql {
|
||||
SELECT uname, isadmin FROM sqlite_user ORDER BY uname;
|
||||
} db2
|
||||
} {1 {no such table: sqlite_user}}
|
||||
|
||||
# Any user can change their own password.
|
||||
#
|
||||
do_test userauth01-1.9 {
|
||||
sqlite3_user_change db2 cindy xyzzy-cindy 0
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.10 {
|
||||
sqlite3_user_authenticate db2 cindy pw-4-cindy
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.11 {
|
||||
sqlite3_user_authenticate db2 cindy xyzzy-cindy
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.12 {
|
||||
sqlite3_user_change db alice xyzzy-alice 1
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.13 {
|
||||
sqlite3_user_authenticate db alice pw-4-alice
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.14 {
|
||||
sqlite3_user_authenticate db alice xyzzy-alice
|
||||
} {SQLITE_OK}
|
||||
|
||||
# No user may change their own admin privilege setting.
|
||||
#
|
||||
do_test userauth01-1.15 {
|
||||
sqlite3_user_change db alice xyzzy-alice 0
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.16 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 0}
|
||||
do_test userauth01-1.17 {
|
||||
sqlite3_user_change db2 cindy xyzzy-cindy 1
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.18 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 0}
|
||||
|
||||
# The sqlite3_user_change() interface can be used to change a users
|
||||
# login credentials or admin privilege.
|
||||
#
|
||||
do_test userauth01-1.20 {
|
||||
sqlite3_user_change db david xyzzy-david 1
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.21 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 1}
|
||||
do_test userauth01-1.22 {
|
||||
sqlite3_user_authenticate db2 david xyzzy-david
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.23 {
|
||||
db2 eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 1}
|
||||
do_test userauth01-1.24 {
|
||||
sqlite3_user_change db david pw-4-david 0
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.25 {
|
||||
sqlite3_user_authenticate db2 david pw-4-david
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.26 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 0}
|
||||
do_test userauth01-1.27 {
|
||||
catchsql {SELECT uname, isadmin FROM sqlite_user ORDER BY uname} db2
|
||||
} {1 {no such table: sqlite_user}}
|
||||
|
||||
# Only an admin user can change another users login
|
||||
# credentials or admin privilege setting.
|
||||
#
|
||||
do_test userauth01-1.30 {
|
||||
sqlite3_user_change db2 bob xyzzy-bob 1
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.31 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 bob 0 cindy 0 david 0}
|
||||
|
||||
# The sqlite3_user_delete() interface can be used (by an admin user only)
|
||||
# to delete a user.
|
||||
#
|
||||
do_test userauth01-1.40 {
|
||||
sqlite3_user_delete db bob
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.41 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 cindy 0 david 0}
|
||||
do_test userauth01-1.42 {
|
||||
sqlite3_user_delete db2 cindy
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.43 {
|
||||
sqlite3_user_delete db2 alice
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.44 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 cindy 0 david 0}
|
||||
|
||||
# The currently logged-in user cannot be deleted
|
||||
#
|
||||
do_test userauth01-1.50 {
|
||||
sqlite3_user_delete db alice
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.51 {
|
||||
db eval {SELECT uname, isadmin FROM sqlite_user ORDER BY uname}
|
||||
} {alice 1 cindy 0 david 0}
|
||||
|
||||
# When ATTACH-ing new database files to a connection, each newly attached
|
||||
# database that is an authentication-required database is checked using
|
||||
# the same username and password as supplied to the main database. If that
|
||||
# check fails, then the ATTACH command fails with an SQLITE_AUTH error.
|
||||
#
|
||||
do_test userauth01-1.60 {
|
||||
forcedelete test3.db
|
||||
sqlite3 db3 test3.db
|
||||
sqlite3_user_add db3 alice xyzzy-alice 1
|
||||
} {SQLITE_OK}
|
||||
do_test userauth01-1.61 {
|
||||
db3 eval {
|
||||
CREATE TABLE t3(a,b,c); INSERT INTO t3 VALUES(1,2,3);
|
||||
SELECT * FROM t3;
|
||||
}
|
||||
} {1 2 3}
|
||||
do_test userauth01-1.62 {
|
||||
db eval {
|
||||
ATTACH 'test3.db' AS aux;
|
||||
SELECT * FROM t1, t3 ORDER BY x LIMIT 1;
|
||||
DETACH aux;
|
||||
}
|
||||
} {{} 1 2 3}
|
||||
do_test userauth01-1.63 {
|
||||
sqlite3_user_change db alice pw-4-alice 1
|
||||
sqlite3_user_authenticate db alice pw-4-alice
|
||||
catchsql {
|
||||
ATTACH 'test3.db' AS aux;
|
||||
}
|
||||
} {1 {unable to open database: test3.db}}
|
||||
do_test userauth01-1.64 {
|
||||
sqlite3_extended_errcode db
|
||||
} {SQLITE_AUTH}
|
||||
do_test userauth01-1.65 {
|
||||
db eval {PRAGMA database_list}
|
||||
} {~/test3.db/}
|
||||
|
||||
# The sqlite3_set_authorizer() callback is modified to take a 7th parameter
|
||||
# which is the username of the currently logged in user, or NULL for a
|
||||
# no-authentication-required database.
|
||||
#
|
||||
proc auth {args} {
|
||||
lappend ::authargs $args
|
||||
return SQLITE_OK
|
||||
}
|
||||
do_test authuser01-2.1 {
|
||||
unset -nocomplain ::authargs
|
||||
db auth auth
|
||||
db eval {SELECT x FROM t1}
|
||||
set ::authargs
|
||||
} {/SQLITE_SELECT {} {} {} {} alice/}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -279,7 +279,6 @@ set boolean_defnil_options {
|
||||
SQLITE_UNTESTABLE
|
||||
SQLITE_USE_ALLOCA
|
||||
SQLITE_USE_FCNTL_TRACE
|
||||
SQLITE_USER_AUTHENTICATION
|
||||
SQLITE_USE_URI
|
||||
SQLITE_VDBE_COVERAGE
|
||||
SQLITE_WIN32_MALLOC
|
||||
|
||||
@@ -138,6 +138,7 @@ if {[file executable $vsrcprog] && [file readable $srcroot/manifest]} {
|
||||
puts $out "** is unknown."
|
||||
}
|
||||
puts $out [subst {*/
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
#define SQLITE_CORE 1
|
||||
#define SQLITE_AMALGAMATION 1}]
|
||||
if {$addstatic} {
|
||||
@@ -509,6 +510,7 @@ puts $out \
|
||||
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }"
|
||||
|
||||
puts $out \
|
||||
"/************************** End of sqlite3.c ******************************/"
|
||||
"#endif /* SQLITE_AMALGAMATION */
|
||||
/************************** End of sqlite3.c ******************************/"
|
||||
|
||||
close $out
|
||||
|
||||
@@ -168,3 +168,4 @@ foreach file $filelist {
|
||||
puts "/******** End of [file tail $file] *********/"
|
||||
}
|
||||
}
|
||||
puts "#endif /* SQLITE3_H */"
|
||||
|
||||
@@ -1217,6 +1217,7 @@ static void originSide(SQLiteRsync *p){
|
||||
unsigned int lockBytePage = 0;
|
||||
unsigned int szPg = 0;
|
||||
sqlite3_stmt *pCkHash = 0;
|
||||
sqlite3_stmt *pInsHash = 0;
|
||||
char buf[200];
|
||||
|
||||
p->isReplica = 0;
|
||||
@@ -1281,10 +1282,12 @@ static void originSide(SQLiteRsync *p){
|
||||
if( pCkHash==0 ){
|
||||
runSql(p, "CREATE TEMP TABLE badHash(pgno INTEGER PRIMARY KEY)");
|
||||
pCkHash = prepareStmt(p,
|
||||
"INSERT INTO badHash SELECT pgno FROM sqlite_dbpage('main')"
|
||||
"SELECT pgno FROM sqlite_dbpage('main')"
|
||||
" WHERE pgno=?1 AND hash(data)!=?2"
|
||||
);
|
||||
if( pCkHash==0 ) break;
|
||||
pInsHash = prepareStmt(p, "INSERT INTO badHash VALUES(?)");
|
||||
if( pInsHash==0 ) break;
|
||||
}
|
||||
p->nHashSent++;
|
||||
iPage++;
|
||||
@@ -1292,7 +1295,16 @@ static void originSide(SQLiteRsync *p){
|
||||
readBytes(p, 20, buf);
|
||||
sqlite3_bind_blob(pCkHash, 2, buf, 20, SQLITE_STATIC);
|
||||
rc = sqlite3_step(pCkHash);
|
||||
if( rc!=SQLITE_DONE ){
|
||||
if( rc==SQLITE_ROW ){
|
||||
sqlite3_bind_int64(pInsHash, 1, sqlite3_column_int64(pCkHash, 0));
|
||||
rc = sqlite3_step(pInsHash);
|
||||
if( rc!=SQLITE_DONE ){
|
||||
reportError(p, "SQL statement [%s] failed: %s",
|
||||
sqlite3_sql(pInsHash), sqlite3_errmsg(p->db));
|
||||
}
|
||||
sqlite3_reset(pInsHash);
|
||||
}
|
||||
else if( rc!=SQLITE_DONE ){
|
||||
reportError(p, "SQL statement [%s] failed: %s",
|
||||
sqlite3_sql(pCkHash), sqlite3_errmsg(p->db));
|
||||
}
|
||||
@@ -1302,7 +1314,9 @@ static void originSide(SQLiteRsync *p){
|
||||
case REPLICA_READY: {
|
||||
sqlite3_stmt *pStmt;
|
||||
sqlite3_finalize(pCkHash);
|
||||
sqlite3_finalize(pInsHash);
|
||||
pCkHash = 0;
|
||||
pInsHash = 0;
|
||||
if( iPage+1<p->nPage ){
|
||||
runSql(p, "WITH RECURSIVE c(n) AS"
|
||||
" (VALUES(%d) UNION ALL SELECT n+1 FROM c WHERE n<%d)"
|
||||
@@ -1338,6 +1352,7 @@ static void originSide(SQLiteRsync *p){
|
||||
}
|
||||
|
||||
if( pCkHash ) sqlite3_finalize(pCkHash);
|
||||
if( pInsHash ) sqlite3_finalize(pInsHash);
|
||||
closeDb(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A level of indirection for use soley by main.mk to extract info
|
||||
# from tclConfig.sh if it's not provided by the configure script.
|
||||
#
|
||||
# Expects to be passed a full path to a tclConfig.sh. It sources it
|
||||
# and emits TCL code which sets some vars which are exported by
|
||||
# tclConfig.sh.
|
||||
#
|
||||
# This script expects that the caller has already validated that the
|
||||
# file exists, is not a directory, and is readable.
|
||||
#
|
||||
# If passed no filename, or an empty one, then it emits config code
|
||||
# suitable for the "config not found" case.
|
||||
if test x = "x$1"; then
|
||||
TCL_INCLUDE_SPEC=
|
||||
TCL_LIB_SPEC=
|
||||
TCL_STUB_LIB_SPEC=
|
||||
TCL_EXEC_PREFIX=
|
||||
TCL_VERSION=
|
||||
else
|
||||
. "$1"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
TCL_INCLUDE_SPEC = $TCL_INCLUDE_SPEC
|
||||
TCL_LIB_SPEC = $TCL_LIB_SPEC
|
||||
TCL_STUB_LIB_SPEC = $TCL_STUB_LIB_SPEC
|
||||
TCL_EXEC_PREFIX = $TCL_EXEC_PREFIX
|
||||
TCL_VERSION = $TCL_VERSION
|
||||
EOF
|
||||
@@ -1,8 +0,0 @@
|
||||
<Application
|
||||
x:Class="vsixtest.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:vsixtest"
|
||||
RequestedTheme="Light">
|
||||
|
||||
</Application>
|
||||
@@ -1,120 +0,0 @@
|
||||
//
|
||||
// App.xaml.cpp
|
||||
// Implementation of the App class.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
|
||||
using namespace vsixtest;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::ApplicationModel;
|
||||
using namespace Windows::ApplicationModel::Activation;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Interop;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
App::App()
|
||||
{
|
||||
InitializeComponent();
|
||||
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e)
|
||||
{
|
||||
|
||||
#if _DEBUG
|
||||
// Show graphics profiling information while debugging.
|
||||
if (IsDebuggerPresent())
|
||||
{
|
||||
// Display the current frame rate counters
|
||||
DebugSettings->EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content);
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == nullptr)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and associate it with
|
||||
// a SuspensionManager key
|
||||
rootFrame = ref new Frame();
|
||||
|
||||
rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed);
|
||||
|
||||
if (e->PreviousExecutionState == ApplicationExecutionState::Terminated)
|
||||
{
|
||||
// TODO: Restore the saved session state only when appropriate, scheduling the
|
||||
// final launch steps after the restore is complete
|
||||
|
||||
}
|
||||
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// Place the frame in the current Window
|
||||
Window::Current->Content = rootFrame;
|
||||
// Ensure the current window is active
|
||||
Window::Current->Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rootFrame->Content == nullptr)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments);
|
||||
}
|
||||
// Ensure the current window is active
|
||||
Window::Current->Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
|
||||
{
|
||||
(void) sender; // Unused parameter
|
||||
(void) e; // Unused parameter
|
||||
|
||||
//TODO: Save application state and stop any background activity
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e)
|
||||
{
|
||||
throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// App.xaml.h
|
||||
// Declaration of the App class.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "App.g.h"
|
||||
|
||||
namespace vsixtest
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
ref class App sealed
|
||||
{
|
||||
protected:
|
||||
virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override;
|
||||
|
||||
internal:
|
||||
App();
|
||||
|
||||
private:
|
||||
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
|
||||
void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e);
|
||||
};
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,13 +0,0 @@
|
||||
<Page
|
||||
x:Class="vsixtest.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:vsixtest"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// MainPage.xaml.cpp
|
||||
// Implementation of the MainPage class.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
#include "MainPage.xaml.h"
|
||||
#include "sqlite3.h"
|
||||
|
||||
using namespace vsixtest;
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Controls::Primitives;
|
||||
using namespace Windows::UI::Xaml::Data;
|
||||
using namespace Windows::UI::Xaml::Input;
|
||||
using namespace Windows::UI::Xaml::Media;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||
|
||||
MainPage::MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
UseSQLite();
|
||||
}
|
||||
|
||||
void MainPage::UseSQLite(void)
|
||||
{
|
||||
int rc = SQLITE_OK;
|
||||
sqlite3 *pDb = nullptr;
|
||||
|
||||
rc = sqlite3_open_v2("test.db", &pDb,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to open database.");
|
||||
|
||||
rc = sqlite3_exec(pDb, "VACUUM;", nullptr, nullptr, nullptr);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to vacuum database.");
|
||||
|
||||
rc = sqlite3_close(pDb);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
throw ref new FailureException("Failed to close database.");
|
||||
|
||||
pDb = nullptr;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//
|
||||
// MainPage.xaml.h
|
||||
// Declaration of the MainPage class.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MainPage.g.h"
|
||||
|
||||
namespace vsixtest
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public ref class MainPage sealed
|
||||
{
|
||||
public:
|
||||
MainPage();
|
||||
void UseSQLite(void);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="bb52b3e1-5c8a-4516-a5ff-8b9f9baadef7"
|
||||
Publisher="CN=mistachkin"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="bb52b3e1-5c8a-4516-a5ff-8b9f9baadef7" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>vsixtest</DisplayName>
|
||||
<PublisherDisplayName>mistachkin</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="vsixtest.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="vsixtest"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="vsixtest"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
@@ -1,6 +0,0 @@
|
||||
//
|
||||
// pch.cpp
|
||||
// Include the standard header and generate the precompiled header.
|
||||
//
|
||||
|
||||
#include "pch.h"
|
||||
@@ -1,11 +0,0 @@
|
||||
//
|
||||
// pch.h
|
||||
// Header for standard system include files.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <collection.h>
|
||||
#include <ppltasks.h>
|
||||
|
||||
#include "App.xaml.h"
|
||||
@@ -1,39 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsixtest", "vsixtest.vcxproj", "{60BB14A5-0871-4656-BC38-4F0958230F9A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Build.0 = Debug|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Build.0 = Debug|Win32
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Build.0 = Release|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.ActiveCfg = Release|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Build.0 = Release|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x64.Deploy.0 = Release|x64
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.ActiveCfg = Release|Win32
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Build.0 = Release|Win32
|
||||
{60BB14A5-0871-4656-BC38-4F0958230F9A}.Release|x86.Deploy.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,373 +0,0 @@
|
||||
#!/usr/bin/tclsh
|
||||
#
|
||||
# This script is used to quickly test a VSIX (Visual Studio Extension) file
|
||||
# with Visual Studio 2015 on Windows.
|
||||
#
|
||||
# PREREQUISITES
|
||||
#
|
||||
# 1. This tool is Windows only.
|
||||
#
|
||||
# 2. This tool must be executed with "elevated administrator" privileges.
|
||||
#
|
||||
# 3. Tcl 8.4 and later are supported, earlier versions have not been tested.
|
||||
#
|
||||
# 4. The "sqlite-UWP-output.vsix" file is assumed to exist in the parent
|
||||
# directory of the directory containing this script. The [optional] first
|
||||
# command line argument to this script may be used to specify an alternate
|
||||
# file. However, currently, the file must be compatible with both Visual
|
||||
# Studio 2015 and the Universal Windows Platform.
|
||||
#
|
||||
# 5. The "VERSION" file is assumed to exist in the parent directory of the
|
||||
# directory containing this script. It must contain a version number that
|
||||
# matches the VSIX file being tested.
|
||||
#
|
||||
# 6. The temporary directory specified in the TEMP or TMP environment variables
|
||||
# must refer to an existing directory writable by the current user.
|
||||
#
|
||||
# 7. The VS140COMNTOOLS environment variable must refer to the Visual Studio
|
||||
# 2015 common tools directory.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# The first argument to this script is optional. If specified, it must be the
|
||||
# name of the VSIX file to test.
|
||||
#
|
||||
package require Tcl 8.4
|
||||
|
||||
proc fail { {error ""} {usage false} } {
|
||||
if {[string length $error] > 0} then {
|
||||
puts stdout $error
|
||||
if {!$usage} then {exit 1}
|
||||
}
|
||||
|
||||
puts stdout "usage:\
|
||||
[file tail [info nameofexecutable]]\
|
||||
[file tail [info script]] \[vsixFile\]"
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
proc isWindows {} {
|
||||
#
|
||||
# NOTE: Returns non-zero only when running on Windows.
|
||||
#
|
||||
return [expr {[info exists ::tcl_platform(platform)] && \
|
||||
$::tcl_platform(platform) eq "windows"}]
|
||||
}
|
||||
|
||||
proc isAdministrator {} {
|
||||
#
|
||||
# NOTE: Returns non-zero only when running as "elevated administrator".
|
||||
#
|
||||
if {[isWindows]} then {
|
||||
if {[catch {exec -- whoami /groups} groups] == 0} then {
|
||||
set groups [string map [list \r\n \n] $groups]
|
||||
|
||||
foreach group [split $groups \n] {
|
||||
#
|
||||
# NOTE: Match this group line against the "well-known" SID for
|
||||
# the "Administrators" group on Windows.
|
||||
#
|
||||
if {[regexp -- {\sS-1-5-32-544\s} $group]} then {
|
||||
#
|
||||
# NOTE: Match this group line against the attributes column
|
||||
# sub-value that should be present when running with
|
||||
# elevated administrator credentials.
|
||||
#
|
||||
if {[regexp -- {\sEnabled group(?:,|\s)} $group]} then {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
proc getEnvironmentVariable { name } {
|
||||
#
|
||||
# NOTE: Returns the value of the specified environment variable or an empty
|
||||
# string for environment variables that do not exist in the current
|
||||
# process environment.
|
||||
#
|
||||
return [expr {[info exists ::env($name)] ? $::env($name) : ""}]
|
||||
}
|
||||
|
||||
proc getTemporaryPath {} {
|
||||
#
|
||||
# NOTE: Returns the normalized path to the first temporary directory found
|
||||
# in the typical set of environment variables used for that purpose
|
||||
# or an empty string to signal a failure to locate such a directory.
|
||||
#
|
||||
set names [list]
|
||||
|
||||
foreach name [list TEMP TMP] {
|
||||
lappend names [string toupper $name] [string tolower $name] \
|
||||
[string totitle $name]
|
||||
}
|
||||
|
||||
foreach name $names {
|
||||
set value [getEnvironmentVariable $name]
|
||||
|
||||
if {[string length $value] > 0} then {
|
||||
return [file normalize $value]
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
proc appendArgs { args } {
|
||||
#
|
||||
# NOTE: Returns all passed arguments joined together as a single string
|
||||
# with no intervening spaces between arguments.
|
||||
#
|
||||
eval append result $args
|
||||
}
|
||||
|
||||
proc readFile { fileName } {
|
||||
#
|
||||
# NOTE: Reads and returns the entire contents of the specified file, which
|
||||
# may contain binary data.
|
||||
#
|
||||
set file_id [open $fileName RDONLY]
|
||||
fconfigure $file_id -translation binary
|
||||
set result [read $file_id]
|
||||
close $file_id
|
||||
return $result
|
||||
}
|
||||
|
||||
proc writeFile { fileName data } {
|
||||
#
|
||||
# NOTE: Writes the entire contents of the specified file, which may contain
|
||||
# binary data.
|
||||
#
|
||||
set file_id [open $fileName {WRONLY CREAT TRUNC}]
|
||||
fconfigure $file_id -translation binary
|
||||
puts -nonewline $file_id $data
|
||||
close $file_id
|
||||
return ""
|
||||
}
|
||||
|
||||
proc putsAndEval { command } {
|
||||
#
|
||||
# NOTE: Outputs a command to the standard output channel and then evaluates
|
||||
# it in the callers context.
|
||||
#
|
||||
catch {
|
||||
puts stdout [appendArgs "Running: " [lrange $command 1 end] ...\n]
|
||||
}
|
||||
|
||||
return [uplevel 1 $command]
|
||||
}
|
||||
|
||||
proc isBadDirectory { directory } {
|
||||
#
|
||||
# NOTE: Returns non-zero if the directory is empty, does not exist, -OR- is
|
||||
# not a directory.
|
||||
#
|
||||
catch {
|
||||
puts stdout [appendArgs "Checking directory \"" $directory \"...\n]
|
||||
}
|
||||
|
||||
return [expr {[string length $directory] == 0 || \
|
||||
![file exists $directory] || ![file isdirectory $directory]}]
|
||||
}
|
||||
|
||||
proc isBadFile { fileName } {
|
||||
#
|
||||
# NOTE: Returns non-zero if the file name is empty, does not exist, -OR- is
|
||||
# not a regular file.
|
||||
#
|
||||
catch {
|
||||
puts stdout [appendArgs "Checking file \"" $fileName \"...\n]
|
||||
}
|
||||
|
||||
return [expr {[string length $fileName] == 0 || \
|
||||
![file exists $fileName] || ![file isfile $fileName]}]
|
||||
}
|
||||
|
||||
#
|
||||
# NOTE: This is the entry point for this script.
|
||||
#
|
||||
set script [file normalize [info script]]
|
||||
|
||||
if {[string length $script] == 0} then {
|
||||
fail "script file currently being evaluated is unknown" true
|
||||
}
|
||||
|
||||
if {![isWindows]} then {
|
||||
fail "this tool only works properly on Windows"
|
||||
}
|
||||
|
||||
if {![isAdministrator]} then {
|
||||
fail "this tool must run with \"elevated administrator\" privileges"
|
||||
}
|
||||
|
||||
set path [file normalize [file dirname $script]]
|
||||
set argc [llength $argv]; if {$argc > 1} then {fail "" true}
|
||||
|
||||
if {$argc == 1} then {
|
||||
set vsixFileName [lindex $argv 0]
|
||||
} else {
|
||||
set vsixFileName [file join \
|
||||
[file dirname $path] sqlite-UWP-output.vsix]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
if {[isBadFile $vsixFileName]} then {
|
||||
fail [appendArgs \
|
||||
"VSIX file \"" $vsixFileName "\" does not exist"]
|
||||
}
|
||||
|
||||
set versionFileName [file join [file dirname $path] VERSION]
|
||||
|
||||
if {[isBadFile $versionFileName]} then {
|
||||
fail [appendArgs \
|
||||
"Version file \"" $versionFileName "\" does not exist"]
|
||||
}
|
||||
|
||||
set projectTemplateFileName [file join $path vsixtest.vcxproj.data]
|
||||
|
||||
if {[isBadFile $projectTemplateFileName]} then {
|
||||
fail [appendArgs \
|
||||
"Project template file \"" $projectTemplateFileName \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
set envVarName VS140COMNTOOLS
|
||||
set vsDirectory [getEnvironmentVariable $envVarName]
|
||||
|
||||
if {[isBadDirectory $vsDirectory]} then {
|
||||
fail [appendArgs \
|
||||
"Visual Studio 2015 directory \"" $vsDirectory \
|
||||
"\" from environment variable \"" $envVarName \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
set vsixInstaller [file join \
|
||||
[file dirname $vsDirectory] IDE VSIXInstaller.exe]
|
||||
|
||||
if {[isBadFile $vsixInstaller]} then {
|
||||
fail [appendArgs \
|
||||
"Visual Studio 2015 VSIX installer \"" $vsixInstaller \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
set envVarName ProgramFiles
|
||||
set programFiles [getEnvironmentVariable $envVarName]
|
||||
|
||||
if {[isBadDirectory $programFiles]} then {
|
||||
fail [appendArgs \
|
||||
"Program Files directory \"" $programFiles \
|
||||
"\" from environment variable \"" $envVarName \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
set msBuild [file join $programFiles MSBuild 14.0 Bin MSBuild.exe]
|
||||
|
||||
if {[isBadFile $msBuild]} then {
|
||||
fail [appendArgs \
|
||||
"MSBuild v14.0 executable file \"" $msBuild \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
set temporaryDirectory [getTemporaryPath]
|
||||
|
||||
if {[isBadDirectory $temporaryDirectory]} then {
|
||||
fail [appendArgs \
|
||||
"Temporary directory \"" $temporaryDirectory \
|
||||
"\" does not exist"]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
set installLogFileName [appendArgs \
|
||||
[file rootname [file tail $vsixFileName]] \
|
||||
-install- [pid] .log]
|
||||
|
||||
set commands(1) [list exec [file nativename $vsixInstaller]]
|
||||
|
||||
lappend commands(1) /quiet /norepair
|
||||
lappend commands(1) [appendArgs /logFile: $installLogFileName]
|
||||
lappend commands(1) [file nativename $vsixFileName]
|
||||
|
||||
###############################################################################
|
||||
|
||||
set buildLogFileName [appendArgs \
|
||||
[file rootname [file tail $vsixFileName]] \
|
||||
-build-%configuration%-%platform%- [pid] .log]
|
||||
|
||||
set commands(2) [list exec [file nativename $msBuild]]
|
||||
|
||||
lappend commands(2) [file nativename [file join $path vsixtest.sln]]
|
||||
lappend commands(2) /target:Rebuild
|
||||
lappend commands(2) /property:Configuration=%configuration%
|
||||
lappend commands(2) /property:Platform=%platform%
|
||||
|
||||
lappend commands(2) [appendArgs \
|
||||
/logger:FileLogger,Microsoft.Build.Engine\;Logfile= \
|
||||
[file nativename [file join $temporaryDirectory \
|
||||
$buildLogFileName]] \;Verbosity=diagnostic]
|
||||
|
||||
###############################################################################
|
||||
|
||||
set uninstallLogFileName [appendArgs \
|
||||
[file rootname [file tail $vsixFileName]] \
|
||||
-uninstall- [pid] .log]
|
||||
|
||||
set commands(3) [list exec [file nativename $vsixInstaller]]
|
||||
|
||||
lappend commands(3) /quiet /norepair
|
||||
lappend commands(3) [appendArgs /logFile: $uninstallLogFileName]
|
||||
lappend commands(3) [appendArgs /uninstall:SQLite.UWP.2015]
|
||||
|
||||
###############################################################################
|
||||
|
||||
if {1} then {
|
||||
catch {
|
||||
puts stdout [appendArgs \
|
||||
"Install log: \"" [file nativename [file join \
|
||||
$temporaryDirectory $installLogFileName]] \"\n]
|
||||
}
|
||||
|
||||
catch {
|
||||
puts stdout [appendArgs \
|
||||
"Build logs: \"" [file nativename [file join \
|
||||
$temporaryDirectory $buildLogFileName]] \"\n]
|
||||
}
|
||||
|
||||
catch {
|
||||
puts stdout [appendArgs \
|
||||
"Uninstall log: \"" [file nativename [file join \
|
||||
$temporaryDirectory $uninstallLogFileName]] \"\n]
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
if {1} then {
|
||||
putsAndEval $commands(1)
|
||||
|
||||
set versionNumber [string trim [readFile $versionFileName]]
|
||||
set data [readFile $projectTemplateFileName]
|
||||
set data [string map [list %versionNumber% $versionNumber] $data]
|
||||
|
||||
set projectFileName [file join $path vsixtest.vcxproj]
|
||||
writeFile $projectFileName $data
|
||||
|
||||
set platforms [list x86 x64 ARM]
|
||||
set configurations [list Debug Release]
|
||||
|
||||
foreach platform $platforms {
|
||||
foreach configuration $configurations {
|
||||
putsAndEval [string map [list \
|
||||
%platform% $platform %configuration% $configuration] \
|
||||
$commands(2)]
|
||||
}
|
||||
}
|
||||
|
||||
putsAndEval $commands(3)
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{60bb14a5-0871-4656-bc38-4f0958230f9a}</ProjectGuid>
|
||||
<RootNamespace>vsixtest</RootNamespace>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`SQLite.UWP.2015, Version=%versionNumber%`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\SQLite.UWP.2015.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<PackageCertificateKeyFile>vsixtest_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="App.xaml.h">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MainPage.xaml.h">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="vsixtest_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Image Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Image Include="Assets\StoreLogo.png" />
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="App.xaml.cpp">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainPage.xaml.cpp">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SDKReference Include="SQLite.UWP.2015, Version=%versionNumber%" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>60bb14a5-0871-4656-bc38-4f0958230f9a</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Assets">
|
||||
<UniqueIdentifier>e6271362-8f96-476d-907f-4da227b02435</UniqueIdentifier>
|
||||
<Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="App.xaml.cpp" />
|
||||
<ClCompile Include="MainPage.xaml.cpp" />
|
||||
<ClCompile Include="pch.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="App.xaml.h" />
|
||||
<ClInclude Include="MainPage.xaml.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\LockScreenLogo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\SplashScreen.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square150x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\StoreLogo.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png">
|
||||
<Filter>Assets</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="vsixtest_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="MainPage.xaml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||