Permalink
Browse files

updated SQLite3 engine to latest version 3.22.0

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Jan 25, 2018
1 parent d3f92ec commit eaddf84b04b7eaf647adb598be140276b9b42046
Showing with 5,499 additions and 3,199 deletions.
  1. +3 −1 SQLite3/c-fpc64mingw.bat
  2. +1 −1 SQLite3/mORMotSQLite3.pas
  3. +5,440 −3,183 SQLite3/sqlite3.c
  4. +7 −2 SynCrypto.pas
  5. +7 −4 SynSQLite3.pas
  6. +38 −5 SynSQLite3Static.pas
  7. +2 −2 Synopse.inc
  8. +1 −1 SynopseCommit.inc
View
@@ -25,7 +25,9 @@ del ..\SQLite3\exe\sqlite3-64.dll
gcc -O2 -shared -DSQLITE_MMAP_READWRITE -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_JSON1 -DWIN64 -DNDEBUG -D_WINDOWS -D_USRDLL -DNO_TCL -D_CRT_SECURE_NO_DEPRECATE -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_THREADSAFE=1 -DTEMP_STORE=1 -m64 -I. ..\SQLite3\amalgamation\sqlite3.c -o ..\SQLite3\exe\sqlite3-64.dll -Wl,--out-implib,libsqlite3-64.a
@rem here we use -O1 since -O2 triggers unexpected GPF :(
gcc -c -O1 -static -DSQLITE_ENABLE_FTS3 -DWIN64 -DNDEBUG -D_WINDOWS -DNO_TCL -D_CRT_SECURE_NO_DEPRECATE -DSQLITE_TEMP_STORE=1 -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -m64 -I. ..\SQLite3\sqlite3.c -o sqlite3-64.o
gcc -c -O1 -static -DSQLITE_ENABLE_FTS3 -DWIN64 -DNDEBUG -D_WINDOWS -DNO_TCL -D_CRT_SECURE_NO_DEPRECATE -DSQLITE_TEMP_STORE=1 -m64 -I. ..\SQLite3\sqlite3.c -o sqlite3-64.o
@rem -fno-stack-check -fno-stack-protector -mno-stack-arg-probe
attrib +r sqlite3-64.o
attrib +r ..\SQLite3\exe\sqlite3-64.dll
@@ -205,7 +205,7 @@
Version 1.18
- unit SQLite3.pas renamed mORMotSQLite3.pas
- updated SQLite3 engine to latest version 3.21.0
- updated SQLite3 engine to latest version 3.22.0
- BATCH adding in TSQLRestServerDB will now perform SQLite3 multi-INSERT
statements: performance boost is from 2x (mem with transaction) to 60x
(full w/out transaction) - faster than SQlite3 as external DB
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -3938,15 +3938,20 @@ function SingleTest(const s: RawByteString; TDig: TSHA1Digest): boolean;
{$define SHA512_X64} // external sha512_sse4 for win64/lin64
{$endif}
{$else}
{$define USEAESNI}
{$define USEAESNI32}
{$ifdef MSWINDOWS}
{$define SHA512_X86} // external sha512-x86.obj/.o
{$endif}
{$ifdef FPC}
{$ifdef LINUX}
{$define SHA512_X86} // external linux32/sha512-x86.o
{$endif}
{$ifdef DARWIN}
{$define AES_PASCAL} // x86 AES asm below is not PIC-safe
{$endif DARWIN}
{$ifndef AES_PASCAL}
{$define USEAESNI}
{$define USEAESNI32}
{$endif AES_PASCAL}
{$endif FPC}
{$endif}
{$else}
View
@@ -48,7 +48,7 @@
***** END LICENSE BLOCK *****
SQLite3 3.21.0 database engine
SQLite3 3.22.0 database engine
********************************
Brand new SQLite3 library to be used with Delphi
@@ -136,7 +136,7 @@
- moved all static .obj code into new SynSQLite3Static unit
- allow either static .obj use via SynSQLite3Static or external .dll linking
using TSQLite3LibraryDynamic to bind all APIs to the global sqlite3 variable
- updated SQLite3 engine to latest version 3.21.0
- updated SQLite3 engine to latest version 3.22.0
- fixed: internal result cache is now case-sensitive for its SQL key values
- raise an ESQLite3Exception if DBOpen method is called twice
- added TSQLite3ErrorCode enumeration and sqlite3_resultToErrorCode()
@@ -1291,7 +1291,7 @@ TSQLite3Library = class
close: function(DB: TSQLite3DB): integer; {$ifndef SQLITE3_FASTCALL}cdecl;{$endif}
/// Return the version of the SQLite database engine, in ascii format
// - currently returns '3.21.0', when used with our SynSQLite3Static unit
// - currently returns '3.22.0', when used with our SynSQLite3Static unit
// - if an external SQLite3 library is used, version may vary
// - you may use the VersionText property (or Version for full details) instead
libversion: function: PUTF8Char; {$ifndef SQLITE3_FASTCALL}cdecl;{$endif}
@@ -5603,8 +5603,11 @@ procedure TSQLDatabaseBackupThread.Execute;
case res of
SQLITE_OK:
NotifyProgressAndContinue(backupStepOk);
SQLITE_BUSY:
SQLITE_BUSY: begin
NotifyProgressAndContinue(backupStepBusy);
if fStepSleepMS=0 then
SleepHiRes(1);
end;
SQLITE_LOCKED:
NotifyProgressAndContinue(backupStepLocked);
SQLITE_DONE:
View
@@ -1,4 +1,4 @@
/// SQLite3 3.21.0 Database engine - statically linked for Windows/Linux 32 bit
/// SQLite3 3.22.0 Database engine - statically linked for Windows/Linux 32 bit
// - this unit is a part of the freeware Synopse mORMot framework,
// licensed under a MPL/GPL/LGPL tri-license; version 1.18
unit SynSQLite3Static;
@@ -48,7 +48,7 @@
Statically linked SQLite3 3.21.0 engine
Statically linked SQLite3 3.22.0 engine
*****************************************
To be declared in your project uses clause: will fill SynSQlite3.sqlite3
@@ -75,7 +75,7 @@
Version 1.18
- initial revision, extracted from SynSQLite3.pas unit
- updated SQLite3 engine to latest version 3.21.0
- updated SQLite3 engine to latest version 3.22.0
- now all sqlite3_*() API calls are accessible via sqlite3.*()
- our custom file encryption is now called via sqlite3.key() - i.e. official
SQLite Encryption Extension (SEE) sqlite3_key() API
@@ -308,7 +308,18 @@ function log(x: double): double; cdecl; public name LOGFUNCLINKNAME; export;
result := ln(x);
end;
{$ifdef MSWINDOWS}
{$ifdef CPUX86} // not a compiler intrinsic on x86
function _InterlockedCompareExchange(var Dest: longint; New,Comp: longint): longint; stdcall;
[public, alias: '_InterlockedCompareExchange@12'];
begin
result := InterlockedCompareExchange(Dest,New,Comp);
end;
{$endif CPUX86}
{$endif MSWINDOWS}
{$ifdef Darwin}
function moddi3(num,den:int64):int64; cdecl; [public, alias: '___moddi3'];
begin
result := num mod den;
@@ -514,6 +525,28 @@ function strcmp(p1,p2: PAnsiChar): integer; cdecl; { always cdecl }
result := SynCommons.StrComp(p1,p2);
end;
function strcspn(p1,p2: PAnsiChar): integer; cdecl;
{$ifdef FPC}public name{$ifdef CPU64}'strcspn'{$else}'_strcspn'{$endif};{$endif}
var s: PAnsiChar;
c: AnsiChar;
begin // span the complement of string p2
result := 0;
repeat
c := p1[result];
if c=#0 then
break;
s := p2;
repeat
if s^=c then // stop as soon as we find any character from p2
exit else
if s^=#0 then
break else
inc(s);
until false;
inc(result);
until false;
end;
function memcmp(p1, p2: pByte; Size: integer): integer; cdecl; { always cdecl }
{$ifdef FPC}public name{$ifdef CPU64}'memcmp'{$else}'_memcmp'{$endif};{$endif}
// a fast full pascal version of the standard C library function
@@ -1330,7 +1363,7 @@ function sqlite3_trace_v2(DB: TSQLite3DB; Mask: integer; Callback: TSQLTraceCall
const
// error message if linked sqlite3.obj does not match this
EXPECTED_SQLITE3_VERSION = '3.21.0';
EXPECTED_SQLITE3_VERSION = '3.22.0';
constructor TSQLite3LibraryStatic.Create;
var error: RawUTF8;
@@ -1439,7 +1472,7 @@ constructor TSQLite3LibraryStatic.Create;
{$endif}
sqlite3_initialize;
inherited Create; // set fVersionNumber/fVersionText
if fVersionText=EXPECTED_SQLITE3_VERSION then
if (EXPECTED_SQLITE3_VERSION='') or (fVersionText=EXPECTED_SQLITE3_VERSION) then
exit;
FormatUTF8('Static sqlite3.obj as included within % is outdated!'#13+
'Linked version is % whereas the current/expected is '+EXPECTED_SQLITE3_VERSION+'.'#13#13+
View
@@ -234,9 +234,9 @@
// -> could be disabled to force external .so/.dll linking
{$ifdef MSWINDOWS}
{$ifdef CPUX86}
{$define FPCSQLITE3STATIC} // we supply Win32 .obj
{$define FPCSQLITE3STATIC} // we supply Win32 .o
{$else}
{$define FPCSQLITE3STATIC} // we supply Win64 .o (compiled with -O1)
{.$define FPCSQLITE3STATIC} // Win64 .o are buggy (even compiled with -O1)
{$endif}
{$endif}
{$ifdef LINUX}
View
@@ -1 +1 @@
'1.18.4168'
'1.18.4169'

1 comment on commit eaddf84

@edwinyzh

This comment has been minimized.

Contributor

edwinyzh commented on eaddf84 Jan 26, 2018

Thanks ab, I assume the sqlite engine used by mormot supports the newly added extensions listed below?

  • The Zipfile virtual table can read and write a ZIP Archive.
  • Added the fsdir(PATH) table-valued function to the fileio.c extension, for listing the files in a directory.
  • The sqlite_btreeinfo eponymous virtual table for introspecting and estimating the sizes of the btrees in a database.
  • The Append VFS is a VFS shim that allows an SQLite database to be appended to some other file. This allows (for example) a database to be appended to an executable that then opens and reads the database.
Please sign in to comment.