public inbox for [email protected]  
help / color / mirror / Atom feed
From: Igor Korot <[email protected]>
To: pgsql-generallists.postgresql.org <[email protected]>
Subject: Error on query execution
Date: Wed, 5 Mar 2025 01:42:13 -0600
Message-ID: <CA+FnnTwkJtLq0AvY6UB7dUrdXsO28PGSqX-wBOy+LT6Ei1jD4A@mail.gmail.com> (raw)

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.






view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Error on query execution
  In-Reply-To: <CA+FnnTwkJtLq0AvY6UB7dUrdXsO28PGSqX-wBOy+LT6Ei1jD4A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox