[Interest] Qt Sql BLOB data converting

Thiago Macieira thiago.macieira at intel.com
Mon Nov 28 19:03:52 CET 2022


On Monday, 28 November 2022 01:00:01 PST Yauheni Pervenenka via Interest 
wrote:
> QSqlQuery query("SELECT value from table");
> while (query.next()) {
> const auto value = query.value(0);
> qDebug() << value.toByteArray().size(); // size 52
> qDebug() << value.toString().size(); // size 30
> qDebug() << value.toByteArray().toHex(); // size 104
> }

If your data is binary, don't use toString(). That's definitely wrong.

Can you show the example from the CREATE TABLE command, including the INSERT 
one?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering





More information about the Interest mailing list