Results 1 to 3 of 3

Thread: sql Exceptions

  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default sql Exceptions

    Hi ..
    I would like to know if there's a class in Qt that hold the sql exceptions ..
    when I want to delete or update data .. I would like to hold the sql error due to constraint as foreign keys !!

    thx...

  2. #2
    Join Date
    Sep 2008
    Posts
    60
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sql Exceptions

    The closest thing I found was QSqlError::number(), which always returns -1 in case of PostgreSQL, and QSqlError::type(), which, in case of a PosgreSQL constraint violation, returns QSqlError::StatementError. I would also like to have more differentiation between various SQL errors.

  3. #3
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: sql Exceptions

    returning these 2 items usually works well for me to figure out what happened:

    QSqlError::databaseText ()
    QSqlError::driverText ()

    Usually these are more verbose and complete error messages.

  4. The following user says thank you to tpf80 for this useful post:

    yuriry (10th October 2008)

Similar Threads

  1. QOpenOCCI Oracle SQL Plugin
    By a_white in forum Qt-based Software
    Replies: 19
    Last Post: 13th March 2009, 08:39
  2. Questions regarding setting up a Qt SQL Model/View
    By Methedrine in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2007, 09:26
  3. Can I use the Sql Module without chanage .pro file?
    By fengtian.we in forum Qt Programming
    Replies: 9
    Last Post: 21st May 2007, 10:59
  4. Replies: 1
    Last Post: 4th October 2006, 16:05
  5. Exceptions and qApp->processEvents()
    By mcostalba in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2006, 17:06

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.