wxSQLite3 v1.0

Do you like to promote your wxWidgets based application or component!? Post it here and let's see what the critics have to say. Also, if you found that ONE wx component the world needs to know about, put it here for future reference.
Post Reply
utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

wxSQLite3 v1.0

Post by utelle » Wed Jul 20, 2005 7:15 am

wxSQLite3 is a C++ wrapper around the public domain SQLite 3.x database and is specifically designed for use in programs based on the wxWidgetslibrary. wxSQLite3 has been tested with Unicode builds of wxWidgets on wxMSW, but should be usable on other builds and platforms as well (feedback welcome). wxSQLite3 is a component of wxCode and can be downloaded from there.

wxSQLite3 does not try to hide the underlying database, in contrary almost all special features of the current SQLite3 version 3.2.2 are supported, like for example the creation of user defined scalar or aggregate functions. Since SQLite stores strings in UTF-8 encoding, the wxSQLite3 methods provide automatic conversion between wxStrings and UTF-8 strings.

RealityMage
Experienced Solver
Experienced Solver
Posts: 75
Joined: Tue Aug 23, 2005 3:47 am

Post by RealityMage » Thu Sep 08, 2005 3:01 am

Under what license is this code?

utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle » Thu Sep 08, 2005 4:42 am

RealityMage wrote:Under what license is this code?
Under the wxWidgets aka wxWindows license.

Regards,
Ulrich

lrm
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Nov 20, 2004 9:12 pm
Location: San Jos

Post by lrm » Fri Oct 07, 2005 1:53 am

Very useful, thanks.

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Fri Oct 07, 2005 6:35 am

Hi!
It's indeed a very usefull class (modeled after CppSQLite3, right?).

One thing that could be added IHMO is handling SQLITE_SCHEMA errors. I use a sqlite db that is accessed by more then one application at the same time. This works perfectly fine, but will sometimes result in a SQLITE_SCHEMA error for queries if one app modified the db and the other is trying to access it. The slqite faq says that the "standard" way of handling this is to simply retry the query. In fact it works, the first query fails, the second succeeds. Currently I'm handling wxSQLite3Exexception and check for SCHEMA errors, then retry the query. Maybe this you be added to the lib, so that it automaticaly retries instead of throwing the exeception. Just a thought...
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Post by utelle » Fri Oct 07, 2005 3:37 pm

upCASE wrote:It's indeed a very usefull class (modeled after CppSQLite3, right?).
wxSQLite3 was inspired by three different C++ wrappers for SQLite: wxSQLite (which supports only SQLite 2.x), CppSQLite3 (which is not wxWidgets specific, i.e. no wxWidgets Unicode support), and the wxCode component databaselayer (which hides the underlying database and therefore does not support SQLite specific functionality. Additionally it doesn't support wxWidgets Unicode either).
upCASE wrote:One thing that could be added IHMO is handling SQLITE_SCHEMA errors. I use a sqlite db that is accessed by more then one application at the same time. This works perfectly fine, but will sometimes result in a SQLITE_SCHEMA error for queries if one app modified the db and the other is trying to access it. The slqite faq says that the "standard" way of handling this is to simply retry the query. In fact it works, the first query fails, the second succeeds. Currently I'm handling wxSQLite3Exexception and check for SCHEMA errors, then retry the query. Maybe this you be added to the lib, so that it automaticaly retries instead of throwing the exeception. Just a thought...
When I created wxSQLite3 I thought about handling SCHEMA errors, but decided against it, since handling SCHEMA errors is not at all trivial. For example which reaction is appropriate depends on the kind of the SQL statement:

For INSERT, UPDATE or DELETE a simple retry might be a good choice. But how often should the retry take place? The SQLite FAQ code example contains an endless loop! I don't want to introduce such kind of code into wxSQLite3.

In case of a SELECT statement the situation is still more complex. The SCHEMA error could happen after reading several result rows. If wxSQLite3 would then redo the query automatically it would start from scratch delivering the already read rows again. If your application code gathers the result set in an array for example you would get duplicate rows.

When retrying a query another problem arises if the SQL statement contains bind variables. You would have to rebind the variables. If wxSQLite3 should handle this automatically this would induce a lot of extra house keeping.

Therefore I think to handle SCHEMA errors in an appropriate way is easier for the application developer than for wxSQLite3.

Regards,

Ulrich

utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

wxSQLite3 1.1 released

Post by utelle » Fri Oct 07, 2005 3:51 pm

wxSQLite3 version 1.1 incorporates now the newest SQLite version 3.2.7. Additionally there is now a configure script for Unix builds, but support for wxWidgets Unix builds is still weak due to insufficiencies in the wxCode bakefiles. Therefore wxSQLite3 officially supports still only wxMSW, although it has been used successfully with wxGTK.

Regards,

Ulrich

lrm
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Nov 20, 2004 9:12 pm
Location: San Jos

Post by lrm » Sun Oct 09, 2005 4:12 pm

Hi,

wxSQLite3Table::GetAsString(const wxString columnName) seems that does not work. The internal use of the function wxSQLite3Table::FindColumnIndex seems that returns the total number of columns instead of the column index.

Thanks.

Ps. Sorry for my poor english.

utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

wxSQLite3 version 1.2

Post by utelle » Sun Oct 09, 2005 9:28 pm

lrm wrote:wxSQLite3Table::GetAsString(const wxString columnName) seems that does not work. The internal use of the function wxSQLite3Table::FindColumnIndex seems that returns the total number of columns instead of the column index.
You are right: wxSQLite3Table::FindColumnIndex returned the wrong index. I corrected the code and made a new file release.

The current wxSQLite3 version is now 1.2.

Thank you for reporting the bug.

Regards,

Ulrich

lrm
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Nov 20, 2004 9:12 pm
Location: San Jos

Post by lrm » Tue Nov 01, 2005 1:33 am

Hi Ulrich,

It seems that there is a problem in the function wxSQLite3ResultSet::GetInt64(int columnIndex, wxLongLong nullValue), returns an incorrect value.

In another matter, there is possibility to add GetInt64 functions to the class wxSQLite3Table?

Thanks


Ps. Sorry for my poor english.

utelle
Moderator
Moderator
Posts: 940
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

wxSQLite3 version 1.3.1

Post by utelle » Tue Nov 01, 2005 2:24 pm

lrm wrote:It seems that there is a problem in the function wxSQLite3ResultSet::GetInt64(int columnIndex, wxLongLong nullValue), returns an incorrect value.
Thank you for reporting this bug. It is now fixed.
lrm wrote:In another matter, there is possibility to add GetInt64 functions to the class wxSQLite3Table?
Sure. This method was missing since the wxString class does not provide a method ToLongLong. I created my own conversion function and added wxSQLite3Table::GetInt64.

The latest release is wxSQLite3 version 1.3.1.

Regards,

Ulrich

lrm
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Nov 20, 2004 9:12 pm
Location: San Jos

Post by lrm » Wed Nov 02, 2005 12:22 am

Thank you.

victorhj
In need of some credit
In need of some credit
Posts: 1
Joined: Thu Dec 15, 2005 11:00 am

Post by victorhj » Wed Feb 01, 2006 8:10 am

Thank you very much.

Post Reply