Giter Club home page Giter Club logo

utelle / wxsqlite3 Goto Github PK

View Code? Open in Web Editor NEW
564.0 53.0 172.0 69.68 MB

wxSQLite3 - SQLite3 database wrapper for wxWidgets (including SQLite3 encryption extension)

Home Page: http://utelle.github.io/wxsqlite3

License: Other

Makefile 0.96% Shell 2.66% C++ 2.59% C 93.07% Lua 0.22% M4 0.37% CMake 0.12% Batchfile 0.01%
sqlite-amalgamation wxsqlite3 encryption-extension sqlite3 sqlite3-encryption database-encryption encrypted-database encryption-support database-adapter sqlite-database

wxsqlite3's Introduction

General Information

I'm a software engineer for technical-scientific applications having M.Sc. degrees in Computer Sciences and Mathematics. For software development on various platforms (Windows, Linux, macOS) I mainly use the programming languages C++, Java, and Fortran.

Main fields of Interest

  • PDF technologies
  • Database management systems (design and architecture)
  • XML/XSLT processing
  • I18N (Internationalization) technologies

Open Source Projects

Since about 2005 I'm involved in Open Source software development.

My components for wxWidgets-based applications

My C-based components

Projects to which I contributed, one way or the other

  • libcurl - A library for transferring data with URL syntax
  • libxlsxwriter - A C library for creating Excel XLSX files
  • sqleet - SQLite3 encryption that sucks less
  • wxWidgets - Cross-Platform GUI Library

Projects I have experiences with

  • libexpat - Fast streaming XML parser library
  • Lua - Powerful, efficient, lightweight, embeddable scripting language
  • muparser - Fast math parser library
  • OpenSSL - Cryptography and SSL/TLS Toolkit
  • Sablotron - XSLT processor written in C++

Contact

wxsqlite3's People

Contributors

arthurcn avatar ch1973 avatar deamhan avatar emkey08 avatar ericj avatar hasufell avatar mynameistroy avatar slodki avatar strubbl avatar utelle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wxsqlite3's Issues

Alternatives for setting cipher parameters at runtime

Currently selecting and/or configuring the encryption cipher at runtime requires to perform one or more calls to wxsqlite3_config resp wxsqlite3_config_cipher or to execute one or more SQL statements using the function wxsqlite3_config, before calling sqlite3_key or executing PRAGMA key='pass phrase';.

However, these approaches may be inconvenient or even not working under certain circumstances depending on the actual database interface.

Therefore I consider to implement an alternative for specifying cipher configuration parameters. The following 2 approaches come to mind:

  1. Using a prefix for the encryption key
    (like for example [cipher=aes256cbc;kdf_iter=12345]actual_pass_phrase)
    This approach is rather easy to implement, but requires to manipulate the pass phrase in the application.
  2. Using additional parameters in the database file URI
    (like for example file://database.db3?cipher=aes256cbc&kdf_iter=12345)
    This approach avoids to having to manipulate the pass phrase, but it is more difficult to intercept and could potentially cause conflicts in future versions of SQLite, if there happen parameter name clashes.

Questions:

  1. Which approach should be chosen?
  2. Are there other possible, maybe preferrable approaches?
  3. How should accidentally incorrectly specified parameters be handled?
    a) ignore just the invalid parameter(s)
    b) ignore all given parameters
    c) let the operation fail with an error code
    d) handle an invalid key prefix just as a regular pass phrase (including the prefix)

Feedback is welcome!

Standard SQLite compatibility

Using "official"sqlite binary for windows for few years, but ICU support missing. Today found wxsqlite and this have question: Could wxsqlite windows binariy be used instead of "official" one, without any limits with advance of ICU extensions?

thanks, L.

wxSQLite3Transaction::Commit() may fails silently

Hi

My question is how to report unsuccessful commits if the wxSQLite3Transaction::Commit() keeps eating all thrown exceptions if something goes wrong when trying to commit the transaction (i.e: a FK violation) ?

I had to re-throw the exception from Commit() to finally know that may script was failing due to FK violation:

void wxSQLite3Transaction::Commit()
{
  try
  {
    m_database->Commit();
  }
  catch (...)
  {
    m_database->Rollback();
    throw; // rethrow
  }
  m_database = NULL;
}

I know i know, this not the correct solution and i just want to draw your attention to this problem.

Thank you.

Problems to create 3.5.1 with TDM-GCC MinGW

Hi Ulrich,

I have some problems with the Makefile for your very nice library.
There are some changes since 3-3.3.1, the last version what I used.

  1. Missing compiler in config.gcc

Compiler is not defined inside config.gcc, the variables are empty.

#Add to config.gcc
CC = gcc
CXX = g++

  1. Include folder
    wxsqlite3.make expects include folder under wqlite3 ("-I../sqlite3/include") but folder is not exist.
    Additionally two files must be in the folder
    sqlite3.h
    sqlite3userauth.h

