Results 1 to 7 of 7

Thread: QSqlQuery: results size are limited to 4095 bytes

  1. #1
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QSqlQuery: results size are limited to 4095 bytes

    Hi,

    I have a problem about getting full result of a SQL query (using ODBC). This one like to be limited to 4095 bytes. I can't get a full picture from my database !

    Details:
    - The odbc seems to be well configured. I have tested it with a sql client (Aqua Data Studio) and it returns me a full result.
    - I use the QSqlModel to perform my query.
    - I encountered the same problem with long text (more than 4095).

    What's wrong ?

    THX !!

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    Try with QSqlQueryModel::fetchMore.

    Some models are optimized and they don't fetch all data.
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    I didn't understand the fetchMore() function in QT Designer's help ^^

    So thank you for your help, i'll try it after my holiday

  4. #4
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    FetchMore didn't work. My problem concern only one row which size must be higher than 4095 bytes. I didn't found any parameter to add to my QSqlDatabase object, neither QSqlModel .... help :'(

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,543
    Thanks
    13
    Thanked 1,577 Times in 1,506 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    Show us the definition of the row and how you try to access the fields.

  6. #6
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    //Connection
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
    db.setDatabaseName(conf_database);
    db.setUserName(conf_user);
    db.setPassword(password);
    db.setHostName("");


    //Get the picture
    QString rPhoto("select photo from individus where identifiant="+identifiant);
    QSqlQueryModel modelPhoto;
    modelPhoto.setQuery(rPhoto);
    QFile test("d:/test_image.bmp");
    test.open(QIODevice::WriteOnly);
    test.write(modelPhoto.record(0).value("photo").toB yteArray()); //The size() function return 4095 ... but the picture is higher, about 22kB.
    test.close();
    Database: SYBASE 12.5
    The ODBC is well configured, i tested it with another SQL Client which returns a full result.

    The column is a "picture" datatype in Sybase.

    Thx to try to help me

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,543
    Thanks
    13
    Thanked 1,577 Times in 1,506 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QSqlQuery: results size are limited to 4095 bytes

    Have a search in this page for "ODBC 2.x" . Does setting ODBC 3 compatibility change the outcome?

Similar Threads

  1. How to delete results of QSqlQuery from table ?
    By homerun4711 in forum Newbie
    Replies: 2
    Last Post: 14th February 2011, 22:50
  2. Does QSqlTableModel have limited capacity?
    By metdos in forum Qt Programming
    Replies: 2
    Last Post: 1st January 2010, 22:06
  3. filter signal to limited slots
    By sriky27 in forum Qt Programming
    Replies: 17
    Last Post: 26th March 2009, 16:59
  4. Extracting QSqlQuery results in PyQt4
    By amicitas in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2008, 05:10
  5. Replies: 4
    Last Post: 8th July 2007, 14:26

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.