Results 1 to 20 of 20

Thread: query prepare with sql math

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Porto Alegre
    Posts
    65
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: query prepare with sql math

    I have uploaded a simple compilable example, as jacek asked.

    Renan

    I have uploaded it again.
    Attached Files Attached Files
    Last edited by GuL; 2nd September 2008 at 15:00. Reason: changing testemysql.cpp

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: query prepare with sql math

    I can't download testemysql2.cpp

  3. #3
    Join Date
    Aug 2008
    Location
    Porto Alegre
    Posts
    65
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: query prepare with sql math

    I have uploaded it again.

    Renan

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: query prepare with sql math

    looks like bug in Qt.
    this code works, you can use it
    Qt Code:
    1. ...
    2. query.prepare(QString("select %1/%2").arg(ui.lineEdit->text()).arg(ui.lineEdit_2->text()));
    3. ...
    To copy to clipboard, switch view to plain text mode 

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

    GuL (2nd September 2008)

  6. #5
    Join Date
    Aug 2008
    Location
    Porto Alegre
    Posts
    65
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: query prepare with sql math

    Thanks again spirit.

    I will wait one or two days to report these to trolltech. Maybe someone knows why this is happening.

    I'm using QT 4.3.4 open source Linux Ubuntu 8.04. I don't if this happens with QT 4.4.1.

    Renan

  7. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: query prepare with sql math

    I've tested on Qt 4.4.1, the result is the same.

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: query prepare with sql math

    I've minimized it a bit further (see attachment) and it appears that for Qt 4.4.1 on Linux I get the "No results." message, which means that the database doesn't return any data. Of course it works for * operator.

    I've also found a workaround:
    Qt Code:
    1. query.addBindValue( 4.0 );
    2. query.addBindValue( 2.0 );
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

Similar Threads

  1. QTableWidget Sql Query 25.000 records
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2008, 14:54
  2. Sql Query Problem
    By MrShahi in forum Qt Programming
    Replies: 6
    Last Post: 30th May 2008, 09:16
  3. QTreeView with results from an SQL query.
    By ederbs in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2007, 02:41

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.