With this changes I am able to compile library.
Test:
mingw32-make config=debug_x64

But the story is go on.

  1. MONOLITHIC build is gone
    With current Makefile it is not possible to use wxWidgets build as MONOLITHIC library.

  2. Library name end extension is changes
    The versions up to 3-3.3.1 used
    libwxcode_msw31u_wxsqlite3.a for Release
    libwxcode_msw31ud_wxsqlite3.a for Debug

Now I will get wxsqlite3d.lib or wxsqlite3.lib
First the expected extension for GCC is .a not .lib and the second the name is changed what is not acceptable.
In reality, I cannot change every project to use new name.

Regards,
Boris

Is there any way to find out which cipher this database uses?

Is there any way to find out which cipher this database uses? wxsqllite3_config(sqlite*, "cipher", -1) could return the cipher ID after open() invoked. But there seems be no way to get this cipher ID using SELECT. I found out SELECT wxsqlite3_config('cipher') always return the global cipher name but not the one for instance. So what about adding this feature?

BTW, since we can change cipher at runtime, why there is a compile option called CODEC_TYPE=CODEC_TYPE_AES256?

CODEC_TYPE_* defines

The CODEC_TYPE defines can't be (easily) included by external code because codec.h isn't a self-sufficient header file.

Since the CODEC_TYPE defines are intended to be used for the newValue parameter of wxsqlite3_config(), it would be nice to have sqlite3secure.h define them as part of the interface.

Build errors in VS12(11) project

When I tried to build the library with solution wxsqlite3_vc11.sln from build directory I got this errors:

1>ClCompile:
1>  sqlite3secure.c
1>...\wxsqlite3-4.3.0\sqlite3secure\src\codecext.c(336): error C2143: синтаксическая ошибка: отсутствие ";" перед "тип"
1>...\wxsqlite3-4.3.0\sqlite3secure\src\codecext.c(337): error C2065: dbIndex: необъявленный идентификатор
1>..\sqlite3secure\src\sqlite3secure.c(191): error C2275: CodecParameter: недопустимое использование этого типа в качестве выражения
1>          ...\wxsqlite3-4.3.0\sqlite3secure\src\codec.c(1437): см. объявление "CodecParameter"
1>

The reason of the errors that VS12(11) hasn't support for C99 (or has very limited). So all declarations need to be before any blocks.

VCRUNTIME140.dll missing on Windows 10 / 64bit

Get error message when starting on W10/64bit. MICROSOFT VISUAL STUDIO 2015 REDITRIBUTABLE installed and reinstalled few times, all older releases of MSVC uninstalled before. What Can I did more?

Removal of option to load SQLite library dynamically

Since wxSQLite3 version 3.5.0 (released in January 2017) the source code of the SQLite library is an integrated part of wxSQLite3 to simplify building the component and to make it easier to keep the features supported by SQLite and the wxSQLite3 wrapper in sync.

Using the symbol wxUSE_DYNAMIC_SQLITE3_LOAD it is currently still possible to select the option to load the SQLite library at runtime (DLL resp shared object). However, this opens the risk of loading a SQLite version that was not compiled with options matching those used for building the wxSQLite3 wrapper.

Therefore it is intended to remove the option to load SQLite at runtime from the next major release of wxSQLite3, unless a significant number of wxSQLite3 users object to this change.

Please share your opinions. Thanks.

Installation

I downloaded SQLite3-master.zip.

  1. Where do I extract the files to? EXACTLY where? I'm on Linux Mint.
  2. Then what?

I'll be using wxSQLite3 with Code::Blocks.

Crash when rekey from a plain big db to a cypher one

crash with v4.0.4 and same with the latest tag version.

The plain db is over 200MB, and one table in this db has over 2w+ rows. When call rekey(), the program crash.

The crash stack is like:
image

The failed line:
image

The data pointed by pzErrMsg is 0xcccccccc, and then crash

The option change may like this in codecext.c line 362:
image

wish helpful,thank you very much

How to support tokenizer icu?

Is the precompile version support tokenizer icu? if it's doesn't supportl icu, howto compile with icu? thanks very much!

Backup(filename, password) not working in 4.0.2

tested with m_db->Backup(newFileName.GetFullPath(), new_password); code.

v3.5.9:

  • unencrypted -> Backup(filename, wxEmptyString) 🆗
  • encrypted -> Backup(filename, wxEmptyString) 🆗
  • unencrypted -> Backup(filename, password) 🆗

v4.0.2:

  • unencrypted -> Backup(filename, wxEmptyString) 🆗
  • encrypted -> Backup(filename, wxEmptyString) 🆗
  • unencrypted -> Backup(filename, password) - new file is created, looks like encrypted, but cannot be opened with the same password...

