From: | Igor Korot <ikorot01(at)gmail(dot)com> |
---|---|
To: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Error on query execution |
Date: | 2025-03-05 02:21:33 |
Message-ID: | CA+FnnTwkJtLq0AvY6UB7dUrdXsO28PGSqX-wBOy+LT6Ei1jD4A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-03-05 02:37:00 | Re: Error on query execution |
Previous Message | Igor Korot | 2025-03-05 01:50:00 | Re: Messages o Terminal |