Anybody know a good C++ wrapper for sqlite?
Anybody know a good C++ wrapper for sqlite?
I am currently working on a database program for my movies.
I have decided to at least try to use the sqlite db.
However, I want to use a c++ wrapper for it.
Do you guys know of a good one, that's fairly easy to use?
Thanks
/Wridmuld
I have decided to at least try to use the sqlite db.
However, I want to use a c++ wrapper for it.
Do you guys know of a good one, that's fairly easy to use?
Thanks
/Wridmuld
-
- Can't get richer than this
- Posts: 864
- Joined: Thu Jul 28, 2005 9:48 pm
- Location: New Forest, United Kingdom
- Contact:
wxsqlite
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
The SQLite Wiki has a page on C++ wrappers at http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers
Supporting the latest SQLite3 library, wxSQLite3 is available at http://wxcode.sourceforge.net/components/wxsqlite3/ and provides access to all of the functionality available in SQLite.
Another wxWidgets inferface to SQLite3 is DatabaseLayer at http://wxcode.sourceforge.net/components/databaselayer/ which provides a subset of the functionality to support queries, transactions, and prepared statements.
There are many other C++ wrappers listed on the Wiki page mentioned above that are not wxWidgets specific but may work well for you.
Supporting the latest SQLite3 library, wxSQLite3 is available at http://wxcode.sourceforge.net/components/wxsqlite3/ and provides access to all of the functionality available in SQLite.
Another wxWidgets inferface to SQLite3 is DatabaseLayer at http://wxcode.sourceforge.net/components/databaselayer/ which provides a subset of the functionality to support queries, transactions, and prepared statements.
There are many other C++ wrappers listed on the Wiki page mentioned above that are not wxWidgets specific but may work well for you.
-
- Filthy Rich wx Solver
- Posts: 210
- Joined: Sat May 07, 2005 8:24 pm
- Location: Eskisehir, TURKEY
- Contact:
You are right.bigpilot wrote:I'm using SQLite without a wrapper and that works just fine. I recommend it.
- T U R K E Y ?
- I love this country!
WebSites:
http://mebt.sourceforge.net/
http://wxquran.sourceforge.net/
- I love this country!
WebSites:
http://mebt.sourceforge.net/
http://wxquran.sourceforge.net/
-
- Earned some good credits
- Posts: 146
- Joined: Sun Nov 26, 2006 7:37 am
- Location: Tennessee, USA
- Contact:
Out of curiosity, if you are using a C++ to create your wxWidgets program how do you just use the SQLite without a wrapper? (SQLite is written in C)bigpilot wrote:I'm using SQLite without a wrapper and that works just fine. I recommend it.
I am not very good with the C vs C++ issues. I can use them each by themselves, and at a novice level on both.
I have created a plugin using SQLite for a scripting language that I use a lot on MS Windows, I just used C as it was already written in C.
I do apologize for hijacking the thread as it may seem, but I think this information would be useful to know for those of us that dont know very well how to go about it.
JS
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
There's nothing to it. Just link to your C library and call the functions. To get around the few incompatibilities you can use the following when including the headerJSThePatriot wrote:if you are using a C++ to create your wxWidgets program how do you just use the SQLite without a wrapper? (SQLite is written in C)
Code: Select all
extern "C"
{
#include "MyCHeader.h"
}
Also, here's an article on this:
http://www.parashift.com/c++-faq-lite/m ... d-cpp.html
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
I see many reasons.vdell wrote:I would also give my voice for wxSqlite3. I don't see any reasons for using the raw C Api in a C++ app.
The first is: using the SQLite API directly isn't harder than with a wrapper. In fact, I would say it's downright easy.
The only trick you need to know is how handle the callbacks in C++ (hint: pass the 'this' pointer to the callback routine parameter and in the callback function cast the pointer to the C++ class).
Soon to be world famous
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
Wll, here are my 2 cents:
- wxSQLite3 has problems with ANSI build of wxWidgets. It works perfectly with UNICODE build but I got linker errors with ANSI build. And that was one of several main reasons why I decided to use wxDatabaseLayer in my projects.
- wxDatabaseLayer seems to be good replacement for wxSQLite3 because it provides common API for several SQL servers (e.g. I'm planning to upgrade my project to Firebird 2.0 from SQLite3 and it seems that I will be able to do this with minimum efforts)
- Certainly wxSQLite3 is also god enough but it is suitable for very small projects. (IMHO)
(the same situation I had with wxMySQL library which I developed some time ago. Now I'm using wxDatabaseLayer in most of my projects)
- Also I found one more SQLite3 wrapper in mailing lists of russian shareware developers ( http://softvoile.com/development/CppSQLite3U/ ). You can try it, maybe it will fit your needs.
Regards,
T-Rex
- wxSQLite3 has problems with ANSI build of wxWidgets. It works perfectly with UNICODE build but I got linker errors with ANSI build. And that was one of several main reasons why I decided to use wxDatabaseLayer in my projects.
- wxDatabaseLayer seems to be good replacement for wxSQLite3 because it provides common API for several SQL servers (e.g. I'm planning to upgrade my project to Firebird 2.0 from SQLite3 and it seems that I will be able to do this with minimum efforts)
- Certainly wxSQLite3 is also god enough but it is suitable for very small projects. (IMHO)
(the same situation I had with wxMySQL library which I developed some time ago. Now I'm using wxDatabaseLayer in most of my projects)
- Also I found one more SQLite3 wrapper in mailing lists of russian shareware developers ( http://softvoile.com/development/CppSQLite3U/ ). You can try it, maybe it will fit your needs.
Regards,
T-Rex
Let me know which problems you experience in ANSI build and I'll take a look into them. If no one is giving feedback to me as the author of wxSQLite3, how would you expect wxSQLite3 to get better?T-Rex wrote:- wxSQLite3 has problems with ANSI build of wxWidgets. It works perfectly with UNICODE build but I got linker errors with ANSI build.
Most problems in ANSI builds arouse from the fact that many ANSI mode users and external SQLite tools don't care about converting strings to be stored in the database to UTF-8, but doing that is the only guarantee that the resulting database file is really portable between different platforms and applications. Unfortunately SQLite itself does not enforce Unicode encoding. But wxSQLite3 does.
Well, wxSQLite3 is suitable for projects which are stand alone and for which SQLite3 itself offers enough features and which are not meant or planned to be ported to client/server databases. Such projects aren't neccessarily "very small".T-Rex wrote:- Certainly wxSQLite3 is also god enough but it is suitable for very small projects. (IMHO)
wxDatabaseLayer is a very good option if there is a significant chance that a project needs to support different database back ends. In respect to SQLite it has the draw back that it supports only a subset of SQLite's features.T-Rex wrote:(the same situation I had with wxMySQL library which I developed some time ago. Now I'm using wxDatabaseLayer in most of my projects)
I really don't see why that wrapper should be a better choice than wxSQLite3 since it is not well integrated into the wxWidgets world, in contrast to wxSQLite3. But as a matter of course everybody is free to use whichever wrapper he or she likes. As stated in prior posts there are quite a few C++ wrappers for SQLite, and every wrapper has its advantages and disadvantages. wxSQLite3 is certainly no exception.T-Rex wrote:- Also I found one more SQLite3 wrapper in mailing lists of russian shareware developers (http://softvoile.com/development/CppSQLite3U/ ). You can try it, maybe it will fit your needs.
Regards,
Ulrich
-
- Earned some good credits
- Posts: 146
- Joined: Sun Nov 26, 2006 7:37 am
- Location: Tennessee, USA
- Contact:
My reason for wanting to use the SQLite API directly is for a couple of reasons.
1. I am already familiar with the API as I am creating a SQLite Plugin for AutoIt.
2. I feel that if there is no need to add extra code to get the same thing done, then not only is your executable going to be smaller, but in time probably faster on larger functions.
I do appreciate the reasons and arguments on both sides. I had forgotten about extern "C" { } thanks.
JS
1. I am already familiar with the API as I am creating a SQLite Plugin for AutoIt.
2. I feel that if there is no need to add extra code to get the same thing done, then not only is your executable going to be smaller, but in time probably faster on larger functions.
I do appreciate the reasons and arguments on both sides. I had forgotten about extern "C" { } thanks.
JS
- T-Rex
- Moderator
- Posts: 1248
- Joined: Sat Oct 23, 2004 9:58 am
- Location: Zaporizhzhya, Ukraine
- Contact:
I didn't say that it should be better. I just said that it may be suitable. I don't suggest to refuse use of wxSQLite3, just show another option.I really don't see why that wrapper should be a better choice than wxSQLite3 since it is not well integrated into the wxWidgets world, in contrast to wxSQLite3. But as a matter of course everybody is free to use whichever wrapper he or she likes. As stated in prior posts there are quite a few C++ wrappers for SQLite, and every wrapper has its advantages and disadvantages. wxSQLite3 is certainly no exception.
Certainly it is better to use wxWidgets-based wrapper if the whole GUI and core of the project is written with wxWidgets.
OK, I'll try to reproduce those errors which I had when using wxSQLite3 and then will let you know.Let me know which problems you experience in ANSI build and I'll take a look into them. If no one is giving feedback to me as the author of wxSQLite3, how would you expect wxSQLite3 to get better?
Isn't most of this forum about wxWidgets-based programming?T-Rex wrote: I didn't say that it should be better. I just said that it may be suitable. I don't suggest to refuse use of wxSQLite3, just show another option.
Certainly it is better to use wxWidgets-based wrapper if the whole GUI and core of the project is written with wxWidgets.
For my own programs I use the database component best suited for the purpose of the application, sometimes wxSQLite3, sometimes wxDatabaselayer, sometimes native database interfaces. So I totally agree that everybody else should make his decision based on his own needs.
But if wxSQLite3 is used I certainly would like to know whether there are problems or missing features.
Thanks.T-Rex wrote:OK, I'll try to reproduce those errors which I had when using wxSQLite3 and then will let you know.
Regards,
Ulrich
-
- Ultimate wxWidgets Guru
- Posts: 536
- Joined: Fri Jan 07, 2005 3:44 pm
- Location: Finland
- Contact:
Maybe, but I find it more easier to use C++ code in a C++ application since after all, C and C++ are completely different languages and I only know the second one. Of course the API could be easier to use for some (like for a person with a C background) but when using C directly the user is responsible for many things (like memory de/allocation) which the wrapper could take care of "under the hood".bigpilot wrote:I see many reasons.vdell wrote:I would also give my voice for wxSqlite3. I don't see any reasons for using the raw C Api in a C++ app.
The first is: using the SQLite API directly isn't harder than with a wrapper. In fact, I would say it's downright easy.
It's also usually the case that class wrappers only create a very thin wrapper around the C code so if I really need to use the C Api then I can do so and still benefit from the features of the wrapper class. I would also say that the learning curve for such thin wrappers is very low (assuming that the class is well documented).
Visual C++ 9.0 / Windows XP Pro SP3 / wxWidgets 2.9.0 (SVN) | Colligere