[SOLVED] Invalid precision value. QODBC3: Unable to bind variable (Using ODBC driver)
-
wrote on 21 Feb 2014, 07:33 last edited by
I'm trying to insert a large string (about 32k characters) to a Pervasive database using Qt ODBC driver. The database table is as follows:
@
CREATE TABLE "TABLE"(
"product_id" VARCHAR(18),
"header" VARCHAR(40),
"text" LONGVARCHAR);
@And trying to insert a large string (variable name value) to it:
@
QSqlQuery q(db);
q.prepare("INSERT INTO TABLE(product_id, header, text) VALUES (:product, :header, :text);");
q.bindValue(":product", QVariant("TEST"));
q.bindValue(":header", QVariant("HEADER"));
q.bindValue(":text", value);
if (!q.exec()) std::cout << q.lastError().text().toStdString() << std::endl;
else std::cout << "SUCCESS!" << std::endl;
@Gives the following error:
@
[Pervasive][ODBC Client Interface]Invalid precision value. QODBC3: Unable to bind variable
@The limit is somewhere between 3000 and 4000 characters. I tried ti Google around, but found really nothing I could work with.. I guess it has something to do with the ODBC driver, but does anyone have any experience on how to work around this problem?
-
wrote on 21 Feb 2014, 14:56 last edited by
I've now pinpointed the exact length where the error occures, and it's exactly at 4000. If the string is over 4000 characters, the error will occur...
-
wrote on 21 Feb 2014, 15:10 last edited by
Solved by converting the QString to a QByteArray, and binding that.
1/3