I'm now trying to connect to my app to MySQL using mysql.h from MySQL 4.1.... as I just can't make the damn plugin... somewhere theres a post explaining the plugin stuff..
The thing now is that after I made the connection I retrieve the table list as this:
.......
#include <mysql.h>
....
..
MYSQL_RES *res;
...
..
{
if (!res=mysql_list_tables( &mysql, NULL ))
{
QMessageBox::warning(0,
"No se pudo obtener la lista de tablas", mysql_error
( &mysql
));
}
//convert MYSQL_RES to QSTRINGLIST ???
for ( QStringList::Iterator it
= listaTablas.
begin(); it
!= listaTablas.
end();
++it
) { qWarning(*it + "\n");
}
//muestra en consola la lista de tablas de la base de datos a la que se conecto
return listaTablas;
}
.......
#include <mysql.h>
....
..
MYSQL_RES *res;
...
..
QStringList tablas()
{
if (!res=mysql_list_tables( &mysql, NULL ))
{
QMessageBox::warning(0,"No se pudo obtener la lista de tablas", mysql_error( &mysql ));
}
QStringList listaTablas = res->toStringList;
//convert MYSQL_RES to QSTRINGLIST ???
for ( QStringList::Iterator it = listaTablas.begin(); it != listaTablas.end(); ++it ) {
qWarning(*it + "\n");
}
//muestra en consola la lista de tablas de la base de datos a la que se conecto
return listaTablas;
}
To copy to clipboard, switch view to plain text mode
so the question is..... tararraaarrataaan.
how do i get res to fill a QStringList?
I've tryed casting:
QStringList listaTablas = (QStringList)res;
To copy to clipboard, switch view to plain text mode
Dumbass way:
QStringList listaTablas = res;
To copy to clipboard, switch view to plain text mode
and DumbAss2 xD as there is no member... etc
error: 'struct st_mysql_res' has no member named 'toStringList
QStringList listaTablas = res->toStringList;
To copy to clipboard, switch view to plain text mode
Any ideas?
the final idea is to fill a qcombobox with the QStringList with the table list
CB_Tablas->insertStringList(tablas());
CB_Tablas->insertStringList(tablas());
To copy to clipboard, switch view to plain text mode
as you can see the function named tablas returns a QStringList that contains or should contain the table list from the database
please don't tellme to use qdatabase.h as that's now not an option
Bookmarks