This can be similar to #27 but for Backup function IMHO.

sqlite3secure warnings on linux

When building moneymanagerex which uses wxsqlite3 with secure and extension functions on Linux I got following errors:

/home/dawid/Development/mmex/build/bk-deps g++ -c -o wxsqlite_wxsqlite3.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread  -g -O2 -std=c++11 -g0 -O2 ../lib/wxsqlite3/src/wxsqlite3.cpp
/home/dawid/Development/mmex/build/bk-deps gcc -c -o wxsqlite_sqlite3secure.o -DNOPCH -DSQLITE_CORE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_EXTFUNC -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_JSON1 -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH -DHAVE_ISBLANK -DWXSQLITE3_HAVE_CODEC -DWXSQLITE3_HAVE_METADATA -DWXSQLITE3_USER_AUTHENTICATION -I../lib/wxsqlite3/sqlite3/secure/src -I../lib/wxsqlite3/include -fPIC -DPIC -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread  -g -O2 -g0 -O2 ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:68:0:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:213:25: error: conflicting types for ‘i64’
 typedef int64_t         i64;
                         ^
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:13:0:
../lib/wxsqlite3/sqlite3/secure/src/sqlite3.c:9627:22: note: previous declaration of ‘i64’ was here
 typedef sqlite_int64 i64;          /* 8-byte signed integer */
                      ^
In file included from ../lib/wxsqlite3/sqlite3/secure/src/sqlite3secure.c:68:0:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c: In function ‘print_elem’:
../lib/wxsqlite3/sqlite3/secure/src/extensionfunctions.c:1966:3: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ [-Wformat=]
   printf("%d => %lld\n", ee,c);
   ^
make: *** [wxsqlite_sqlite3secure.o] Error 1

It looks wxsqlite3 related.

g++ (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3

config.gcc should not specify compiler version number - breaks wxwidgets lib paths

The variable wxCompilerPrefix in config.gcc specifies the compiler version number but really shouldn't as the makefiles use it to determine the path to wxWidgets libs.
so:

wxCompilerPrefix ?= gcc720

results in paths like:

wxWidgets/lib/gcc720_dll/mswu
wxWidgets/lib/gcc720_lib/mswu

should default to:

wxCompilerPrefix ?= gcc

to produce paths like:

wxWidgets/lib/gcc_dll/mswu
wxWidgets/lib/gcc_lib/mswu

Buffer underflow issue

PSV studio reports the following error on codec.c
codec.c 187 err V568 It's odd that 'sizeof()' operator evaluates the size of a pointer to a class, but not the size of the 'ctx' class object.
codec.c 187 err V512 A call of the 'memset' function will lead to underflow of the buffer 'ctx'.

In short, this line:
memset((char ) ctx, 0, sizeof(ctx)); / In case it's sensitive */
should be replaced with:
memset((char ) ctx, 0, sizeof(MD5_CTX)); / In case it's sensitive */

BR,
Miroslav

Issues with building wxsqlite3-3.5.3 on gcc - setup.h

Hi,

I'm not able to build the latest version.
wxWidgets-3.1.0
TDM-GCC 5.1.0

set COMMON_FLAGS=-f Makefile CODEC_TYPE=CODEC_TYPE_AES256 WXSQLITE3_HAVE_METADATA=1 SQLITE_HAS_CODEC=1 WXSQLITE3_HAVE_CODEC=1 SQLITE_CORE=1 THREADSAFE=1 SQLITE_SECURE_DELETE=1 SQLITE_SOUNDEX=1 SQLITE_ENABLE_COLUMN_METADATA=1 CXXFLAGS="-std=gnu++11 -fno-keep-inline-dllexport" WXWIN=%WXWIDGETS_ROOT_DIR%

mingw32-make.exe %COMMON_FLAGS% config=debug_x64 all

gives the following error:

"==== Building wxsqlite3 (debug_x64) ===="
wxsqlite3.cpp
In file included from c:/!ST/Tools.Develop/wxWidgets/include/wx/defs.h:20:0,
                 from c:/!ST/Tools.Develop/wxWidgets/include/wx/wxprec.h:12,
                 from ../src/wxsqlite3.cpp:18:
c:/!ST/Tools.Develop/wxWidgets/include/wx/platform.h:136:22: fatal error: wx/setup.h: No such file or directory
compilation terminated.
wxsqlite3.make:414: recipe for target 'obj/x64/Debug/wxsqlite3/wxsqlite3.o' failed
mingw32-make.exe[1]: *** [obj/x64/Debug/wxsqlite3/wxsqlite3.o] Error 1
Makefile:82: recipe for target 'wxsqlite3' failed
mingw32-make.exe: *** [wxsqlite3] Error 2

How do I fix this?

Build failed 3.5.1 with wx 3.0.3 or wx 3.1

src/wxsqlite3.cpp: At global scope:
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
};
^
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
src/wxsqlite3.cpp:4134:1: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
In file included from /usr/include/wx-3.1/wx/debug.h:19:0,
from /usr/include/wx-3.1/wx/defs.h:693,
from /usr/include/wx-3.1/wx/wxprec.h:12,
from src/wxsqlite3.cpp:18:
src/wxsqlite3.cpp: In static member function 'static wxString wxSQLite3Database::LimitTypeToString(wxSQLite3LimitType)':
src/wxsqlite3.cpp:4140:35: error: cannot convert 'const char*' to 'const wxChar* {aka const wchar_t*}' in initialization
const wxChar* limitString = wxS("Unknown");
^
/usr/include/wx-3.1/wx/chartype.h:239:20: note: in definition of macro 'wxS'
#define wxS(x) x

