Fwd: What is the problem with this code?

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Fwd: What is the problem with this code?
Date: 2018-10-19 11:14:03
Message-ID: CA+FnnTw+0gTLh9xm6n0njmdvoiEzSBrkt2y1a0y1PSkvyBoMkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-odbc

Does anybody have an idea why the code below fails?

Thank you.

---------- Forwarded message ---------
From: Igor Korot <ikorot01(at)gmail(dot)com>
Date: Thu, Oct 18, 2018 at 11:49 PM
Subject: What is the problem with this code?
To: PostgreSQL ODBC list <pgsql-odbc(at)postgresql(dot)org>

Hi, ALL,

[code]
std::wstring query1 = L"SHOW log_directory";
std::wstring query2 = L"SHOW log_filename";
SQLWCHAR *qry1 = new SQLWCHAR[query1.length() + 2];
SQLWCHAR *qry2 = new SQLWCHAR[query2.length() + 2];
memset( qry1, '\0', query1.length() + 2 );
memset( qry2, '\0', query2.length() + 2 );
uc_to_str_cpy( qry1, query1 );
uc_to_str_cpy( qry2, query2 );
RETCODE ret = SQLAllocHandle( SQL_HANDLE_STMT, m_hdbc, &m_hstmt );
if( ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO )
{
ret = SQLPrepare( m_hstmt, qry1, SQL_NTS );
if( ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, 1 );
result = 1;
}
else
{
ret = SQLDescribeCol( m_hstmt, 1, columnName, 256,
&columnNameLen, &columnDataType, &columnDataSize, &columnDataDigits,
&columnDataNullable );
if( ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO )
{
GetErrorMessage( errorMsg, 1 );
result = 1;
}
[/code]

The SQLDescribeCol() call fails with the error invalid column number".

Does anybody have any idea?

Thank you.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-10-19 14:31:24 Re: Problem about partitioned table
Previous Message Karsten Hilbert 2018-10-19 10:33:51 Re: PostgreSQL 11 and security

Browse pgsql-odbc by date

  From Date Subject
Next Message Paal Christof 2018-10-19 12:16:33 Crash in 64 bit ODBC driver when using bookmarks
Previous Message Clemens Ladisch 2018-10-19 07:04:31 Re: What is the problem with this code?