PDA

View Full Version : SQLite Library



Atomic_Sheep
27th July 2013, 11:53
Hi Guys,

Trying to get SQLite added into my project and having some trouble. I tried putting the sqlite3.dll file into the folder where all my header and source code is located and I've added the += sql into my .pro file as well as:

LIBS +=

1.) problem #1 is that for some reason it doesn't like file locations with spaces. I've tried both the / and \ slashes and I can't remember which way is the right way but in the past I've tried both till it worked (lazy I know) but anyway, that's not the problem, the problem is how do I get these .dll files off my desktop (that filepath doesnt have any spaces in it), I don't want to have a million files on my desktop.

2.) the second and much more important question is, having added the .dll file successfully with the compiler not complaining, I've tried adding the .def file into my file, but it doesn't pop up from the drop down list when I start typing #include sqlite3.def. I don't know if it's not appearing because of the .def file type, not sure of the implications of the different extensions. Should I be getting the source code and compiling a .dll?

ChrisW67
28th July 2013, 00:15
Trying to get SQLite added into my project and having some trouble. I tried putting the sqlite3.dll file into the folder where all my header and source code is located and I've added the += sql into my .pro file as well as:

LIBS +=
If you are using a downloaded binary distribution of the Qt libraries then Sqlite support is built in by default. You need to read the documentation and examples around database access.

If you have built your own Qt libraries and excluded Sqlite deliberately then you need to try again:
QSQLITE for SQLite (Version 3 and Above). Unless you explicitly tell Qt to use an external Sqlite library it uses an internal one and there is no Sqlite supplied DLL to deploy.


1.) problem #1 is that for some reason it doesn't like file locations with spaces. I've tried both the / and \ slashes and I can't remember which way is the right way but in the past I've tried both till it worked (lazy I know) but anyway, that's not the problem, the problem is how do I get these .dll files off my desktop (that filepath doesnt have any spaces in it), I don't want to have a million files on my desktop.

I fail to see what this has to do with Sqlite access from your program.

Guessing that "it" might be qmake then, like every other program, paths containing spaces need to be quoted. Windows expects backslashes. Qmake expects backslashes to be escaped so it is easier to use forward slashes consistently allowing qmake to convert it if needed.


LIBS += -L"C:/I have spaces/in my/path" -lfoo -lbar

If you do not want DLLs on your desktop then do not put them there.


2.) the second and much more important question is, having added the .dll file successfully with the compiler not complaining, I've tried adding the .def file into my file, but it doesn't pop up from the drop down list when I start typing #include sqlite3.def. I don't know if it's not appearing because of the .def file type, not sure of the implications of the different extensions. Should I be getting the source code and compiling a .dll?
Of course not... it is not a C++ header file.

See the first part of this response.

Atomic_Sheep
30th July 2013, 09:36
Thanks, very useful links. Exactly what I was looking for.

EDIT: Have a question regarding the location of the .db file. I don't see any mention of database file locations in the documentations. When I try to open my database it comes up with the error "unable to open database file Error opening database". Where is the default location that the .db file should be stored in and how do I change this default location?