Basic qt with mysql?
-
wrote on 10 Oct 2010, 11:30 last edited by
Yes. And in case of one db without name (i.e. default database) you don't need to provide it to QSqlQuery.
-
wrote on 10 Oct 2010, 11:34 last edited by
now it displays this error
@
in function int main(int, chat**)
no match for operator! in !db
candidates are operator!(bool) <built-in>
@ -
wrote on 10 Oct 2010, 11:54 last edited by
You can use "isValid()":http://doc.qt.nokia.com/4.6/qsqldatabase.html#isValid
-
wrote on 10 Oct 2010, 11:58 last edited by
now it is saying
@
QSqlDatabase: QMysql driver is not loaded
QSqlDatabase: available drivers :QSQLITE QSQLITE2
@i have installed Mysql driver here "Your text to link here...":http://developer.qt.nokia.com/forums/viewthread/1121/P30/
-
wrote on 10 Oct 2010, 16:23 last edited by
It says that something is wrong with your mysql plugin. What do you have in your plugins/sqldrivers folder?
-
wrote on 10 Oct 2010, 16:35 last edited by
i have 10 different folders and four files. files with names are libqsqlmysql.so, qsqldriverbase.pri, readme, sqldriver.pro
-
wrote on 10 Oct 2010, 16:37 last edited by
i also run this code
@
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QStringList>
#include <QtDebug>int main( int argc, char *argv ) { QCoreApplication app( argc, argv ); qDebug() << QSqlDatabase::drivers(); }
@
it displays this
@
("QSQLITE","QSQLITE2")
@ -
wrote on 10 Oct 2010, 17:25 last edited by
Not folder with plugin sources, but folder with qt plugin binaries. It is folder named plugins/sqldrivers in root of your Qt folder.
-
wrote on 10 Oct 2010, 17:42 last edited by
well i checked this in this path home/qtsdk-2010.05/qt/src/plugins/sqldrivers
I have two plugins folders. one in home/qtsdk-2010.05/qt/plugins
in this plugin folder i have 11 folders with one named sqldrivers. inside this sqldriver folder i have these 3 files "libqsqlite.so, libqsqlite2.so, libqsqlpsql.so"the other is mentioned above which inside src.
-
wrote on 10 Oct 2010, 18:15 last edited by
Put mysql plugin in this folder.
-
wrote on 10 Oct 2010, 18:17 last edited by
from which folder i can get mysql plugin and what is the name of that mysql plugin? you mean this one libqsqlmysql.so which is in src/plugins/sqldrivers/mysql folder?
-
wrote on 10 Oct 2010, 18:28 last edited by
yes
15/17