Results 1 to 5 of 5

Thread: How do I execute an .schema command using Qt's SQLITE driver?

  1. #1
    Join Date
    Mar 2008
    Location
    Venezuela
    Posts
    34
    Thanks
    4
    Platforms
    MacOS X Unix/X11

    Cool How do I execute an .schema command using Qt's SQLITE driver?

    Greetings everybody.

    I'm developing a database application using SQLITE. I would like to check at start up if my database has been correctly initialized and its structure is O.K. So I wonder first, if it's possible to compare the SqLite .schema command's output with my start up SQL script, and second, how could I do that using Qt's SqLite driver?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I execute an .schema command using Qt's SQLITE driver?

    The ".schema" command is a part of the Sqlite command line client, and not part of Sqlite SQL. You can access schema information with standard SQL queries against the sqlite_master table. See http://www.sqlite.org/faq.html#q7

  3. #3
    Join Date
    Mar 2008
    Location
    Venezuela
    Posts
    34
    Thanks
    4
    Platforms
    MacOS X Unix/X11

    Default Re: How do I execute an .schema command using Qt's SQLITE driver?

    Thanks !

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I execute an .schema command using Qt's SQLITE driver?

    You could also look at QSqlDatabase::tables() for a list of table names and QSqlDatabase::record() for column names.

  5. #5
    Join Date
    Mar 2008
    Location
    Venezuela
    Posts
    34
    Thanks
    4
    Platforms
    MacOS X Unix/X11

    Default Re: How do I execute an .schema command using Qt's SQLITE driver?

    You could also look at QSqlDatabase::tables() for a list of table names and QSqlDatabase::record() for column names.
    Yes, but that will not provide me the exact SQL CREATE statement used to create the structure of each table. Querying sqlite_master, instead, will do it.

Similar Threads

  1. QDevelop SQLite Driver Issue
    By Phan Sin Tian in forum Qt-based Software
    Replies: 4
    Last Post: 1st August 2010, 11:47
  2. Embed SQLite driver
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 7th October 2009, 09:41
  3. SQLite driver unavailable
    By kandalf in forum Installation and Deployment
    Replies: 5
    Last Post: 11th February 2009, 16:36
  4. Ho to use signals and slots to execute a command?
    By claudio-cit in forum Qt Programming
    Replies: 2
    Last Post: 3rd July 2008, 22:01
  5. SQlite driver not loaded error
    By ibergmark in forum Installation and Deployment
    Replies: 2
    Last Post: 17th March 2008, 01:09

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.