#include "TODBCResult.h"
#include "TODBCRow.h"
ClassImp(TODBCResult)
TODBCResult::TODBCResult(SQLHSTMT stmt)
{
fHstmt = stmt;
fFieldCount = 0;
SQLSMALLINT columnCount;
SQLRETURN retcode = SQLNumResultCols(fHstmt, &columnCount);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
fFieldCount = columnCount;
}
TODBCResult::~TODBCResult()
{
Close();
}
void TODBCResult::Close(Option_t *)
{
SQLFreeHandle(SQL_HANDLE_STMT, fHstmt);
fHstmt = 0;
}
const char *TODBCResult::GetFieldName(Int_t field)
{
SQLCHAR columnName[1024];
SQLSMALLINT nameLength;
SQLSMALLINT dataType;
SQLULEN columnSize;
SQLSMALLINT decimalDigits;
SQLSMALLINT nullable;
SQLRETURN retcode =
SQLDescribeCol(fHstmt, field+1, columnName, 1024,
&nameLength, &dataType,
&columnSize, &decimalDigits, &nullable);
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) return 0;
fNameBuffer = (const char*) columnName;
return fNameBuffer;
}
TSQLRow *TODBCResult::Next()
{
if (fHstmt==0) return 0;
SQLRETURN retcode = SQLFetch(fHstmt);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
return new TODBCRow(fHstmt, fFieldCount);
return 0;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.