24 fFieldCount = nfields;
57 Error(
"IsValid",
"field index out of bounds");
81 SQLUSMALLINT columnNumber;
82 SQLCHAR columnName[256];
83 SQLSMALLINT bufferLength = 256;
84 SQLSMALLINT nameLength;
87 SQLSMALLINT decimalDigits;
90 columnNumber = field + 1;
91 if (SQLDescribeCol(
fResult, columnNumber, columnName, bufferLength,
92 &nameLength, &dataType, &columnSize, &decimalDigits,
93 &nullable) == SQL_SUCCESS) {
97 Error(
"GetFieldLength",
"cannot get field length");
116 SQLUSMALLINT columnNumber;
117 SQLCHAR columnName[256];
118 SQLSMALLINT bufferLength = 256;
119 SQLSMALLINT nameLength;
120 SQLSMALLINT dataType;
122 SQLSMALLINT decimalDigits;
123 SQLSMALLINT nullable;
125 columnNumber = field + 1;
127 rc = SQLDescribeCol(
fResult, columnNumber, columnName, bufferLength,
128 &nameLength, &dataType, &columnSize, &decimalDigits,
130 if (rc != SQL_SUCCESS) {
131 Error(
"TSapDBRow",
"error in getting description");
135 if (columnSize > 4000) {
136 Error(
"TSapDBRow",
"column size too large for current implementation.");
140 SQLLEN strLenOrIndPtr;
141 SQLPOINTER targetValuePtr[4000];
142 bufferLength =
sizeof(targetValuePtr);
144 if (SQLGetData(
fResult, columnNumber, SQL_C_DEFAULT, targetValuePtr,
145 bufferLength, &strLenOrIndPtr) != SQL_SUCCESS) {
146 Error(
"TSapDBRow",
"error in getting data");
155 case SQL_LONGVARCHAR:
160 snprintf(fieldstr,4001,
"%-*.*s", (
int)columnSize, (
int)columnSize,
161 (
char*) targetValuePtr);
167 snprintf(fieldstr,4001,
"%-*ld", (
int)columnSize, *(
long int*)(targetValuePtr));
173 snprintf(fieldstr,4001,
"%-*.2f", (
int)columnSize, *(
float*)(targetValuePtr));
176 snprintf(fieldstr,4001,
"%-*.2f", (
int)columnSize, *(
double*)(targetValuePtr));
181 case SQL_LONGVARBINARY:
184 case SQL_TYPE_TIMESTAMP:
186 snprintf(fieldstr,4001,
"%-*.*s", (
int)columnSize, (
int)columnSize,
187 (
char*)targetValuePtr);
ClassImp(TSapDBRow) TSapDBRow
Single row of query result.
void Close(Option_t *opt="")
Close row.
const char * GetField(Int_t field)
Get specified field from row (0 <= field < GetFieldCount()).
ULong_t GetFieldLength(Int_t field)
Get length in bytes of specified field.
Bool_t IsValid(Int_t field)
Check if row is open and field index within range.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
~TSapDBRow()
Destroy row object.