[SOLVED] Invalid precision value. QODBC3: Unable to bind variable (Using ODBC driver)



  • 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?



  • 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...



  • Solved by converting the QString to a QByteArray, and binding that.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.