PDA

View Full Version : QSqlQuery: results size are limited to 4095 bytes



breizhim
18th February 2011, 14:05
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 !!

mcosta
18th February 2011, 15:48
Try with QSqlQueryModel::fetchMore.

Some models are optimized and they don't fetch all data.

breizhim
18th February 2011, 15:58
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 :)

breizhim
28th February 2011, 10:25
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 :'(

ChrisW67
28th February 2011, 23:06
Show us the definition of the row and how you try to access the fields.

breizhim
3rd March 2011, 10:20
//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").toByteArray()); //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 ;)

ChrisW67
3rd March 2011, 22:12
Have a search in this (http://doc.qt.nokia.com/latest/sql-driver.html) page for "ODBC 2.x" . Does setting ODBC 3 compatibility change the outcome?