Bug to use under Mac OS?

I use this qt plugin in order to use CipherSqlite https://github.com/devbean/QtCipherSqlitePlugin, it work good under android and windows, but not under mac os, when i specifying cipher algorithm to chacha20.

I've tracked the problem to call sqlite3_key=>
0 libsystem_kernel.dylib 0x00007fff97612452 __syscall + 10 =>syscall(SYS_getentroy, ...)
1 libsqlitecipher.dylib 0x0000000111b92513 entropy + 51
2 libsqlitecipher.dylib 0x0000000111b92413 chacha20_rng + 243
3 libsqlitecipher.dylib 0x0000000111cdf3d1 GenerateKeyChaCha20Cipher + 97
4 libsqlitecipher.dylib 0x0000000111b96d11 sqlite3CodecAttach + 1729

get an error:bad system call
But I can't solve it in depth. Any body can help me?

Build fails (MSVC10)

Hello Mr. Telle,

recent changes lead to a compile error:

1>ClCompile:
1>  wxsqlite3.cpp
1>..\src\wxsqlite3.cpp(4450): error C2511: 'int wxSQLite3FunctionContext::ExecAuthorizer(void *,int,const char *,const char *,const char *,const char *,const char *)' : overloaded member function not found in 'wxSQLite3FunctionContext'
1>          D:\git\wxsqlite3\include\wx/wxsqlite3.h(214) : see declaration of 'wxSQLite3FunctionContext'
1>
1>Build FAILED.

Reason:
wxsqlite3opt.h (included by wxsqlite3.cpp) defines WXSQLITE3_USER_AUTHENTICATION in line 31:
#define WXSQLITE3_USER_AUTHENTICATION 1
but wxsqlite3.h leaves WXSQLITE3_USER_AUTHENTICATION undefined. So declaration and definition of ExecAuthorizer() diverges...

Kindly regards,
Andreas Martin

EOL problem with files in git repo

There are multiple text files in the repo stored with CRLF.

From man gitattributes:

eol
This attribute sets a specific line-ending style to be used in the working directory. It enables end-of-line conversion without any content checks, effectively setting the text attribute. Note that setting this attribute on paths which are in the index with CRLF line endings may make the paths to be considered dirty. Adding the path to the index again will normalize the line endings in the index.
[...]
Note
When text=auto conversion is enabled in a cross-platform project using push and pull to a central repository the text files containing CRLFs should be normalized.

Please verify before each commit that text files are normalized (EOL=LF only).

See moneymanagerex/moneymanagerex#1890 for affected files.

Cannot build static sqlite3secure shell

If I try to build sqlite3secure with configure --disable-shared --enable-static (on linux x86_64), I get the following error while linking:

./.libs/libsqlite3secure.a(sqlite3secure.o): In function `sqlite3_shathree_init':
/home/fred/Devel/Git/wxsqlite3/sqlite3secure/src/shathree.c:697: multiple definition of `sqlite3_shathree_init'
src/shell.o:/home/fred/Devel/Git/wxsqlite3/sqlite3secure/src/shell.c:2009: first defined here
./.libs/libsqlite3secure.a(sqlite3secure.o): In function `sqlite3_fileio_init':
/home/fred/Devel/Git/wxsqlite3/sqlite3secure/src/fileio.c:908: multiple definition of `sqlite3_fileio_init'
src/shell.o:/home/fred/Devel/Git/wxsqlite3/sqlite3secure/src/shell.c:2938: first defined here

I guess it works with the dynamic library because the one of shell.c is hard linked.
How do you create the files from the official sqlite3 3.24.0?

Sqlcipher support

as well known that Sqlcipher is a more popular SQLite extension that provides 256 bit AES encryption of database files. i am wondering whether there is a plan to support it.

Thanks

sample linking errors for mingw

The treeview.make file has a couple issues that prevent it from building:

The library linking order is incorrect and it's missing the uxtheme lib.

