Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/public-domain/sqlite/dist Import sqlite-3.13.0.



details:   https://anonhg.NetBSD.org/src/rev/6a3956d44e85
branches:  trunk
changeset: 346238:6a3956d44e85
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Sun Jul 03 09:24:29 2016 +0000

description:
Import sqlite-3.13.0.
Following changes have been made since the last import (taken from https://www.sqlite.org/news.html):

2016-05-18 - Release 3.13.0

SQLite version 3.13.0 is a regularly schedule maintenance release containg
performance enhancements and fixes for obscure bugs.
2016-04-18 - Release 3.12.2

Yikes! The 3.12.0 and 3.12.1 releases contain a backwards compatibility bug!
Tables that declare a column with type "INTEGER" PRIMARY KEY (where the
datatype name INTEGER is quoted) generate an incompatible database file. The
mistake came about because the developers have never thought to put a typename
in quotes before, and so there was no documentation of that capability nor any
tests. (There are tests now, though, of course.) Instances of quoting the
datatype name are probably infrequent in the wild, so we do not expect the
impact of this bug to be too severe. Upgrading is still strongly recommended.

Fixes for three other minor issues were included in this patch release. The
other issues would have normally been deferred until the next scheduled
release, but since a patch release is being issued anyhow, they might as well
be included.

2016-04-08 - Release 3.12.1

SQLite version 3.12.1 is an emergency patch release to address a crash bug that
snuck into version 3.12.0. Upgrading from version 3.12.0 is highly recommended.

Another minor problem involving datatypes on view columns, and a query planner
deficiency are fixed at the same time. These two issues did not justify a new
release on their own, but since a release is being issued to deal with the
crash bug, we included these other fixes for good measure.

2016-03-29 - Release 3.12.0

SQLite version 3.12.0 is a regularly scheduled maintenance release. A notable
change in this release is an increase in the default page size for newly
created database files. There are also various performance improvements. See
the change log for details.

2016-03-03 - Release 3.11.1

SQLite version 3.11.1 is a patch release that fixes problems in the new FTS5
extension and increases a default setting in the spellfix1 extension, and
implements enhancements to some of the Windows makefiles. The SQLite core is
unchanged from 3.11.0. Upgrading is optional.

2016-02-15 - Release 3.11.0

SQLite version 3.11.0 is a regularly scheduled maintenance release.

2016-01-20 - Release 3.10.2

Yikes! An optimization attempt gone bad resulted in a bug in the LIKE operator
which is fixed by this patch release. Three other minor but low-risk fixes are
also included in the patch.

2016-01-14 - Release 3.10.1

SQLite version 3.10.1 is a bug-fix release primarily targeting the fix for the
query planner bug cb3aa0641d9a4 discovered by Mapscape. Also included is a
minor API enhancement requested by the Firefox developers at Mozilla. The
differences from version 3.10.0 are minimal.

2016-01-06 - Release 3.10.0

SQLite version 3.10.0 is a regularly scheduled maintenance release.

2015-11-02 - Release 3.9.2

SQLite version 3.9.2 is a patch release fixing two obscure bugs. (Details: (1),
(2)). Upgrade only if you are having problems.

2015-10-16 - Release 3.9.1

SQlite version 3.9.1 is a small patch to version 3.9.0 that includes a few
simple build script and #ifdef tweaks to make the code easier to compile on a
wider variety of platform. There are no functional changes, except for a single
minor bug-fix in the json1 extension to stop it from recognizing form-feed
(ASCII 0x0c) as a whitespace character, in conformance with RFC7159.

2015-10-14 - Release 3.9.0

SQLite version 3.9.0 is a regularly schedule maintenance release. Key changes
include:

Begin using semantic versioning.
JSON SQL functions
The FTS5 full-text search engine
Support for indexes on expressions
Support for table-valued functions
See the change log for a long and more complete list of changes.
2015-07-29 - Release 3.8.11.1

SQLite version 3.8.11.1 is a patch release that fixes two arcane issues that
were reported shortly after 3.8.11 was released. Upgrade from 3.8.11 only in
the unlikely event that one of these obscure issues affect your code.

2015-07-27 - Release 3.8.11

SQLite version 3.8.11 is a regularly scheduled maintenance release. See the
change log for details.

2015-05-20 - Release 3.8.10.2

Yikes! Index corruption after a sequence of valid SQL statements!

It has been many years since anything like this bug has snuck into an official
SQLite release. But for the pasts seven months (version 3.8.7 through version
3.8.10.1) if you do an INSERT into a carefully crafted schema in which there
are two nested triggers that convert an index key value from TEXT to INTEGER
and then back to TEXT again, the INTEGER value might get inserted as the index
key instead of the correct TEXT, resulting in index corruption. This patch
release adds a single line of code to fix the problem.

If you do actually encounter this problem, running REINDEX on the damaged
indexes will clear it.

2015-05-09 - Release 3.8.10.1

The 3.8.10 release did not add the new SQLITE_ENABLE_DBSTAT_VTAB compile-time
option to the sqlite3_compileoption_used() interface. This patch release fixes
that omission. And while we are at it, the associated dbstat virtual table was
enhanced slightly and a harmless compiler warning was fixed.

There is no reason to upgrade from version 3.8.10 unless you are using the new
SQLITE_ENABLE_DBSTAT_VTAB compile-time option.

2015-05-07 - Release 3.8.10

SQLite version 3.8.10 is a regularly scheduled maintenance release. This
release features performance improvements, fixes to several arcane bugs found
by the AFL fuzzer, the new "sqldiff.exe" command-line utility, improvements to
the documentation, and other enhancements. See the release notes for additional
information.

2015-04-08 - Release 3.8.9

SQLite version 3.8.9 is a regularly scheduled maintenance release. New features
in this release include the PRAGMA index_xinfo command, the sqlite3_status64()
interface, and the ".dbinfo" command of the command-line shell. See the release
notes for additional information.

2015-02-25 - Release 3.8.8.3

The 3.8.8.3 patch release fixes an obscure problem in the SQLite code generator
that can cause incorrect results when the qualifying expression of a partial
index is used inside the ON clause of a LEFT JOIN. This problem has been in the
code since support for partial indexes was first added in version 3.8.0.
However, it is difficult to imagine a valid reason to every put the qualifying
constraint inside the ON clause of a LEFT JOIN, and so this issue has never
come up before.

Any applications that is vulnerable to this bug would have encountered problems
already. Hence, upgrading from the previous release is optional.

2015-01-30 - Release 3.8.8.2

The 3.8.8.2 patch release fixes a single minor problem: It ensures that the
sqlite3_wal_checkpoint(TRUNCATE) operation will always truncate the write-ahead
log even if log had already been reset and contained no new content. It is
unclear if this is a bug fix or a new feature.

Something like this would normally go into the next regularly scheduled
release, but a prominent SQLite user needed the change in a hurry so we were
happy to rush it out via this patch.

There is no reason to upgrade unless you actually need the enhanced behavior of
sqlite3_wal_checkpoint(TRUNCATE).

2015-01-20 - Release 3.8.8.1

Within hours of releasing version 3.8.8, a bug was reported against the
10-month-old 3.8.4 release. As that bug exists in all subsequent releases, the
decision was made to issue a small patch to the 3.8.8 before it came into
widespread use.

See ticket f97c4637102a3ae72b7911 for a description of the bug.

The changes between versions 3.8.8 and 3.8.8.1 are minimal.

2015-01-16 - Release 3.8.8

SQLite version 3.8.8 is a regularly schedule maintenance release of SQLite.

There are no dramatic new features or performance enhancements in this release,
merely incremental improvements. Most of the performance gain in this release
comes from refactoring the B-Tree rebalancing logic to avoid unnecessary
memcpy() operations. New features include the PRAGMA data_version statement and
the ability to accept a VALUES clause with no arbitrary limit on the number of
rows. Several obscure bugs have been fixed, including some multithreading races
and a work-around for a compiler bug on some Macs.

See the change log for a longer list of enhancements and bug fixes.


2014-12-09 - Release 3.8.7.4

SQLite version 3.8.7.4 an unscheduled bug-fix release. Changes from the
previous release and from version 3.8.7 are minimal.

This release fixes adds in a mutex that is required by the changes of the
3.8.7.3 patch but was accidentally omitted. The mutex was not required by any
of the internal SQLite tests, but Firefox crashes without it. Test cases have
been added to ensure that mutex is never again missed.

2014-12-06 - Release 3.8.7.3

SQLite version 3.8.7.3 an unscheduled bug-fix release. Changes from the
previous release and from version 3.8.7 are minimal.

This release fixes two obscure bugs that can result in incorrect query results
and/or application crashes, but not (as far as we can tell) security
vulnerabilities. Both bugs have been latent in the code across multiple prior
releases and have never before been encountered, so they are unlikely to cause
problems. Nevertheless it seems prudent to publish fixes for them both. See the
change log for details.

2014-11-19 - Release 3.8.7.2

SQLite version 3.8.7.2 is a patch and bug-fix release. Changes from the
previous release are minimal.

The primary reason for this release is to enhance the ROLLBACK command so that
it allows running queries on the same database connection to continue running
as long as the ROLLBACK does not change the schema. In all previous versions of
SQLite, a ROLLBACK would cause pending queries to stop immediately and return
SQLITE_ABORT or SQLITE_ABORT_ROLLBACK. Pending queries still abort if the
ROLLBACK changes the database schema, but as of this patch release, the queries
are allowed to continue running if the schema is unmodified.

In addition to the ROLLBACK enhancement, this patch release also includes fixes
for three obscure bugs. See the change log for details.

2014-10-30 - Release 3.8.7.1

SQLite version 3.8.7.1 is a bug-fix release.

The primary reason for this bug-fix release is to address a problem with
updating the value of fields at the end of a table that were added using ALTER
TABLE ADD COLUMN. This problem 1 first appeared in the 3.8.7 release.

Another minor annoyance in the 3.8.7 release was the fact that the Android
build tried to use the strchrnul() function from the standard C library but
that function is not available on Android. Android builds had to add
-DHAVE_STRCHRNUL=0 to work around the problem. This patch fixes that so that
Android builds should now work without any changes.

The operation of PRAGMA journal_mode=TRUNCATE has been enhanced so that it
invokes fsync() after truncating the journal file when PRAGMA synchronous=FULL.
This helps to preserve transaction durability in the case of a power loss
occurring shortly after commit.

Finally, a couple of long-standing and obscure problems associated with run
UPDATE and DELETE on VIEWs were fixed.

The changes from 3.8.7 are minimal.

2014-10-17 - Release 3.8.7

SQLite version 3.8.7 is a regularly scheduled maintenance release. Upgrading
from all prior versions is recommended.

Most of the changes from the previous release have been micro-optimizations
designed to help SQLite run a little faster. Each individual optimization has
an unmeasurably small performance impact. But the improvements add up. Measured
on a well-defined workload (which the SQLite developers use as a proxy for a
typical application workload) using cachegrind on Linux and compiled with gcc
4.8.1 and -Os on x64 linux, the current release does over 20% more work for the
same number of CPU cycles compared to the previous release. Cachegrind is not a
real CPU, and the workload used for measurement is only a proxy. So your
performance may vary. We expect to see about half the measured and reported
improvement in real-world applications. 10% is less than 20% but it is still
pretty good, we think.

This release includes a new set of C-language interfaces that have unsigned
64-bit instead of signed 32-bit length parameters. The new APIs do not provide
any new capabilities. But they do make it easier to write applications that are
more resistant to integer overflow vulnerabilities.

This release also includes a new sorter that is able to use multiple threads to
help with large sort operations. (Sort operations are sometimes required to
implement ORDER BY and/or GROUP BY clauses and are almost always required for
CREATE INDEX.) The multi-threads sorter is turned off by default and must be
enabled using the PRAGMA threads SQL command. Note that the multi-threaded
sorter provides faster real-time performance for large sorts, but it also uses
more CPU cycles and more energy.

2014-08-15 - Release 3.8.6

SQLite version 3.8.6 is a regularly scheduled maintenance release. Upgrading
from all previous versions is recommended.

This release contains the usual assortment of obscure bug fixes. One bug,
however, deserves special attention. A problem appeared in the CREATE INDEX
command beginning with version 3.8.2 (2013-12-06) that allowed, under some
circumstances, a UNIQUE index to be created on a column that was not unique.
Once the index was created, no new non-unique entries could be inserted, but
preexisting non-unique entries would remain. See ticket 9a6daf340df99ba93c for
further information. In addition to fixing this bug, the PRAGMA integrity_check
command has been enhanced to detect non-uniqueness in UNIQUE indices, so that
if this bug did introduce any problems in databases, those problems can be
easily detected.

Other noteworthy changes include the addition of support for hexadecimal
integers (ex: 0x1234), and performance enhancements to the IN operator which,
according to mailing list reports, help some queries run up to five times
faster.

Version 3.8.6 uses 25% fewer CPU cycles than version 3.8.0 from approximately
one year ago, according to valgrind and the test/speedtest1.c test program. On
the other hand, the compiled binary for version 3.8.6 is about 5% larger than
3.8.0. The size increase is due in part to the addition of new features such as
WITHOUT ROWID tables and common table expressions.

2014-06-04 - Release 3.8.5

SQLite version 3.8.5 is a regularly scheduled maintenance release. Upgrading
from the previous version is recommended.

Version 3.8.5 fixes more than a dozen obscure bugs. None of these bugs should
be a problem for existing applications. Nor do any of the bugs represent a
security vulnerability. Nevertheless, upgrading is recommended to prevent
future problems.

In addition to bug fixes, the 3.8.5 release adds improvements to the query
planner, especially regarding sorting using indices and handling OR terms in
the WHERE clause for WITHOUT ROWID tables. The ".system" and ".once"
dot-commands were added to the command-line interface. And there were
enhancements to the FTS4 and RTREE virtual tables. See the change log for
details.

2014-04-03 - Release 3.8.4.3

The optimizations added in version 3.8.4 caused some queries that involve
subqueries in the FROM clause, DISTINCT, and ORDER BY clauses, to give an
incorrect result. See ticket 98825a79ce145 for details. This release adds a
one-character change to a single line of code to fix the problem.

2014-03-26 - Release 3.8.4.2

The code changes that resulted in the performance improvements in version 3.8.4
missed a single buffer overflow test, which could result in a read past the end
of a buffer while searching a database that is corrupted in a particular way.
Version 3.8.4.2 fixes that problem using a one-line patch.

We are not aware of any problems in version 3.8.4 when working with well-formed
database files. The problem fixed by this release only comes up when reading
corrupt database files.

2014-03-11 - Release 3.8.4.1

SQLite version 3.8.4.1 is a patch against version 3.8.4 that fixes two minor
issues:

Work around a C-preprocessor macro conflict that causes compilation problems
for some configurations of Visual Studio.
Adjust the cost computation for the skip-scan optimization for improved
performance.
Both of these issues came to light within minutes of tagging the previous
release. Neither issue is serious but they can be annoying. Hence, the decision
was made to do a quick patch release to address both issues.
2014-03-10 - Release 3.8.4

SQLite version 3.8.4 is a maintenance release featuring performance
enhancements and fixes for a number of obscure bugs. There are no significant
new features in SQLite version 3.8.4. However, the number of CPU cycles
(measured by valgrind) needed to do many common operations has be reduced by
about 12% relative to the previous release, and by about 25% relative to
version 3.7.16 from approximately one year ago.

Version 3.8.4 of SQLite fixes several corner-case bugs that were found since
the previous release. These bugs were unlikely to appear in practice, and none
represent a security vulnerability. Nevertheless, developers are encouraged to
upgrade from all prior releases.

diffstat:

 external/public-domain/sqlite/dist/shell.c      |  3657 ++++++++++++++----
 external/public-domain/sqlite/dist/sqlite3.h    |  4357 ++++++++++++++++++----
 external/public-domain/sqlite/dist/sqlite3ext.h |    69 +-
 3 files changed, 6485 insertions(+), 1598 deletions(-)

diffs (truncated from 11984 to 300 lines):

diff -r 6888d3b6e3f0 -r 6a3956d44e85 external/public-domain/sqlite/dist/shell.c
--- a/external/public-domain/sqlite/dist/shell.c        Sun Jul 03 07:27:37 2016 +0000
+++ b/external/public-domain/sqlite/dist/shell.c        Sun Jul 03 09:24:29 2016 +0000
@@ -18,6 +18,20 @@
 #endif
 
 /*
+** If requested, include the SQLite compiler options file for MSVC.
+*/
+#if defined(INCLUDE_MSVC_H)
+#include "msvc.h"
+#endif
+
+/*
+** No support for loadable extensions in VxWorks.
+*/
+#if (defined(__RTP__) || defined(_WRS_KERNEL)) && !SQLITE_OMIT_LOAD_EXTENSION
+# define SQLITE_OMIT_LOAD_EXTENSION 1
+#endif
+
+/*
 ** Enable large-file support for fopen() and friends on unix.
 */
 #ifndef SQLITE_DISABLE_LFS
@@ -33,6 +47,9 @@
 #include <stdio.h>
 #include <assert.h>
 #include "sqlite3.h"
+#if SQLITE_USER_AUTHENTICATION
+# include "sqlite3userauth.h"
+#endif
 #include <ctype.h>
 #include <stdarg.h>
 
@@ -45,37 +62,65 @@
 # include <sys/types.h>
 #endif
 
-#ifdef HAVE_EDITLINE
-# include <editline/editline.h>
-#endif
-#if defined(HAVE_READLINE) && HAVE_READLINE==1
+#if HAVE_READLINE
 # include <readline/readline.h>
 # include <readline/history.h>
 #endif
-#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
-# define add_history(X)
-# define read_history(X)
-# define write_history(X)
-# define stifle_history(X)
+
+#if HAVE_EDITLINE
+# include <editline/readline.h>
 #endif
 
+#if HAVE_EDITLINE || HAVE_READLINE
+
+# define shell_add_history(X) add_history(X)
+# define shell_read_history(X) read_history(X)
+# define shell_write_history(X) write_history(X)
+# define shell_stifle_history(X) stifle_history(X)
+# define shell_readline(X) readline(X)
+
+#elif HAVE_LINENOISE
+
+# include "linenoise.h"
+# define shell_add_history(X) linenoiseHistoryAdd(X)
+# define shell_read_history(X) linenoiseHistoryLoad(X)
+# define shell_write_history(X) linenoiseHistorySave(X)
+# define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
+# define shell_readline(X) linenoise(X)
+
+#else
+
+# define shell_read_history(X)
+# define shell_write_history(X)
+# define shell_stifle_history(X)
+
+# define SHELL_USE_LOCAL_GETLINE 1
+#endif
+
+
 #if defined(_WIN32) || defined(WIN32)
 # include <io.h>
-#define isatty(h) _isatty(h)
-#define access(f,m) _access((f),(m))
-#undef popen
-#define popen _popen
-#undef pclose
-#define pclose _pclose
+# include <fcntl.h>
+# define isatty(h) _isatty(h)
+# ifndef access
+#  define access(f,m) _access((f),(m))
+# endif
+# undef popen
+# define popen _popen
+# undef pclose
+# define pclose _pclose
 #else
-/* Make sure isatty() has a prototype.
-*/
-extern int isatty(int);
-
-/* popen and pclose are not C89 functions and so are sometimes omitted from
-** the <stdio.h> header */
-extern FILE *popen(const char*,const char*);
-extern int pclose(FILE*);
+ /* Make sure isatty() has a prototype. */
+ extern int isatty(int);
+
+# if !defined(__RTP__) && !defined(_WRS_KERNEL)
+  /* popen and pclose are not C89 functions and so are
+  ** sometimes omitted from the <stdio.h> header */
+   extern FILE *popen(const char*,const char*);
+   extern int pclose(FILE*);
+# else
+#  define SQLITE_OMIT_POPEN 1
+# endif
 #endif
 
 #if defined(_WIN32_WCE)
@@ -91,6 +136,35 @@
 #define IsDigit(X)  isdigit((unsigned char)X)
 #define ToLower(X)  (char)tolower((unsigned char)X)
 
+#if defined(_WIN32) || defined(WIN32)
+#include <windows.h>
+
+/* string conversion routines only needed on Win32 */
+extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
+extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
+extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int);
+#endif
+
+/* On Windows, we normally run with output mode of TEXT so that \n characters
+** are automatically translated into \r\n.  However, this behavior needs
+** to be disabled in some cases (ex: when generating CSV output and when
+** rendering quoted strings that contain \n characters).  The following
+** routines take care of that.
+*/
+#if defined(_WIN32) || defined(WIN32)
+static void setBinaryMode(FILE *file, int isOutput){
+  if( isOutput ) fflush(file);
+  _setmode(_fileno(file), _O_BINARY);
+}
+static void setTextMode(FILE *file, int isOutput){
+  if( isOutput ) fflush(file);
+  _setmode(_fileno(file), _O_TEXT);
+}
+#else
+# define setBinaryMode(X,Y)
+# define setTextMode(X,Y)
+#endif
+
 
 /* True if the timer is enabled */
 static int enableTimer = 0;
