Problem in wxsqlite3 whit encrypt support.

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
avico
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Aug 10, 2009 8:58 am

Problem in wxsqlite3 whit encrypt support.

Post by avico »

Hi forum.

I test the latest code for wxsqlite3 with encrypt support and have problems.

Initially, without encrypt support, add the files wxsqlite3,cpp, wxsqlite3.h, wxsqlite3def.h, wxsqlite3dyn.h, wxsqlite3opt.h and the files from sqlite-amalgamation (sqlite3.c, sqlite3.h and sqlite3ext.h) to my project (in dialogblocks and mingw compiler) and compile without problems.

I test encrypt support and have problems. For this i add all files from svn code of wxsqlite3 (/sqlite3/secure/src/codec-c dir: codec.c, codec.h, codecext.c, ... sqlite3secure.c), modify wxsqlite3opt.h

#define WXSQLITE3_HAVE_CODEC 1

and modify sqlite3.h

#define SQLITE_HAS_CODEC
#define CODEC_TYPE=CODEC_TYPE_AES128

If compile, have errors:

*** cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
*** In file included from codec.c:40:
*** codec.h:65: error: syntax error before "Btree"
*** codec.h:65: warning: no semicolon at end of struct or union
*** codec.h:66: error: `SQLITE_MAX_PAGE_SIZE' undeclared here (not in a function)
*** codec.h:67: error: syntax error before '}' token
*** codec.h:67: warning: type defaults to `int' in declaration of `Codec'
*** codec.h:67: warning: data definition has no type or storage class
*** codec.h:69: error: syntax error before '*' token

......

*** codec.c: At top level:
*** codec.h:66: error: storage size of `m_page' isn't known
*** mingw32-make.exe: *** [MinGWRelease/codec.o] Error 1
Done.

135 errors, 14 warnings


line 65 of codec.h as a Btree declaration in Codec structure definition and all lines with "codec" as error.

I have tested libs included in /sqlite3/secure/aes128 linking my code (without files from /sqlite3/secure/src/codec-c dir and without sqlite3.c) to sqlite.a and execute with sqlite3.dll and sqlite3.def in the same directory of program executable and work fine.

A idea?
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: Problem in wxsqlite3 whit encrypt support.

Post by utelle »

avico wrote:I test the latest code for wxsqlite3 with encrypt support and have problems.

Initially, without encrypt support, add the files wxsqlite3,cpp, wxsqlite3.h, wxsqlite3def.h, wxsqlite3dyn.h, wxsqlite3opt.h and the files from sqlite-amalgamation (sqlite3.c, sqlite3.h and sqlite3ext.h) to my project (in dialogblocks and mingw compiler) and compile without problems.
Although this seems to work for you, you should keep in mind that wxSQLite3 is written in C++ while SQLite is written in C. You have to make sure, your compiler compiles SQLite in C mode. Otherwise it's very likely to get compile errors.
avico wrote:I test encrypt support and have problems. For this i add all files from svn code of wxsqlite3 (/sqlite3/secure/src/codec-c dir: codec.c, codec.h, codecext.c, ... sqlite3secure.c), modify wxsqlite3opt.h
For building SQLite with encryption support the only file you have to add to your project is sqlite3secure.c. This file includes all other required source files. Adding one or more of the other files almost certainly gives you compile and/or link errors.

You should consider to build wxSQLite3 and SQLite separately.

The forum thread http://forums.wxwidgets.org/viewtopic.php?t=27217 gives you further instructions how to compile SQLite with encryption support.
avico wrote:If compile, have errors:

*** cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
As said above SQLite is written in C but you have specified C++ compiler options.
avico wrote:*** In file included from codec.c:40:
*** codec.h:65: error: syntax error before "Btree"
*** codec.h:65: warning: no semicolon at end of struct or union
*** codec.h:66: error: `SQLITE_MAX_PAGE_SIZE' undeclared here (not in a function)
*** codec.h:67: error: syntax error before '}' token
*** codec.h:67: warning: type defaults to `int' in declaration of `Codec'
*** codec.h:67: warning: data definition has no type or storage class
*** codec.h:69: error: syntax error before '*' token

......
As said above add only sqlite3secure.c to your project and the compile should then work without problems.

Regards,

Ulrich
Post Reply