I got release_x32 to build by changing the LIBS variable to be:

LIBS += ../lib/gcc_lib/libwxsqlite3$(wxFlavour).a -l$(wxBaseLibNamePrefix)_xml -l$(wxToolkitLibNamePrefix)adv -l$(wxToolkitLibNamePrefix)core -l$(wxBaseLibNamePrefix) -lwxjpeg$(wxSuffixDebug) -lwxpng$(wxSuffixDebug) -lwxzlib$(wxSuffixDebug) -lwxtiff$(wxSuffixDebug) -lwxexpat$(wxSuffixDebug) -lwxregex$(wxSuffix) -lcomctl32 -lrpcrt4 -lshell32 -lgdi32 -lkernel32 -luser32 -lcomdlg32 -lole32 -loleaut32 -ladvapi32 -loleacc -lwinspool -lwinmm -lshlwapi -luuid -lversion -lwsock32 -lwininet -luxtheme

minimal.make suffers from similar issues. Here is what worked for me to build release_x32:

LIBS += ../lib/gcc_lib/libwxsqlite3$(wxFlavour).a -l$(wxToolkitLibNamePrefix)core -l$(wxBaseLibNamePrefix) -lwxjpeg$(wxSuffixDebug) -lwxpng$(wxSuffixDebug) -lwxzlib$(wxSuffixDebug) -lwxtiff$(wxSuffixDebug) -lwxexpat$(wxSuffixDebug) -lwxregex$(wxSuffix) -lcomctl32 -lrpcrt4 -lshell32 -lgdi32 -lkernel32 -luser32 -lcomdlg32 -lole32 -loleaut32 -ladvapi32 -loleacc -lwinspool -lwinmm -lshlwapi -luuid -lversion -lwsock32 -lwininet -luxtheme

This was with mingw64 on win 7 with the following config:

i686-8.1.0-posix-sjlj-rt_v6-rev0

error: unknown type name 'DIR'

Hi All,

MinGW reports the following error:

