I've had a problem. I presumed was my mistake, as usual . But after some investigation I think I've found a Qt-bug. Anybody can test this code in a Win-xx environment to confirm my suspects ?

Environment : mingw32 3.4.2, SQLServer 2000-SP4, Qt 4.3.0, driver QTDS

Qt Code:
  1. #include <QApplication>
  2. #include <QtSql/QSqlDatabase>
  3. #include <QtSql/QSqlQuery>
  4. #include <QtSql/QSqlRecord>
  5. #include <QVariant>
  6. #include <fstream>
  7.  
  8. using namespace std;
  9.  
  10. int main(int argc, char *argv[])
  11. {
  12. ofstream DEBUG;
  13. DEBUG.open ( "LOG.TXT" );
  14.  
  15. QCoreApplication app(argc, argv);
  16.  
  17. QSqlDatabase db = QSqlDatabase::addDatabase ( "QTDS" );
  18. db.setHostName ( "<HOSTNAME>" );
  19. db.setDatabaseName ( "<DATABASE>" );
  20. db.setUserName ( "sa" );
  21. db.setPassword ( "<pwd>" );
  22. db.open();
  23.  
  24. QSqlQuery QRY ( db );
  25. // here you MUST put a query that select at least a field longer than 255 chars
  26. // ( 300 , 500 , 800, ... )
  27. QString SEL = "SELECT FIELD_LONGER_THAN_255_CHAR FROM TABLE";
  28.  
  29. QRY.exec ( SEL );
  30. QRY.last();
  31. QRY.first();
  32.  
  33. while ( QRY.isValid() )
  34. {
  35. DEBUG << (const char *)QRY.record().value ( 0 ).toString().toAscii() << "\n";
  36. QRY.next();
  37. }
  38.  
  39. DEBUG.close();
  40. return 0;
  41. }
To copy to clipboard, switch view to plain text mode 

In windows, when the field is longer than 255 chars ( SQL analizer from Microsoft returs all the data ) the value returned from Qt's classes is "cutted" to 255 chars.

VERY Strange....