Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Loop in Qt when i call list of tables of database function

Loop in Qt when i call list of tables of database function

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 948 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enaud84
    wrote on last edited by
    #1

    i'm use an Oracle database in Qt 5.2 with QOCI library. I can open correctly the database and i can view data from a table. Now i want view the list of tables of my DB but when i call the function:

    @QStringList tables=db.tables(QSql::Tables);@

    I dont view ui interface (loop??) and when i stop my app i view this error in exit:

    The program has unexpectedly finished

    Someone has used this function?

    Thanks

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by
      #2

      You should loop through your QStringList:
      @
      QStringList tables=db.tables(QSql::Tables);
      foreach (const QString &str, tables) {
      qDebug() << str;
      }
      @

      1 Reply Last reply
      0
      • E Offline
        E Offline
        enaud84
        wrote on last edited by
        #3

        thanks for reply,
        I have same problem... freeze app and after i have error when i exit.. i use QOCI

        1 Reply Last reply
        0
        • C Offline
          C Offline
          clochydd
          wrote on last edited by
          #4

          Your QOCI in general is working, as you can open your database and list the content of a table.
          Does your app freeze immediately after initializing the QStringList?
          If not, can you see tables.size()?
          Have you tried to examine the step in Debug mode?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved