Search Postgresql Archives

Error on query execution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, ALL,
[code]
    type = 80;
    uint32_t binaryIntVal;
    const char *paramValues[1];
    int paramLengths[1];
    int paramFormats[1];
    binaryIntVal = htonl( (uint32_t) type );
    paramValues[0] = (char *) &binaryIntVal;
    paramLengths[0] = sizeof( binaryIntVal );
    paramFormats[0] = 1;
    res = PQexecParams( m_db, "SELECT * FROM abcatfmt WHERE abf_type =
$1", 1, nullptr, paramValues, paramLengths, paramFormats, 1 );
    if (PQresultStatus(res) != PGRES_TUPLES_OK)
    {
        std::wstring err = m_pimpl->m_myconv.from_bytes(
PQerrorMessage( m_db ) );
        errorMsg.push_back( L"Error executing query: " + err );
        result = 1;
    }
[/code]

Running the above I'm getting:

[quote]
(gdb) p err
$1 = L"ERROR:  incorrect binary data format in bind parameter 1\n"
[/quote]

What is wrong and how do I fix it?

Thank you.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux