Results 1 to 8 of 8

Thread: QPSQL: Unable to find table set in a QSqlTableModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPSQL: Unable to find table set in a QSqlTableModel

    Hi norobro.

    currentConnection is properly initialized and database test is going ok. I'm working with PostgreSQL 9.0.2.
    I think that this is a problem relative to the query syntax posted from QPSQL to the database engine. Have you read nothing abount this? Do you know a method to show the last query executed on the database?

    Thanks

  2. #2
    Join Date
    Jan 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPSQL: Unable to find table set in a QSqlTableModel

    Updates:

    I tried to debug my database stack with a QDebug object and the result are:

    - There is no errors for database connection, it result correctly up and running.
    - There is no errors for the last database transaction executed. Operation required to the QSqlDatabase connection is ok.
    - If i try to execute a QSqlQuery statement with my required query (wroted by hand), it fetch data from PostgreSQL correctly and i can bind all the values in the record.

    My Opnion:
    I think that this is a problem only of the QSqlTableModel stack and for query inserted with model functions. Now i try to give to the model a Query written by hand.

  3. #3
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QPSQL: Unable to find table set in a QSqlTableModel

    Hi Andrea,

    Take a look this bug report.

    My test app worked fine on postgres 8.4 but after upgrading 9.0.1 I got the following warning on the command line: "This version of PostgreSQL is not supported and may not work." Plus lastError() reported "unable to find table foo".

    After applying the patch in the bug report and recompiling the psql driver it works.

    BTW I'm using Qt 4.7.0

    HTH
    Norm

  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: QPSQL: Unable to find table set in a QSqlTableModel

    Quote Originally Posted by andreabiscuola View Post
    I think that this is a problem relative to the query syntax posted from QPSQL to the database engine. Have you read nothing abount this? Do you know a method to show the last query executed on the database?
    QSqlTableModel::selectStatement() should give you the query the model will try to execute.

  5. #5
    Join Date
    Jan 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPSQL: Unable to find table set in a QSqlTableModel

    Hi norobro!

    The bug report you indicated respond completely to my problem! I want to try the patch suggested but i have a doubt: Why the problem appear only using the QSqlTableModel and not with the QSqlQuery?

  6. #6
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QPSQL: Unable to find table set in a QSqlTableModel

    Here is a thread on Qt-interest about this.

    Quote Originally Posted by andreabiscuola View Post
    Why the problem appear only using the QSqlTableModel and not with the QSqlQuery?
    I guess you could dig into the source code to figure out why

Similar Threads

  1. Replies: 1
    Last Post: 3rd February 2010, 06:01
  2. unable to insert into table
    By mohanakrishnan in forum Qt Programming
    Replies: 0
    Last Post: 4th December 2009, 10:52
  3. QSqlRelationalTableModel settable unable to find
    By nietzsche in forum Qt Programming
    Replies: 0
    Last Post: 25th May 2009, 22:51
  4. Can't find QPSQL driver!!
    By brevleq in forum Qt Programming
    Replies: 9
    Last Post: 30th October 2007, 00:29
  5. QPSQL && table change notify
    By Sergey B. in forum Qt Programming
    Replies: 0
    Last Post: 3rd May 2007, 15:42

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
  •  
Qt is a trademark of The Qt Company.