@@ -100,7 +174,7 @@
   static sqlite3_vfs *clockVfs = 0;
   sqlite3_int64 t;
   if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
-  if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){
+  if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){
     clockVfs->xCurrentTimeInt64(clockVfs, &t);
   }else{
     double r;
@@ -110,11 +184,19 @@
   return t;
 }
 
-#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL) \
- && !defined(__minux)
+#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
 #include <sys/time.h>
 #include <sys/resource.h>
 
+/* VxWorks does not support getrusage() as far as we can determine */
+#if defined(_WRS_KERNEL) || defined(__RTP__)
+struct rusage {
+  struct timeval ru_utime; /* user CPU time used */
+  struct timeval ru_stime; /* system CPU time used */
+};
+#define getrusage(A,B) memset(B,0,sizeof(*B))
+#endif
+
 /* Saved resource information for the beginning of an operation */
 static struct rusage sBegin;  /* CPU time at start */
 static sqlite3_int64 iBegin;  /* Wall-clock time at start */
@@ -131,7 +213,7 @@
 
 /* Return the difference of two time_structs in seconds */
 static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
-  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + 
+  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
          (double)(pEnd->tv_sec - pStart->tv_sec);
 }
 
@@ -140,8 +222,8 @@
 */
 static void endTimer(void){
   if( enableTimer ){
+    sqlite3_int64 iEnd = timeOfDay();
     struct rusage sEnd;
-    sqlite3_int64 iEnd = timeOfDay();
     getrusage(RUSAGE_SELF, &sEnd);
     printf("Run Time: real %.3f user %f sys %f\n",
        (iEnd - iBegin)*0.001,
@@ -156,14 +238,13 @@
 
 #elif (defined(_WIN32) || defined(WIN32))
 
-#include <windows.h>
-
 /* Saved resource information for the beginning of an operation */
 static HANDLE hProcess;
 static FILETIME ftKernelBegin;
 static FILETIME ftUserBegin;
 static sqlite3_int64 ftWallBegin;
-typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
+typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME,
+                                    LPFILETIME, LPFILETIME);
 static GETPROCTIMES getProcessTimesAddr = NULL;
 
 /*
@@ -174,19 +255,20 @@
   if( getProcessTimesAddr ){
     return 1;
   } else {
-    /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
-    ** See if the version we are running on has it, and if it does, save off
-    ** a pointer to it and the current process handle.
+    /* GetProcessTimes() isn't supported in WIN95 and some other Windows
+    ** versions. See if the version we are running on has it, and if it
+    ** does, save off a pointer to it and the current process handle.
     */
     hProcess = GetCurrentProcess();
     if( hProcess ){
       HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
       if( NULL != hinstLib ){
-        getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
+        getProcessTimesAddr =
+            (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
         if( NULL != getProcessTimesAddr ){
           return 1;
         }
-        FreeLibrary(hinstLib); 
+        FreeLibrary(hinstLib);
       }
     }
   }
@@ -199,7 +281,8 @@
 static void beginTimer(void){
   if( enableTimer && getProcessTimesAddr ){
     FILETIME ftCreation, ftExit;
-    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
+    getProcessTimesAddr(hProcess,&ftCreation,&ftExit,
+                        &ftKernelBegin,&ftUserBegin);
     ftWallBegin = timeOfDay();
   }
 }
@@ -218,7 +301,7 @@
   if( enableTimer && getProcessTimesAddr){
     FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
     sqlite3_int64 ftWallEnd = timeOfDay();
-    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
+    getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd);
     printf("Run Time: real %.3f user %f sys %f\n",
        (ftWallEnd - ftWallBegin)*0.001,
        timeDiff(&ftUserBegin, &ftUserEnd),
@@ -231,7 +314,7 @@
 #define HAS_TIMER hasTimer()
 
 #else
-#define BEGIN_TIMER 
+#define BEGIN_TIMER
 #define END_TIMER
 #define HAS_TIMER 0
 #endif
@@ -254,11 +337,18 @@
 static int stdin_is_interactive = 1;
 
 /*
+** On Windows systems we have to know if standard output is a console
+** in order to translate UTF-8 into MBCS.  The following variable is
+** true if translation is required.
+*/
+static int stdout_is_console = 1;
+
+/*
 ** The following is the open SQLite database.  We make a pointer
 ** to this database a static variable so that it can be accessed
 ** by the SIGINT handler to interrupt database processing.
 */
-static sqlite3 *db = 0;
+static sqlite3 *globalDb = 0;
 
 /*
 ** True if an interrupt (Control-C) has been received.



Home | Main Index | Thread Index | Old Index