Results 1 to 20 of 20

Thread: QSqlDatabase and "CREATE DATABASE ..." ??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QSqlDatabase and "CREATE DATABASE ..." ??

    Just out of curiosity: How would you programatically create a database in postgresql then?

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase and "CREATE DATABASE ..." ??

    Quote Originally Posted by JohannesMunk View Post
    Just out of curiosity: How would you programatically create a database in postgresql then?
    As I say in my first post in this thread. On PostgreSQL server allways exist "service database" called postgres. In this database is saved dictionary of databases, tables, function, users etc.
    With this query
    Qt Code:
    1. SELECT datname FROM pg_catalog.pg_database
    To copy to clipboard, switch view to plain text mode 
    You retrieve list of all databases.
    Very simple and effective mechanism.

  3. The following user says thank you to Lesiok for this useful post:

    JohannesMunk (7th April 2009)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.