Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Invalid precision value. QODBC3: Unable to bind variable (Using ODBC driver)
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zerby
    wrote on 21 Feb 2014, 07:33 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      Zerby
      wrote on 21 Feb 2014, 14:56 last edited by
      #2

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

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zerby
        wrote on 21 Feb 2014, 15:10 last edited by
        #3

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

        1 Reply Last reply
        0

        1/3

        21 Feb 2014, 07:33

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved