From: | Igor Korot <ikorot01(at)gmail(dot)com> |
---|---|
To: | PostgreSQL ODBC list <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Why this code fails |
Date: | 2018-09-26 02:35:31 |
Message-ID: | CA+FnnTxF3rCGsBr7i5qCP5W1F8QyOajG0h2dJ5h-9iusdLMz6g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Hi,
Following code fails with the error "Invalid column nuber in DescribeCol".
I'm trying to run it with the iODBC DM and the official PG ODBC driver.
[code]
int ODBCDatabase::AskPostgresForLogFile()
{
int result = 0;
SQLWCHAR *columnName = new SQLWCHAR[256], *columnData;
SQLSMALLINT columnNameLen, columnDataType, columnDataDigits,
columnDataNullable;
SQLLEN columnDataLen;
SQLULEN columnDataSize;
std::wstring query = L"SHOW log_directory";
std::vector<std::wstring> errorMsg;
SQLWCHAR *qry = new SQLWCHAR[query.length() + 2];
memset( qry, '\0', query.length() + 2 );
uc_to_str_cpy( qry, query );
RETCODE ret = SQLAllocHandle( SQL_HANDLE_STMT, m_hdbc, &m_hstmt );
if( ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO )
{
ret = SQLPrepare( m_hstmt, qry, 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;
}
else
{
}
}
[/code]
Thank you.
From | Date | Subject | |
---|---|---|---|
Next Message | Clemens Ladisch | 2018-09-26 07:47:41 | Re: Why this code fails |
Previous Message | 狐狸的面包雨 | 2018-09-25 09:30:22 | psqlodbc && nested transaction |