[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: creating/listing PostgreSQL db with qt?
From:       domseichter () t-online ! de (Dominik Seichter)
Date:       2002-09-29 14:32:29
[Download RAW message or body]

Am Sonntag, 29. September 2002 16:15 schrieb Frederik Himpe:
> Hi,
>
> I forgot to ask my second question...
>
> Is it possible to create a new PostgreSQL database, and to list all the
> existing databases with QT only, or will I have to use the PostgreSQL
> libs for this? I could not find this functionality in the QT docs, but
> I'm asking to be sure I did not overlook something.
It is possible with Qt only. At least with MySQL, but I think it will be the 
same with PostgreSQL.
In KBarcode I used which is similar to this code:

    QSqlDatabase*dbase = QSqlDatabase::addDatabase(sqldata.driver, "mysql");
    dbase->setDatabaseName( "mysql" ); 
    dbase->setUserName( username );
    dbase->setPassword( password );
    dbase->setHostName( hostname );
    if(dbase->open()) {
        QSqlQuery query( NULL, dbase );
        if(!query.exec("CREATE DATABASE " + database + ";")) {
	   // failed
            dbase->close();
            QSqlDatabase::removeDatabase("mysql");
            return;
        } else
	 //sucess
       }

CU Dom
-- 
************************************************************
Dominik Seichter - domseichter@web.de
Krename - http://krename.sf.net
KBarcode - http://kbarcode.sf.net
************************************************************


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic