Results 1 to 3 of 3

Thread: show all databases using "QSQLITE"

  1. #1
    Join Date
    Feb 2017
    Posts
    7
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default show all databases using "QSQLITE"

    Hi,
    I managed to create some databases, to create tables and put some data using "QSQLITE" driver. I can read and write data without problems.

    What I want is to be able to get all databases names created with "QSQLITE". Can this be possible?
    I try to get all databases names without succes.
    Can someone provide me a simple Qt code that can do that?
    Thank you.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,720
    Thanks
    259
    Thanked 760 Times in 750 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: show all databases using "QSQLITE"

    What I want is to be able to get all databases names created with "QSQLITE".
    QSQLITE is just a wrapper around the SQLite library. SQLite databases are usually just ordinary disk files. There is no server such as is used with MySQL or PostgreSQL. So since there is no server, there is nothing to connect to to ask what databases are being managed. Not only that, but you can name an SQLite database file with any name and extension you want.

    There is no practical way to ask which files are SQLite databases except to go through the entire filesystem and try to open every file with the SQLite driver.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    junior-root (15th September 2017)

  4. #3
    Join Date
    May 2013
    Location
    Sofia, Bulgaria
    Posts
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: show all databases using "QSQLITE"

    Quote Originally Posted by junior-root View Post
    What I want is to be able to get all databases names created with "QSQLITE". Can this be possible?
    You can keep track of SQLite databases created from your application inside the application - for example as a list of file names written in file. But this is not very reliable method since a database file can be moved outside your application and this make the path in your list invalid.

  5. The following user says thank you to stoyanps for this useful post:

    junior-root (15th September 2017)

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 11:02
  2. Replies: 3
    Last Post: 16th March 2015, 08:31
  3. Understanding "Connecting to Databases"
    By graciano in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2013, 22:50
  4. QSqlite "database is locked"
    By flob in forum Qt Programming
    Replies: 6
    Last Post: 14th December 2009, 15:18
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

Tags for this Thread

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.