I have a such problem: I develop a simple database (PostgreSql). One of the features that it keeps in column (column name: "ascii") a big text data (2000 rows) that reads from file (datatype in the table is BYTEA). Here is the example of the code where I insert the data:
QFile *asciiFile = new QFile(ui->ascii_lineEdit->text());
asciiFile->open(QIODevice::ReadOnly);
QByteArray asciiArray = asciiFile->readAll();
qDebug() << asciiArray;
QSqlQuery *sourceQuery = new QSqlQuery();
sourceQuery->prepare("INSERT INTO source (image, image_material, archive, ascii, about) VALUES (:image, :image_material, :archive, :ascii, :about)");
sourceQuery->bindValue(":image", graphArray.toBase64());
sourceQuery->bindValue(":image_material", materialArray.toBase64());
sourceQuery->bindValue(":archive", archiveArray.toBase64());
sourceQuery->bindValue(":ascii", asciiArray.toBase64());
sourceQuery->bindValue(":about", ui->about_textEdit->toPlainText());
sourceQuery->exec();
Once more, the datatype of the column("ascii") that keeps is BYTEA. Now I try to read this data (near 2000 lines) and they not displayed as well. I try this method:
QByteArray asciiArray = QSqlQuery query = connector->getSourceAscii(item_id);
query.next();
QByteArray asciiArray = QByteArray::fromBase64(query.value("ascii").toByteArray());
QString *result = new QString(asciiArray);
qDebug() << *result;
It must be a lines of the digits but I have something like this: �w߇�k��ۇ������z���������燸��wӇ�k�{�����w��};��{��x{��k�{k�{k�xk�x߾���{k�{�����������wㇸ��
The examples of the lines that I need:
2490 0,21979421377182 4,82690520584583E-02
2491 0,226718083024025 4,33071963489056E-02
Have you any suggestion about this? Thanks.