Creating ../lib/gcc_lib
sqlite3secure.c
In file included from ../sqlite3/secure/src/sqlite3secure.c:117:0:
../sqlite3/secure/src/fileio.c: In function 'writefileFunc':
../sqlite3/secure/src/fileio.c:356:9: warning: implicit declaration of function 'S_ISLNK' [-Wimplicit-function-declaration]
     if( S_ISLNK(mode) ){
         ^
../sqlite3/secure/src/fileio.c: At top level:
../sqlite3/secure/src/fileio.c:410:3: error: unknown type name 'DIR'
   DIR *pDir;                 /* From opendir() */
   ^
../sqlite3/secure/src/fileio.c: In function 'fsdirResetCursor':
../sqlite3/secure/src/fileio.c:490:22: warning: implicit declaration of function 'closedir' [-Wimplicit-function-declaration]
     if( pLvl->pDir ) closedir(pLvl->pDir);
                      ^
../sqlite3/secure/src/fileio.c: In function 'fsdirNext':
../sqlite3/secure/src/fileio.c:552:18: warning: implicit declaration of function 'opendir' [-Wimplicit-function-declaration]
     pLvl->pDir = opendir(pLvl->zDir);
                  ^
../sqlite3/secure/src/fileio.c:552:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     pLvl->pDir = opendir(pLvl->zDir);
                ^
../sqlite3/secure/src/fileio.c:561:29: warning: implicit declaration of function 'readdir' [-Wimplicit-function-declaration]
     struct dirent *pEntry = readdir(pLvl->pDir);
                             ^
../sqlite3/secure/src/fileio.c:561:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
../sqlite3/secure/src/fileio.c:563:17: error: dereferencing pointer to incomplete type 'struct DIRENT'
       if( pEntry->d_name[0]=='.' ){
                 ^
wxsqlite3.make:411: recipe for target 'obj/x32/Debug/wxsqlite3/sqlite3secure.o' failed
mingw32-make[1]: *** [obj/x32/Debug/wxsqlite3/sqlite3secure.o] Error 1
Makefile:82: recipe for target 'wxsqlite3' failed
mingw32-make: *** [wxsqlite3] Error 2```

-Enjoy

Convertion non-encrypted database to SQLCipher/ChaCha20 format

Hi,

I am not able to convert existing non-encrypted DB into SQLCipher/ChaCha20. It lead
to crash in function CodecCopy(Codec* codec, Codec* other). It seems that
codec->m_readCipherType=0.

Following command typed into sqlite3shell.exe lead to crash.

sqlite3shell.exe test2.db

sqlite> SELECT wxsqlite3_config("cipher", "sqlcipher" );
sqlite> pragma rekey='pass';

test2.db is unencrypted database with one table.
It seems that in this case is needed to use sqlite3RunVacuumForRekey which later lead to crash.

No problem with CODEC_TYPE_AES128 and CODEC_TYPE_AES256.
Also is possible to create empty encrypted database with every codec.

Thanks

[Question] Recompiling system.data.sqlite with wxsqlite3

Hey guys (specifically Ulrich),

I'm a bit stuck in the process of compiling sqlite3 encryption with Java and C#. I am fortunate enough that somebody else has compiled a JDBC with this encryption, but it appears that I'm on my own with getting C# encryption. The default encryption method that system.data.sqlite comes with is RC4 I believe, so they are not compatible.

I recognize that this is not an issue with your repository directly, but I've scourged the internet for the past few days on these issues, and I've come across you in many different locations (sqlite mailing list, soverflow, etc..) and was hoping you could provide any advice or pointers on how to ship system.data.sqlite with your version of sqlite3.

Danke schön, wenn du mir irgendwie helfen kannst!

PVS Studio warnings for rijndael.c

PVS reported these warnings for rijndael.c file:
rijndael.c 1103 warn V756 The 'i' counter is not used inside a nested loop. Consider inspecting usage of 'k' counter.
rijndael.c 1256 warn V756 The 'i' counter is not used inside a nested loop. Consider inspecting usage of 'k' counter.

Not sure how to fix this, but the loop does look strange (as if outer loop was meant to progress through multiple blocks but it does not do anything).
Could be false warning though.

BR,
Miroslav

GetExpandedSQL has a memory leak

Using GetExpandedSQL() on a wxSQLite3Statement causes a memory leak. Tracing into GetExExpandedSQL() takes us to a function in SQLite3, namely sqlite3_expanded_sql(). This function has the comment that The caller is responsible for freeing the returned string by passing it to sqlite3_free() on the returned pointer.

As GetExpandedSQL() converts the string returned to it into a wxString, wxString does it's own freeing of the memory, but it certainly doesn't know about, or call, sqlite3_free().

This causes a memory leak. If this is by design, the documentation for GetExpandedSQL() should advise the user of the fact. If not, then here is a proposed fix of the code. It (by nessessity) removes the const from the call to sqlite3_expanded_sql(), then calls sqlite3_free() on the pointer after the wxString creation.

wxString wxSQLite3Statement::GetExpandedSQL() const
{
   wxString sqlString = wxEmptyString;

#if SQLITE_VERSION_NUMBER >= 3014000

   CheckStmt();
   /*const*/ char* sqlLocal = sqlite3_expanded_sql(m_stmt->m_stmt);
   if (sqlLocal != NULL) sqlString = wxString::FromUTF8(sqlLocal);
   sqlite3_free(sqlLocal);  /* NEW CODE */

#endif
   return sqlString;
}

(also in wxString wxSQLite3ResultSet::GetExpandedSQL() const)

Compiling wxsqlite3-4.4.3

Errors in the wxsqlite3.cpp file compiled with TDM-GCC-64 and wxWidgets-3.1.2.
Is TDM-GCC-64 compatible?
regards,
Sala Carlo

How to compile for Android use?

How to compile for Android use? Not through Cocos2dx framework to use, direct jni call method to make the encrypted database into a decrypted database? Ask for help, Thanks.

rekey doesn't seem to work

Hi,
I'm trying to use this software to be able to us encryption for sqlite databases.
I'm trying to use database encryption with QT. I made it build already (at least the sqlite part + encryption). The wxWidgets stuff I don't really need.
So here is my problem.
Whenever I use rekey it fails to change the key.

        int rc = sqlite3_open_v2("test.sql", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);

        if( rc ){
            qInfo() << "Can't open database";
            return;
        }else{
            qInfo() << "Opened database successfully ";
        }

        string pw = "blabla";
        if (!isDbEncrypted(db))
        {
            sqlite3_key(db, "", 0);
            sqlite3_rekey(db, pw.data(), pw.length());
            qInfo() << "Database was encrypted.";
        }
        else
        {
            sqlite3_key(db, pw.data(), pw.length());
            sqlite3_rekey(db, "", 0);
            qInfo() << "Database was decrypted.";
        }

        sqlite3_close(db);

I simply open a database. If it is not encrypted it will be encrypted and if it is already encrpted it will be decrypted. At least this is how it should be but it is not. If a new unencrypted DB is created it works fine but if I load the DB again after the encrption I get an error that the DB is corrupted or encrypted e´ven though I set the correct password with sqlite3_key(...).
I don't really get it. Am I missing something?

warning: passing 'const char *' to parameter of type 'const unsigned char *' converts between pointers to integer types with different sign

sqlite3secure/src/codec.c:
Line 961:
const unsigned char* zRaw = (const unsigned char*) userPassword + 4;
Line:2290
const char* salt = (const char*) wxsqlite3_codec_data(db, nameParam2, "cipher_salt");

sqlite3secure/src/codecext.c
Line 236:
if ((cipherSalt != NULL) && (strlen((const char*)cipherSalt) >= 2 * KEYSALT_LENGTH) && IsHexKey(cipherSalt, 2 * KEYSALT_LENGTH))

Config interface: global parameter table

It seems unclear to me how to use the global parameter table for wxsqlite3_config() and wxsqlite3_config_cipher(). From the documentation:

sqlite3* db, /* Database instance (use NULL for global parameter table) */

However, if db == NULL, then wxsqlite3_config() and wxsqlite3_config_cipher() won't allow setting a new value at all: codec.c line 1791 and line 1863

Is the global parameter table intended to be read-only, or do I just simply get this wrong? The documentation states that I should be able to write it:

It is recommended to manipulate the global parameter tables only before opening any database connection.

Feature request: Support for selecting different encryption schemes at runtime

Currently work is in progress to overhaul the SQLite encryption extension coming with wxSQLite3.

At the moment it is necessary to decide at compile time which encryption scheme - AES 128-bit or AES 256-bit - should be used. It is planned to allow the selection of the encryption scheme at runtime in the future. And this will be the technical basis to be able to support additional encryption schemes (like sqleet or even SQLCipher (see issue #6)) ) later on.

The problem I'm currently struggling with is how to allow changing the encryption scheme and setting configuration parameters for the schemes.

For example, SQLCipher adds a bunch of PRAGMA statements to accomplish this. However, this requires to modify the SQLite3 source code. As a consequence upgrading to a new SQLite3 version demands a much bigger effort than just dropping in a new SQLite amalgamation (as is the case for wxSQLite3). Therefore I definitely want to avoid modifications to the SQLite3 source code.

Unfortunately, SQLite has no means to intercept the handling of PRAGMA statements. An alternative could be to define a SQLite user-defined function (UDF) for configuring the default encryption scheme and scheme parameters. The syntax would be something like

SELECT wxsqlite3_config('parameter-name', 'parameter-value'); -- Setting a parameter
SELECT wxsqlite3_config('parameter-name');                    -- Querying a parameter

The syntax is not as intuitive as a PRAGMA statement, but this method can be implemented without touching the SQLite3 source code.

In the official SQLite Encryption Extension (SEE) a different encryption scheme can be selected using a prefix to the encryption key. However, IMHO this becomes cumbersome, if one wants to pass not only the scheme name, but scheme parameters as well.

For a while, I considered to use extra parameters to a database file URI, but this would solve the issue only for opening a database (by intercepting the call to sqlite3_open - what the wxSQLite3 encryption extension does anyway). However, this trick would not work for attached databases.

Finally, it would be possible to add one or more functions for this purpose to the SQLite C Interface.

Feedback from the community would be very welcome.

Errors while build (MSVC10, Release, x64)

Hello Mr. Telle,

the _UNICODE macro seems not to modify the wxw library file name:
1>LINK : fatal error LNK1181: cannot open input file 'wxbase31.lib'
As a workaround I renamed the wxShortVersionString from the property page from "31" to "31u".
Now a source seems to be missing:
1>LINK : fatal error LNK1181: cannot open input file 'wxregex.lib'

Kindly regards,
Andreas Martin

License of linking object files .o into another language (not using .dll)

Hi,
I have a commercial application using your library. I use this because it has encryption support.
Instead of using the .dll, I want to incorporate the .o files into my application (I'm using Free Pascal).

But I need to know if not using the .dll and just using the .o files is legal for a commercial application.

Thanks.

Debug mode if SQLite

What about having SQLite in debug mode?

For this sqlite3secure.c needs to be compiled with -DSQLITE_DEBUG something like

set COMMON_FLAGS=--shared -Os -I. -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DHAVE_USLEEP -DHAVE_READLINE -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_HAS_CODEC=1 -DCODEC_TYPE=CODEC_TYPE_AES256 -DSQLITE_CORE -DTHREADSAFE=1 -DSQLITE_DLL=1 -DSQLITE_SECURE_DELETE -DSQLITE_SOUNDEX

gcc %COMMON_FLAGS% sqlite3secure.c -o sqlite3.dll
gcc %COMMON_FLAGS% -DSQLITE_DEBUG sqlite3secure.c -o sqlite3d.dll

and then in makefile.gcc

ifeq ($(USE_DYNAMIC_SQLITE3_LOAD),0)
	ifeq ($(WX_DEBUG),0)
		__SQLITE3_DEP_p = -lsqlite3
	endif
	ifeq ($(WX_DEBUG),1)
		__SQLITE3_DEP_p = -lsqlite3d
	endif
endif

Does it make sense?

pkg-config file not being populated

seems strange to find a pkg-config template file in the stream but not have that file populated for install.

My experience with other packages, *.pc.in files are processed to become *.pc and available for install.
This is not done here.

Does this works with windows 8 store apps?

Hi Team,

We are using "wxSQLite.WinRT81" SDK,Version="3.8.7.2" as of now. We wanted to update the SQLite version.

But we coun't find the Visual Studio Extension. Can we use this "wxSQLite3" libs in my app.

I am confused with wxSQLite and "wxSQLite3". Is there any difference?

includedir cannot be controlled properly

This is because bakefile (the build system) is a horrible mess. And makes random assumptions about what I want.

But we need that because otherwise the pkgconfig file line https://github.com/utelle/wxsqlite3/blob/master/wxsqlite3.pc.in#L5 doesn't work anyway.

E.g. in that codeblock it does

@COND_SHARED_0@install_wxsqlite3_lib_headers: 
@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)
@COND_SHARED_0@ for f in $(WXSQLITE3_LIB_HEADERS); do \
@COND_SHARED_0@ if test ! -d $(DESTDIR)$(prefix)/`dirname $$f` ; then \
@COND_SHARED_0@ $(INSTALL_DIR) $(DESTDIR)$(prefix)/`dirname $$f`; \
@COND_SHARED_0@ fi; \
@COND_SHARED_0@ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(prefix)/$$f; \
@COND_SHARED_0@ done

Which means the source dir path gets mangled into the destination path because of dirname. bakefile supports the $(INCLUDEDIR) setting though, which can be used instead of $(PREFIX). However, you can still not control the directory properly because include/wx is always hardcoded because of that stupid dirname call above which is generated code.

So I just made a symlink wx to fix that. It also seems that the bakefile version used here is not maintained anymore, so I'm not going to try to fix that.

Here's the patch

diff --git a/build/wxsqlite3.bkl b/build/wxsqlite3.bkl
index 7d0f380..92d4b94 100644
--- a/build/wxsqlite3.bkl
+++ b/build/wxsqlite3.bkl
@@ -22,10 +22,10 @@

   <!-- COMP_HDR lists the component's headers with path relative to ../include -->
   <set var="COMP_HDR">
-    include/wx/wxsqlite3def.h
-   include/wx/wxsqlite3.h
-   include/wx/wxsqlite3dyn.h
-   include/wx/wxsqlite3opt.h
+    wx/wxsqlite3def.h
+   wx/wxsqlite3.h
+   wx/wxsqlite3dyn.h
+   wx/wxsqlite3opt.h
   </set>

   <set var="USE_DYNAMIC_SQLITE3_LOAD_DEFAULT">0</set>
diff --git a/wx b/wx
new file mode 120000
index 0000000..b00f3db
--- /dev/null
+++ b/wx
@@ -0,0 +1 @@
+include/wx
\ No newline at end of file
diff --git a/wxcode/bakefiles/presets/defaults.bkl b/wxcode/bakefiles/presets/defaults.bkl
index f653bad..37ab793 100644
--- a/wxcode/bakefiles/presets/defaults.bkl
+++ b/wxcode/bakefiles/presets/defaults.bkl
@@ -23,7 +23,7 @@
          you can set them once in these vars and wxcode-* templates will automatically
          use them. -->
     <set var="COMP_SRC" overwrite="0">$(fileList('src/*.c*'))</set>
-    <set var="COMP_HDR" overwrite="0">$(fileList('include/wx/*.h'))</set>
+    <set var="COMP_HDR" overwrite="0">$(fileList('wx/*.h'))</set>


     <!--    A simple variable used to understand if we are          -->
diff --git a/wxcode/bakefiles/presets/templates.bkl b/wxcode/bakefiles/presets/templates.bkl
index a18433f..d33cdf8 100644
--- a/wxcode/bakefiles/presets/templates.bkl
+++ b/wxcode/bakefiles/presets/templates.bkl
@@ -54,7 +54,7 @@

     <template id="wxcode-lib" template="wx-lib,wxlike,wxcode-basic">
         <install-to>$(LIBDIR)</install-to>
-        <install-headers-to>$(PREFIX)</install-headers-to>
+        <install-headers-to>$(INCLUDEDIR)</install-headers-to>

         <wxcode-dirname>$(SRCDIR)/lib</wxcode-dirname>
         <wxlike-libname prefix="wxcode">$(COMP_NAME)</wxlike-libname>
@@ -65,7 +65,7 @@

     <template id="wxcode-dll" template="wx,wxlike,wxcode-basic">
         <install-to>$(LIBDIR)</install-to>
-        <install-headers-to>$(PREFIX)</install-headers-to>
+        <install-headers-to>$(INCLUDEDIR)</install-headers-to>

         <wxlike-dirname>$(SRCDIR)/lib</wxlike-dirname>
         <wxlike-dllname prefix="wxcode">$(COMP_NAME)</wxlike-dllname>
-- 
2.8.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.