Database development with wxWidgets Topic is solved
Database development with wxWidgets
Hi All,
I'd like to know how developers are coping with database structuring (creating, deleting datas from tables) if they use wxWidgets? AFAIK there is only wxGrid component which is capable of showing the data in tabular form which is not data-aware I believe.
Your guidance will be appreciated.
I'd like to know how developers are coping with database structuring (creating, deleting datas from tables) if they use wxWidgets? AFAIK there is only wxGrid component which is capable of showing the data in tabular form which is not data-aware I believe.
Your guidance will be appreciated.
Re: Database development with wxWidgets
For read-only data, a virtual wxListCtrl works fine and probably requires the least amount of work.
wxDataViewCtrl can handle virtual data as well, but it's a PITA to use because you have to write much more code until you actually see something on screen.
Apart from that, yes, there is no class in wxWidgets that provides a convenient link between a database and another control to display/edit the data.
Contributions are welcome
wxDataViewCtrl can handle virtual data as well, but it's a PITA to use because you have to write much more code until you actually see something on screen.
Apart from that, yes, there is no class in wxWidgets that provides a convenient link between a database and another control to display/edit the data.
Contributions are welcome
Use the source, Luke!
Re: Database development with wxWidgets
Thanks for the feedback, it seems that the most succesful component library is wxSQLite which is currently up to date and has on going development, and seems that for the time being the most feasible choice. When I was searching the forum I even found that you are recommending that wxSQLite, is it still valid?
To have that wxSQLite, to work with wxWidgets do we need the same version of wxWidgets and wxSQLite together? For example I have 2.8.12 version on wxWidgets compiled succesfully, but I'm dubious that it will work with wxSQLite3 ?
P.S. Is there any way to know the last succeful build of wxWidgets with which command was executed (e.g. whether it was monolithic, shared, unicode etc..)? I'm hoping that it was implicitly outputed somehere in the build directories.
Regards,
To have that wxSQLite, to work with wxWidgets do we need the same version of wxWidgets and wxSQLite together? For example I have 2.8.12 version on wxWidgets compiled succesfully, but I'm dubious that it will work with wxSQLite3 ?
P.S. Is there any way to know the last succeful build of wxWidgets with which command was executed (e.g. whether it was monolithic, shared, unicode etc..)? I'm hoping that it was implicitly outputed somehere in the build directories.
Regards,
Re: Database development with wxWidgets
If you have control over the database you can use and if you only need a local database, wxSQLite is definitely a good choice. It's well designed and actively developed. The only thing i don't like about it, is its excessive use of exceptions, but that's a matter of personal taste.it seems that the most succesful component library is wxSQLite which is currently up to date and has on going development, and seems that for the time being the most feasible choice. When I was searching the forum I even found that you are recommending that wxSQLite, is it still valid?
I haven't tried it lately, but i'm almost certain that wxSQLite works with wx 2.8.12. However, as wx 2.8.12 is already several years old, i highly recommend to use the latest 3.x.To have that wxSQLite, to work with wxWidgets do we need the same version of wxWidgets and wxSQLite together? For example I have 2.8.12 version on wxWidgets compiled succesfully, but I'm dubious that it will work with wxSQLite3 ?
Just by looking at the library names it should be possible to determine shared/static unicode/ansi etc, but i don't know about other configuration options.P.S. Is there any way to know the last succeful build of wxWidgets with which command was executed (e.g. whether it was monolithic, shared, unicode etc..)? I'm hoping that it was implicitly outputed somehere in the build directories.
Use the source, Luke!
Re: Database development with wxWidgets
AFAIK for GCC you can search for build.cfg in lib/ subfolders.
Re: Database development with wxWidgets
Thank You All in advance,
I've SQLite3 3.2.1, I configured the WX_DIR and other variables(UNICODE=0, SHARED=0) in makfile.gcc of SQLite tried to execute makefile and that resulted in the following errors, could that be because of makefile execution for SQLite3 is not performed with same parameters as with wxWidgets?
Here and there I came across in the forum that there is no need to build SQLite from scratch because it's comprised from one source files, only requirement is to add that source file and add headers.
Your help will be appreciated,
Yes that is correct.catalin wrote:AFAIK for GCC you can search for build.cfg in lib/ subfolders.
I've SQLite3 3.2.1, I configured the WX_DIR and other variables(UNICODE=0, SHARED=0) in makfile.gcc of SQLite tried to execute makefile and that resulted in the following errors, could that be because of makefile execution for SQLite3 is not performed with same parameters as with wxWidgets?
Here and there I came across in the forum that there is no need to build SQLite from scratch because it's comprised from one source files, only requirement is to add that source file and add headers.
Your help will be appreciated,
Code: Select all
-------------------ERROR-----------------
C:\Users\....\Downloads\wxsqlite3-3.2.1\build>mingw32-make -f makefile.gcc
----------------------------------------------------------------------------
The selected wxWidgets build is not available!
Please use the options prefixed with WX_ to select another wxWidgets build.
----------------------------------------------------------------------------
mingw32-make: *** [test_for_selected_wxbuild] Error 1
Re: Database development with wxWidgets
That's what i always do.Here and there I came across in the forum that there is no need to build SQLite from scratch because it's comprised from one source files, only requirement is to add that source file and add headers.
You'll need the sqlite amalgamation files, which is basically the whole sqlite sources merged into one single C file.
https://www.sqlite.org/download.html
List of all files you need in the end:
sqlite3.c
sqlite3.h
sqlite3ext.h
wxsqlite3.cpp
wxsqlite3.h
wxsqlite3def.h
wxsqlite3dyn.h
wxsqlite3opt.h
Use the source, Luke!
Re: Database development with wxWidgets
Will I need library files (sqlite3.a etc ...) or is it totally avoided with that techique?
Re: Database development with wxWidgets
No external libraries required, that's the point.
Use the source, Luke!
Re: Database development with wxWidgets
Hi doublemax again,
No matter how hard I try, I couldn't succeed to run the example code for SQLite even though that I have all those previously listed files and added them into search folder and header file location.
Can you summarize teh steps that I need go through with SQLite amalgamation package to run the following code?
No matter how hard I try, I couldn't succeed to run the example code for SQLite even though that I have all those previously listed files and added them into search folder and header file location.
Can you summarize teh steps that I need go through with SQLite amalgamation package to run the following code?
Code: Select all
#include <iostream>
using namespace std;
#include <sqlite3.h>
int main ()
{
int rc;
sqlite3 *db;
char *zErrMsg = 0;
rc = sqlite3_open( "DBm", & db);
if (rc)
{
cout << "faileure to open database ";
cout << endl;
}
}
Re: Database development with wxWidgets
Sorry, i don't know how to use sqlite directly, i only use it through wxSQlite3. Try the sample that comes with wxSQlite3.
Use the source, Luke!
Re: Database development with wxWidgets
Usage of SQLite is really out of question here, the code is for demonstration purposes. What I want to achieve is minimalisticially connect wxSQLite3 in C++ program.
I think that I'm confusing 2 libraries, which one to add as source and headers for SQLite amalgamation or wxSQLite files, I need guidance on that.
Regards,
I think that I'm confusing 2 libraries, which one to add as source and headers for SQLite amalgamation or wxSQLite files, I need guidance on that.
Regards,
Re: Database development with wxWidgets
wxSQLite3 is just a wrapper for sqlite, you need both. Just add wxsqlite3.cpp and sqlite.c to your project and make sure the header files can be found.
Minimal code how to connect to/create a database through wxSQLite3 can be found in minimal.cpp that comes with wxSQLite3.
Minimal code how to connect to/create a database through wxSQLite3 can be found in minimal.cpp that comes with wxSQLite3.
So what exactly happens, compiler error, linker error, runtime error, does nothing?No matter how hard I try, I couldn't succeed to run the example code for SQLite even though that I have all those previously listed files and added them into search folder and header file location.
Use the source, Luke!
Re: Database development with wxWidgets
I do exactly as you say, add the wxsqlite3.cpp and sqlite.c in project and specify the headers then following errors are produced.doublemax wrote:So what exactly happens, compiler error, linker error, runtime error, does nothing?
Code: Select all
||=== Build: Debug in SQLLite_Test (compiler: GNU GCC Compiler) ===|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void strftimeFunc(sqlite3_context*, int, sqlite3_value**)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16354|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void sqlite3RegisterDateTimeFunctions()':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|16538|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void* sqlite3MemMalloc(int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|17232|error: invalid conversion from 'void*' to 'sqlite3_int64* {aka long long int*}' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void* sqlite3MemRealloc(void*, int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|17304|error: invalid conversion from 'void*' to 'sqlite3_int64* {aka long long int*}' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'sqlite3_mutex* winMutexAlloc(int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|20419|error: invalid conversion from 'void*' to 'sqlite3_mutex*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'char* sqlite3DbStrDup(sqlite3*, const char*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21355|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'char* sqlite3DbStrNDup(sqlite3*, const char*, u64)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21367|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void sqlite3VXPrintf(StrAccum*, u32, const char*, va_list)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21817|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21881|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21896|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21898|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21900|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|21933|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22055|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22080|error: invalid conversion from 'const char*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22088|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22123|error: cannot convert 'SrcList::SrcList_item*' to 'SrcList_item*' in initialization|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22126|error: invalid use of incomplete type 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|13252|error: forward declaration of 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22127|error: invalid use of incomplete type 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|13252|error: forward declaration of 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22130|error: invalid use of incomplete type 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|13252|error: forward declaration of 'struct SrcList_item'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'int sqlite3StrAccumEnlarge(StrAccum*, int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22192|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22194|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'char* sqlite3StrAccumFinish(StrAccum*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22272|error: invalid conversion from 'void*' to 'char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void sqlite3_randomness(int, void*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|22954|error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'int sqlite3ThreadCreate(SQLiteThread**, void* (*)(void*), void*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|23206|error: invalid conversion from 'void*' to 'SQLiteThread*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'int sqlite3VdbeMemTranslate(Mem*, u8)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|23594|error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'char* sqlite3Utf16to8(sqlite3*, const void*, int, u8)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|23761|error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|15003|error: initializing argument 2 of 'int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void (*)(void*))' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'int sqlite3Utf16ByteLen(const void*, int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|23780|error: invalid conversion from 'const void*' to 'const unsigned char*' [-fpermissive]|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void insertElement(Hash*, _ht*, HashElem*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25326|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25326|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25327|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25328|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'int rehash(Hash*, unsigned int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25358|error: invalid application of 'sizeof' to incomplete type '_ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25359|error: invalid application of 'sizeof' to incomplete type '_ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25373|error: invalid application of 'sizeof' to incomplete type '_ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25378|error: cannot convert '_ht*' to 'Hash::_ht*' in assignment|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25379|error: invalid application of 'sizeof' to incomplete type '_ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25380|error: invalid application of 'sizeof' to incomplete type '_ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25384|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'HashElem* findElementWithHash(const Hash*, const char*, unsigned int*)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25405|error: cannot convert 'Hash::_ht*' to '_ht*' in assignment|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25406|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25407|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c||In function 'void removeElementGivenHash(Hash*, HashElem*, unsigned int)':|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25442|error: cannot convert 'Hash::_ht*' to '_ht*' in assignment|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25443|error: invalid use of incomplete type 'struct _ht'|
C:\...\sqlite-amalgamation-201507021816\sqlite3.c|25321|error: forward declaration of 'struct _ht'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 13 warning(s) (0 minute(s), 3 second(s)) ===|
Re: Database development with wxWidgets
I don't use Mingw/GCC, but maybe you must compile this as C instead of C++ file? If that's not it, i have no idea.
Use the source, Luke!