diff --git a/VERSION b/VERSION
index d578041c4b..4067d1db71 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.8.9
+2.8.10
diff --git a/manifest b/manifest
index 28891048d1..ba8c9d0fe7 100644
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C Remove\san\sincomplete\scomment\sthat\ssomehow\ssnuck\sinto\sthe\ssources.\s(CVS\s1172)
-D 2004-01-14T03:12:42
+C Move\ssome\sfiles\saround\sand\sbump\sthe\sversion\snumber\sin\spreparation\sfor\sthe\nrelease\sof\s2.8.10.\s(CVS\s1173)
+D 2004-01-14T03:32:37
F Makefile.in 0515ff9218ad8d5a8f6220f0494b8ef94c67013b
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
-F VERSION 6f1138baacda841b1a41452ccd142ddd138cef21
+F VERSION a75b9ec90a5128523232814b489185903db7572e
F aclocal.m4 ff32919e75f42b2d4213fe3c6f79dd0fe47f7769
F art/SQLite.eps 9b43cc99cfd2be687d386faea6862ea68d6a72b2
F art/SQLite.gif 1bbb94484963f1382e27e1c5e86dd0c1061eba2b
@@ -48,7 +48,6 @@ F src/printf.c 292a7bfc5a815cb6465e32b2d5c9fe9bd43b27f0
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c d79ac60ba1595ff3c94b12892e87098329776482
F src/shell.c 3b067edc098c45caca164bcad1fa79192c3ec5ae
-F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in e6cfff01fafc8a82ce82cd8c932af421dc9adb54
F src/sqliteInt.h d9f2391451ae9636eb447dfa4dc35b70bfa3759d
F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
@@ -57,7 +56,6 @@ F src/test1.c e8652055d04d241d4fb437b5c33ff07d9f13b4b4
F src/test2.c 5014337d8576b731cce5b5a14bec4f0daf432700
F src/test3.c 30985ebdfaf3ee1462a9b0652d3efbdc8d9798f5
F src/test4.c dcbbbb382626fd466a7c46907f74db35fc8bad64
-F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/tokenize.c 8c95dcd2620b18dc0db1cdc97f9e111d11e55fe0
F src/trigger.c ce83e017b407d046e909d05373d7f8ee70f9f7f9
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
@@ -131,6 +129,8 @@ F test/tclsqlite.test f141303e0f2e9a616b551813e2b21bd38c5dca50
F test/temptable.test c82bd6f800f10e8cf96921af6315e5f1c21e2692
F test/tester.tcl 2671536d3650c29e7c105219f277568b0884cb58
F test/thread1.test 0c1fcc2f9bdd887225e56f48db8ddfbb3d0794ba
+F test/threadtest1.c 1c75f1e5fb10f52e356626e66c7d7537712a045d
+F test/threadtest2.c d94ca4114fd1504f7e0ae724bcd83d4b40931d86
F test/trans.test 75e7a171b5d2d94ee56766459113e2ad0e5f809d
F test/trigger1.test 3fe06daecf8334df840025e154e95fd4727600d7
F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263
@@ -160,7 +160,7 @@ F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl 44b589fc01d6829d43447ab40588b00aec5b9734
F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
F www/c_interface.tcl 17d8bd9e7b4fbdca47c30c8b9bcb728c351d55c0
-F www/changes.tcl 2581dab84a93c6ba8a743eb6e7b44457c8d5b255
+F www/changes.tcl ed2c8b9d0b7ead5ed8a057b368a07b4c2a99eb12
F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2
F www/datatypes.tcl 0fe2b810f114a909b844e50ad37a25e6ed8c7271
F www/download.tcl 0932d7f4f0e8b2adbbd22fac73132f86e43ab4a9
@@ -179,7 +179,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P 1ebe5fc7b03a6b070a5d52ffedb95f0d519ab068
-R 5896bfda65c78cfdd21781c351218814
+P ea1ad4653e6248f112d5516a0dcf3a72aa9b60d7
+R 645658339c33d79eab34ac1193ea03db
U drh
-Z 7f07a0d5447a21fc77df5f3d409e1bc5
+Z 5733a1b8f31fbcc231f044423ecd1cc2
diff --git a/manifest.uuid b/manifest.uuid
index 16bd3f7a4a..0764269efd 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-ea1ad4653e6248f112d5516a0dcf3a72aa9b60d7
\ No newline at end of file
+74c661850e1899c457d4e822d8284bb66e1dc651
\ No newline at end of file
diff --git a/src/shell.tcl b/src/shell.tcl
deleted file mode 100644
index 25aa9b0736..0000000000
--- a/src/shell.tcl
+++ /dev/null
@@ -1,596 +0,0 @@
-#!/usr/bin/wish
-#
-# A GUI shell for SQLite
-#
-
-# The following code is slighly modified from the original. See comments
-# for the modifications...
-############################################################################
-# A console widget for Tcl/Tk. Invoke console:create with a window name,
-# a prompt string, and a title to get a new top-level window that allows
-# the user to enter tcl commands. This is mainly useful for testing and
-# debugging.
-#
-# Copyright (C) 1998, 1999 D. Richard Hipp
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-# Author contact information:
-# drh@acm.org
-# http://www.hwaci.com/drh/
-
-# Create a console widget named $w. The prompt string is $prompt.
-# The title at the top of the window is $title
-#
-proc console:create {w prompt title} {
- upvar #0 $w.t v
- if {[winfo exists $w]} {destroy $w}
- if {[info exists v]} {unset v}
- toplevel $w
- wm title $w $title
- wm iconname $w $title
- frame $w.mb -bd 2 -relief raised
- pack $w.mb -side top -fill x
- menubutton $w.mb.file -text File -menu $w.mb.file.m
- menubutton $w.mb.edit -text Edit -menu $w.mb.edit.m
- pack $w.mb.file $w.mb.edit -side left -padx 8 -pady 1
- set m [menu $w.mb.file.m]
- # $m add command -label {Source...} -command "console:SourceFile $w.t"
- # $m add command -label {Save As...} -command "console:SaveFile $w.t"
- # $m add separator
- $m add command -label {Close} -command "destroy $w"
- $m add command -label {Exit} -command exit
- console:create_child $w $prompt $w.mb.edit.m
-}
-
-# This routine creates a console as a child window within a larger
-# window. It also creates an edit menu named "$editmenu" if $editmenu!="".
-# The calling function is responsible for posting the edit menu.
-#
-proc console:create_child {w prompt editmenu} {
- upvar #0 $w.t v
- if {$editmenu!=""} {
- set m [menu $editmenu]
- $m add command -label Cut -command "console:Cut $w.t"
- $m add command -label Copy -command "console:Copy $w.t"
- $m add command -label Paste -command "console:Paste $w.t"
- $m add command -label {Clear Screen} -command "console:Clear $w.t"
- $m add separator
- $m add command -label {Source...} -command "console:SourceFile $w.t"
- $m add command -label {Save As...} -command "console:SaveFile $w.t"
- catch {$editmenu config -postcommand "console:EnableEditMenu $w"}
- }
- scrollbar $w.sb -orient vertical -command "$w.t yview"
- pack $w.sb -side right -fill y
- text $w.t -font fixed -yscrollcommand "$w.sb set"
- pack $w.t -side right -fill both -expand 1
- bindtags $w.t Console
- set v(editmenu) $editmenu
- set v(text) $w.t
- set v(history) 0
- set v(historycnt) 0
- set v(current) -1
- set v(prompt) $prompt
- set v(prior) {}
- set v(plength) [string length $v(prompt)]
- set v(x) 0
- set v(y) 0
- $w.t mark set insert end
- $w.t tag config ok -foreground blue
- $w.t tag config err -foreground red
- $w.t insert end $v(prompt)
- $w.t mark set out 1.0
- catch {rename puts console:oldputs$w}
- proc puts args [format {
- if {![winfo exists %s]} {
- rename puts {}
- rename console:oldputs%s puts
- return [uplevel #0 puts $args]
- }
- switch -glob -- "[llength $args] $args" {
- {1 *} {
- set msg [lindex $args 0]\n
- set tag ok
- }
- {2 stdout *} {
- set msg [lindex $args 1]\n
- set tag ok
- }
- {2 stderr *} {
- set msg [lindex $args 1]\n
- set tag err
- }
- {2 -nonewline *} {
- set msg [lindex $args 1]
- set tag ok
- }
- {3 -nonewline stdout *} {
- set msg [lindex $args 2]
- set tag ok
- }
- {3 -nonewline stderr *} {
- set msg [lindex $args 2]
- set tag err
- }
- default {
- uplevel #0 console:oldputs%s $args
- return
- }
- }
- console:Puts %s $msg $tag
- } $w $w $w $w.t]
- after idle "focus $w.t"
-}
-
-bind Console <1> {console:Button1 %W %x %y}
-bind Console {console:B1Motion %W %x %y}
-bind Console {console:B1Leave %W %x %y}
-bind Console {console:cancelMotor %W}
-bind Console {console:cancelMotor %W}
-bind Console {console:Insert %W %A}
-bind Console {console:Left %W}
-bind Console {console:Left %W}
-bind Console {console:Right %W}
-bind Console {console:Right %W}
-bind Console {console:Backspace %W}
-bind Console {console:Backspace %W}
-bind Console {console:Delete %W}
-bind Console {console:Delete %W}
-bind Console {console:Home %W}
-bind Console {console:Home %W}
-bind Console {console:End %W}
-bind Console {console:End %W}
-bind Console {console:Enter %W}
-bind Console {console:Enter %W}
-bind Console {console:Prior %W}
-bind Console {console:Prior %W}
-bind Console {console:Next %W}
-bind Console {console:Next %W}
-bind Console {console:EraseEOL %W}
-bind Console <> {console:Cut %W}
-bind Console <> {console:Copy %W}
-bind Console <> {console:Paste %W}
-bind Console <> {console:Clear %W}
-
-# Insert test at the "out" mark. The "out" mark is always
-# before the input line. New text appears on the line prior
-# to the current input line.
-#
-proc console:Puts {w t tag} {
- set nc [string length $t]
- set endc [string index $t [expr $nc-1]]
- if {$endc=="\n"} {
- if {[$w index out]<[$w index {insert linestart}]} {
- $w insert out [string range $t 0 [expr $nc-2]] $tag
- $w mark set out {out linestart +1 lines}
- } else {
- $w insert out $t $tag
- }
- } else {
- if {[$w index out]<[$w index {insert linestart}]} {
- $w insert out $t $tag
- } else {
- $w insert out $t\n $tag
- $w mark set out {out -1 char}
- }
- }
- $w yview insert
-}
-
-# Insert a single character at the insertion cursor
-#
-proc console:Insert {w a} {
- $w insert insert $a
- $w yview insert
-}
-
-# Move the cursor one character to the left
-#
-proc console:Left {w} {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- if {$col>$v(plength)} {
- $w mark set insert "insert -1c"
- }
-}
-
-# Erase the character to the left of the cursor
-#
-proc console:Backspace {w} {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- if {$col>$v(plength)} {
- $w delete {insert -1c}
- }
-}
-
-# Erase to the end of the line
-#
-proc console:EraseEOL {w} {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- if {$col>=$v(plength)} {
- $w delete insert {insert lineend}
- }
-}
-
-# Move the cursor one character to the right
-#
-proc console:Right {w} {
- $w mark set insert "insert +1c"
-}
-
-# Erase the character to the right of the cursor
-#
-proc console:Delete w {
- $w delete insert
-}
-
-# Move the cursor to the beginning of the current line
-#
-proc console:Home w {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- $w mark set insert $row.$v(plength)
-}
-
-# Move the cursor to the end of the current line
-#
-proc console:End w {
- $w mark set insert {insert lineend}
-}
-
-# Called when "Enter" is pressed. Do something with the line
-# of text that was entered.
-#
-proc console:Enter w {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- set start $row.$v(plength)
- set line [$w get $start "$start lineend"]
- if {$v(historycnt)>0} {
- set last [lindex $v(history) [expr $v(historycnt)-1]]
- if {[string compare $last $line]} {
- lappend v(history) $line
- incr v(historycnt)
- }
- } else {
- set v(history) [list $line]
- set v(historycnt) 1
- }
- set v(current) $v(historycnt)
- $w insert end \n
- $w mark set out end
- if {$v(prior)==""} {
- set cmd $line
- } else {
- set cmd $v(prior)\n$line
- }
-##### Original
-# if {[info complete $cmd]} { }
-# set rc [catch {uplevel #0 $cmd} res]
-##### New
- global DB
- if {[$DB complete $cmd]} {
- set CODE {}
- set rc [catch {$DB eval $cmd RESULT $CODE}]
-##### End Of Changes
- if {![winfo exists $w]} return
- if {$rc} {
- $w insert end $res\n err
- } elseif {[string length $res]>0} {
- $w insert end $res\n ok
- }
- set v(prior) {}
- $w insert end $v(prompt)
- } else {
- set v(prior) $cmd
- regsub -all {[^ ]} $v(prompt) . x
- $w insert end $x
- }
- $w mark set insert end
- $w mark set out {insert linestart}
- $w yview insert
-}
-
-# Change the line to the previous line
-#
-proc console:Prior w {
- upvar #0 $w v
- if {$v(current)<=0} return
- incr v(current) -1
- set line [lindex $v(history) $v(current)]
- console:SetLine $w $line
-}
-
-# Change the line to the next line
-#
-proc console:Next w {
- upvar #0 $w v
- if {$v(current)>=$v(historycnt)} return
- incr v(current) 1
- set line [lindex $v(history) $v(current)]
- console:SetLine $w $line
-}
-
-# Change the contents of the entry line
-#
-proc console:SetLine {w line} {
- upvar #0 $w v
- scan [$w index insert] %d.%d row col
- set start $row.$v(plength)
- $w delete $start end
- $w insert end $line
- $w mark set insert end
- $w yview insert
-}
-
-# Called when the mouse button is pressed at position $x,$y on
-# the console widget.
-#
-proc console:Button1 {w x y} {
- global tkPriv
- upvar #0 $w v
- set v(mouseMoved) 0
- set v(pressX) $x
- set p [console:nearestBoundry $w $x $y]
- scan [$w index insert] %d.%d ix iy
- scan $p %d.%d px py
- if {$px==$ix} {
- $w mark set insert $p
- }
- $w mark set anchor $p
- focus $w
-}
-
-# Find the boundry between characters that is nearest
-# to $x,$y
-#
-proc console:nearestBoundry {w x y} {
- set p [$w index @$x,$y]
- set bb [$w bbox $p]
- if {![string compare $bb ""]} {return $p}
- if {($x-[lindex $bb 0])<([lindex $bb 2]/2)} {return $p}
- $w index "$p + 1 char"
-}
-
-# This routine extends the selection to the point specified by $x,$y
-#
-proc console:SelectTo {w x y} {
- upvar #0 $w v
- set cur [console:nearestBoundry $w $x $y]
- if {[catch {$w index anchor}]} {
- $w mark set anchor $cur
- }
- set anchor [$w index anchor]
- if {[$w compare $cur != $anchor] || (abs($v(pressX) - $x) >= 3)} {
- if {$v(mouseMoved)==0} {
- $w tag remove sel 0.0 end
- }
- set v(mouseMoved) 1
- }
- if {[$w compare $cur < anchor]} {
- set first $cur
- set last anchor
- } else {
- set first anchor
- set last $cur
- }
- if {$v(mouseMoved)} {
- $w tag remove sel 0.0 $first
- $w tag add sel $first $last
- $w tag remove sel $last end
- update idletasks
- }
-}
-
-# Called whenever the mouse moves while button-1 is held down.
-#
-proc console:B1Motion {w x y} {
- upvar #0 $w v
- set v(y) $y
- set v(x) $x
- console:SelectTo $w $x $y
-}
-
-# Called whenever the mouse leaves the boundries of the widget
-# while button 1 is held down.
-#
-proc console:B1Leave {w x y} {
- upvar #0 $w v
- set v(y) $y
- set v(x) $x
- console:motor $w
-}
-
-# This routine is called to automatically scroll the window when
-# the mouse drags offscreen.
-#
-proc console:motor w {
- upvar #0 $w v
- if {![winfo exists $w]} return
- if {$v(y)>=[winfo height $w]} {
- $w yview scroll 1 units
- } elseif {$v(y)<0} {
- $w yview scroll -1 units
- } else {
- return
- }
- console:SelectTo $w $v(x) $v(y)
- set v(timer) [after 50 console:motor $w]
-}
-
-# This routine cancels the scrolling motor if it is active
-#
-proc console:cancelMotor w {
- upvar #0 $w v
- catch {after cancel $v(timer)}
- catch {unset v(timer)}
-}
-
-# Do a Copy operation on the stuff currently selected.
-#
-proc console:Copy w {
- if {![catch {set text [$w get sel.first sel.last]}]} {
- clipboard clear -displayof $w
- clipboard append -displayof $w $text
- }
-}
-
-# Return 1 if the selection exists and is contained
-# entirely on the input line. Return 2 if the selection
-# exists but is not entirely on the input line. Return 0
-# if the selection does not exist.
-#
-proc console:canCut w {
- set r [catch {
- scan [$w index sel.first] %d.%d s1x s1y
- scan [$w index sel.last] %d.%d s2x s2y
- scan [$w index insert] %d.%d ix iy
- }]
- if {$r==1} {return 0}
- if {$s1x==$ix && $s2x==$ix} {return 1}
- return 2
-}
-
-# Do a Cut operation if possible. Cuts are only allowed
-# if the current selection is entirely contained on the
-# current input line.
-#
-proc console:Cut w {
- if {[console:canCut $w]==1} {
- console:Copy $w
- $w delete sel.first sel.last
- }
-}
-
-# Do a paste opeation.
-#
-proc console:Paste w {
- if {[console:canCut $w]==1} {
- $w delete sel.first sel.last
- }
- if {[catch {selection get -displayof $w -selection CLIPBOARD} topaste]} {
- return
- }
- set prior 0
- foreach line [split $topaste \n] {
- if {$prior} {
- console:Enter $w
- update
- }
- set prior 1
- $w insert insert $line
- }
-}
-
-# Enable or disable entries in the Edit menu
-#
-proc console:EnableEditMenu w {
- upvar #0 $w.t v
- set m $v(editmenu)
- if {$m=="" || ![winfo exists $m]} return
- switch [console:canCut $w.t] {
- 0 {
- $m entryconf Copy -state disabled
- $m entryconf Cut -state disabled
- }
- 1 {
- $m entryconf Copy -state normal
- $m entryconf Cut -state normal
- }
- 2 {
- $m entryconf Copy -state normal
- $m entryconf Cut -state disabled
- }
- }
-}
-
-# Prompt for the user to select an input file, the "source" that file.
-#
-proc console:SourceFile w {
- set types {
- {{TCL Scripts} {.tcl}}
- {{All Files} *}
- }
- set f [tk_getOpenFile -filetypes $types -title "TCL Script To Source..."]
- if {$f!=""} {
- uplevel #0 source $f
- }
-}
-
-# Prompt the user for the name of a writable file. Then write the
-# entire contents of the console screen to that file.
-#
-proc console:SaveFile w {
- set types {
- {{Text Files} {.txt}}
- {{All Files} *}
- }
- set f [tk_getSaveFile -filetypes $types -title "Write Screen To..."]
- if {$f!=""} {
- if {[catch {open $f w} fd]} {
- tk_messageBox -type ok -icon error -message $fd
- } else {
- puts $fd [string trimright [$w get 1.0 end] \n]
- close $fd
- }
- }
-}
-
-# Erase everything from the console above the insertion line.
-#
-proc console:Clear w {
- $w delete 1.0 {insert linestart}
-}
-
-# Start the console
-#
-# console:create {.@console} {% } {Tcl/Tk Console}
-###############################################################################
-
-
-if {[info command sqlite]==""} {
- load ./tclsqlite.so sqlite
-}
-
-
-
-proc set_title {title} {
- if {$title==""} {
- set main SQLite
- } else {
- set main "SQLite - $title"
- }
- wm title . $main
- wm iconname . SQLite
-}
-set_title {}
-
-frame .mb -bd 1 -relief raised
-pack .mb -side top -fill x
-menubutton .mb.file -text File -underline 0 -menu .mb.file.m
-pack .mb.file -side left -padx 5
-set m [menu .mb.file.m]
-$m add separator
-$m add command -label Exit -command exit
-menubutton .mb.edit -text Edit -underline 0 -menu .mb.edit.m
-pack .mb.edit -side left -padx 5
-#menu .mb.edit.m
-
-frame .f
-pack .f -side top -fill both -expand 1
-console:create_child .f {sqlite> } .mb.edit.m
diff --git a/src/threadtest.c b/test/threadtest1.c
similarity index 98%
rename from src/threadtest.c
rename to test/threadtest1.c
index 89c79a4c7c..5c1bbb154e 100644
--- a/src/threadtest.c
+++ b/test/threadtest1.c
@@ -17,6 +17,9 @@
** places execute for very short periods of time. So even if the library
** is compiled with its mutexes disabled, it is likely to work correctly
** in a multi-threaded program most of the time.
+**
+** This file is NOT part of the standard SQLite library. It is used for
+** testing only.
*/
#include "sqlite.h"
#include
diff --git a/test/threadtest2.c b/test/threadtest2.c
new file mode 100644
index 0000000000..7b08d37b9b
--- /dev/null
+++ b/test/threadtest2.c
@@ -0,0 +1,124 @@
+/*
+** 2004 January 13
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file implements a simple standalone program used to test whether
+** or not the SQLite library is threadsafe.
+**
+** This file is NOT part of the standard SQLite library. It is used for
+** testing only.
+*/
+#include
+#include
+#include
+#include
+#include
+#include "sqlite.h"
+
+/*
+** Name of the database
+*/
+#define DB_FILE "test.db"
+
+/*
+** When this variable becomes non-zero, all threads stop
+** what they are doing.
+*/
+volatile int all_stop = 0;
+
+/*
+** Callback from the integrity check. If the result is anything other
+** than "ok" it means the integrity check has failed. Set the "all_stop"
+** global variable to stop all other activity. Print the error message
+** or print OK if the string "ok" is seen.
+*/
+int check_callback(void *notUsed, int argc, char **argv, char **notUsed2){
+ if( strcmp(argv[0],"ok") ){
+ all_stop = 1;
+ fprintf(stderr,"pid=%d. %s\n", getpid(), argv[0]);
+ }else{
+ /* fprintf(stderr,"pid=%d. OK\n", getpid()); */
+ }
+ return 0;
+}
+
+/*
+** Do an integrity check on the database. If the first integrity check
+** fails, try it a second time.
+*/
+int integrity_check(sqlite *db){
+ int rc;
+ if( all_stop ) return 0;
+ /* fprintf(stderr,"pid=%d: CHECK\n", getpid()); */
+ rc = sqlite_exec(db, "pragma integrity_check", check_callback, 0, 0);
+ if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
+ fprintf(stderr,"pid=%d, Integrity check returns %d\n", getpid(), rc);
+ }
+ if( all_stop ){
+ sqlite_exec(db, "pragma integrity_check", check_callback, 0, 0);
+ }
+ return 0;
+}
+
+/*
+** This is the worker thread
+*/
+void *worker(void *notUsed){
+ sqlite *db;
+ int rc;
+ int cnt = 0;
+ while( !all_stop && cnt++<10000 ){
+ if( cnt%1000==0 ) printf("pid=%d: %d\n", getpid(), cnt);
+ while( (db = sqlite_open(DB_FILE, 0, 0))==0 ) sched_yield();
+ sqlite_exec(db, "PRAGMA synchronous=OFF", 0, 0, 0);
+ integrity_check(db);
+ if( all_stop ){ sqlite_close(db); break; }
+ /* fprintf(stderr, "pid=%d: BEGIN\n", getpid()); */
+ rc = sqlite_exec(db, "INSERT INTO t1 VALUES('bogus data')", 0, 0, 0);
+ /* fprintf(stderr, "pid=%d: END rc=%d\n", getpid(), rc); */
+ sqlite_close(db);
+ }
+ return 0;
+}
+
+/*
+** Initialize the database and start the threads
+*/
+int main(int argc, char **argv){
+ sqlite *db;
+ int i, rc;
+ pthread_t aThread[5];
+
+ if( strcmp(DB_FILE,":memory:") ) unlink(DB_FILE);
+ db = sqlite_open(DB_FILE, 0, 0);
+ if( db==0 ){
+ fprintf(stderr,"unable to initialize database\n");
+ exit(1);
+ }
+ rc = sqlite_exec(db, "CREATE TABLE t1(x);", 0,0,0);
+ if( rc ){
+ fprintf(stderr,"cannot create table t1: %d\n", rc);
+ exit(1);
+ }
+ sqlite_close(db);
+ for(i=0; i
"
}
+chng {2004 January 14 (2.8.10)} {
+Fix a potential database corruption problem on Unix caused by the fact
+ that all posix advisory locks are cleared whenever you close() a file.
+ The work around it to embargo all close() calls while locks are
+ outstanding.
+Performance enhancements on some corner cases of COUNT(*).
+Make sure the in-memory backend response sanely if malloc() fails.
+Allow sqlite_exec() to be called from within user-defined SQL
+ functions.
+Improved accuracy of floating-point conversions using "long double".
+Bug fixes in the experimental date/time functions.
+}
+
chng {2004 January 5 (2.8.9)} {
Fix a 32-bit integer overflow problem that could result in corrupt
indices in a database if large negative numbers (less than -2147483648)