| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 3 | |
I'm writing an application to pull data from any number of databases and tables from a single MySQL server. I can hard-code the server name in my app, but not the database. I know I can pull the list of databases from the mysql.db table, but is there no way to do this with a built-in function? You know, something like QSqlDatabase.tables()? I need a dbConnection.listDatabases. I don't want to do it with a query. Thanks, dk P.S. On my server at home, I see that I have an information_schema database that has all the databases in a table called "schemata". I don't have this on my server at work, and I don't know where it came from. It's kind of nice, but it's still a query to get at it's information when I'm looking for a built-in function. -- [ signature omitted ]
On Thursday 15 May 2008 03.32:40 David Krider wrote: > I'm writing an application to pull data from any number of databases and > tables from a single MySQL server. I can hard-code the server name in my > app, but not the database. I know I can pull the list of databases from > the mysql.db table, but is there no way to do this with a built-in > function? You know, something like QSqlDatabase.tables()? I need a > dbConnection.listDatabases. I don't want to do it with a query. > > Thanks, > dk > > > P.S. On my server at home, I see that I have an information_schema > database that has all the databases in a table called "schemata". I > don't have this on my server at work, and I don't know where it came > from. It's kind of nice, but it's still a query to get at it's > information when I'm looking for a built-in function. > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > "unsubscribe" in the subject or the body. List archive and information: > http://lists.trolltech.com/qt-interest/ Have you tried http://doc.trolltech.com/4.4/qsqldatabase.html#tables ? Cheers, Samuel -- [ signature omitted ]
On Thursday 15 May 2008 07.53:35 Samuel Gaist wrote: > On Thursday 15 May 2008 03.32:40 David Krider wrote: > > I'm writing an application to pull data from any number of databases and > > tables from a single MySQL server. I can hard-code the server name in my > > app, but not the database. I know I can pull the list of databases from > > the mysql.db table, but is there no way to do this with a built-in > > function? You know, something like QSqlDatabase.tables()? I need a > > dbConnection.listDatabases. I don't want to do it with a query. > > > > Thanks, > > dk > > > > > > P.S. On my server at home, I see that I have an information_schema > > database that has all the databases in a table called "schemata". I > > don't have this on my server at work, and I don't know where it came > > from. It's kind of nice, but it's still a query to get at it's > > information when I'm looking for a built-in function. > > > > -- > > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > > "unsubscribe" in the subject or the body. List archive and information: > > http://lists.trolltech.com/qt-interest/ > > Have you tried http://doc.trolltech.com/4.4/qsqldatabase.html#tables ? > > Cheers, > Samuel > > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > "unsubscribe" in the subject or the body. List archive and information: > http://lists.trolltech.com/qt-interest/ Oups, sorry misread your post, currently there's no built-in function for that matter. As Thiago pointed out, your best bet is the show-databases command. Don't forget to verify that you have sufficient right on the database for it to work. Cheers, Samuel -- [ signature omitted ]
Am Donnerstag, 15. Mai 2008 schrieb Samuel Gaist: > As Thiago pointed out, your best bet is the show-databases > command. Don't forget to verify that you have sufficient right on the > database for it to work. As far as I remember, "show databases;" only shows the databases you have any rights to access... Have fun, Arnold -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
Am Donnerstag, 15. Mai 2008 schrieb David Krider: > P.S. On my server at home, I see that I have an information_schema > database that has all the databases in a table called "schemata". I > don't have this on my server at work, and I don't know where it came > from. It's kind of nice, but it's still a query to get at it's > information when I'm looking for a built-in function. That is probably because at home you have phpmyadmin installed with all features. Whereas at work the admins might use phpmyadmin, but not with all features. So there is none of the phpmyadmin-relation-tracking stuff at works database... Have fun, Arnold -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
David Krider wrote: >I'm writing an application to pull data from any number of databases and >tables from a single MySQL server. I can hard-code the server name in my >app, but not the database. I know I can pull the list of databases from >the mysql.db table, but is there no way to do this with a built-in >function? You know, something like QSqlDatabase.tables()? I need a >dbConnection.listDatabases. I don't want to do it with a query. Try the following command: http://dev.mysql.com/doc/refman/5.0/en/show-databases.html -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
On Thu, 2008-05-15 at 08:39 +0200, Thiago Macieira wrote: > David Krider wrote: > >I'm writing an application to pull data from any number of databases and > >tables from a single MySQL server. I can hard-code the server name in my > >app, but not the database. I know I can pull the list of databases from > >the mysql.db table, but is there no way to do this with a built-in > >function? You know, something like QSqlDatabase.tables()? I need a > >dbConnection.listDatabases. I don't want to do it with a query. > > Try the following command: > > http://dev.mysql.com/doc/refman/5.0/en/show-databases.html > Oh! Ok. I hadn't even considered just sending the command. For some reason, I thought that was a function that would just work within the `mysql' command. I didn't realize that this was a valid SQL query. It works perfectly. As someone else pointed out, this only lists databases that the account I'm using has access to, but that's good. This also avoids some "junk" data I was seeing (from databases I must have messed up setting permissions on or something). THANK YOU! dk -- [ signature omitted ]