[Interest] Semi-OT: Pre-Compiled SQLite vs. building from source

K. Frank kfrank29.c at gmail.com
Sat May 19 14:22:32 CEST 2012


Hi David!

Thank you for pointing this out.

On Sat, May 19, 2012 at 1:34 AM, David Boosalis
<david.boosalis at gmail.com> wrote:
> Qt comes with SQLite, so unless you explicitly build it out you get it for
> free. I use Qt and SQLite on Windows using Visual Studio 2008, and have had
> no problem implementing SQLlite.  Just make sure you ship the SQL DLL as
> part of your code

Just to confirm:  If I used the "default" configuration when I built Qt (I
think I did), then I should have SQLite.  Correct?

So to use SQLite with Qt, I would not (normally) include "sqlite3.h"
nor directly make SQLite calls.  Rather, I would use the various
QSql classes.  True?

To get the ball rolling, I would call:

   QSqlDatabase myDb = QSqlDatabase::addDatabase ("QSQLITE");

(to use this as the default connection), and then call things like
myDb.setDatabaseName(...), myDb.open(), etc.  It's specifically
the use of "QSQLITE" for the database type in the addDatabase
call that tells Qt to use SQLite.  Correct?

Do I need to add anything to my .pro file, like

   CONFIG += sqlite

to make SQLite available to my application?

Am I right that Qt does not come with a command-line SQL shell?
So if I want to use one I should download the sqlite3.exe application
from SQLite.  True?

Thanks for helping me get set up with SQLite.


K. Frank


> ...
> On Fri, May 18, 2012 at 5:13 PM, K. Frank <kfrank29.c at gmail.com> wrote:
>>
>> Hello List!
>>
>> I'm fixing to use SQLite with Qt (and will surely have more questions in
>> the
>> future).  My first question:  What should I be downloading to get started?
>>
>> I am currently using Qt 4.8.0-rc1 compiled with 64-bit mingw-w64 on 64-bit
>> windows 7.  The SQLite site offers pre-compiled windows binaries, but I
>> can't tell what they're built with or what they should be compatible with.
>>
>> The core windows binary appears to be:
>>
>>  sqlite-dll-win32-x86-3071200.zip
>>
>> Am I right that the "x86" in the name means that it's 32-bit, and
>> therefore,
>> regardless of what compiler it was built with, will be incompatible with
>> my
>> 64-bit Qt installation?  If so, am I right that my most practical option
>> will
>> be to compile by own dll from source using the same 64-bit mingw-w64
>> compiler I used to build Qt?
>>
>> Separately, the SQLite site offers sqlite-shell-win32-x86-3071200.zip and
>> sqlite-analyzer-win32-x86-3071200.zip.  Am I right that these are
>> free-standing
>> programs that read (and write) the SQLite database files, and as such,
>> will
>> be compatible with my Qt installation, regardless of how they were
>> compiled?
>> (Although if I have to build the SQLite dll anyway, it would presumably be
>> no
>> big deal to build these two free-standing programs, as well.)
>>
>> And, of course, any other pointers for using SQLite with Qt would be
>> welcome.
>>
>> Thanks.
>>
>> K. Frank
>> ...



More information about the Interest mailing list