16 ClassImp(TMySQLResult);
21 TMySQLResult::TMySQLResult(
void *result)
23 fResult = (MYSQL_RES *) result;
24 fRowCount = fResult ? mysql_num_rows(fResult) : 0;
31 TMySQLResult::~TMySQLResult()
40 void TMySQLResult::Close(Option_t *)
45 mysql_free_result(fResult);
54 Bool_t TMySQLResult::IsValid(Int_t field)
57 Error(
"IsValid",
"result set closed");
60 if (field < 0 || field >= GetFieldCount()) {
61 Error(
"IsValid",
"field index out of bounds");
70 Int_t TMySQLResult::GetFieldCount()
73 Error(
"GetFieldCount",
"result set closed");
76 return mysql_num_fields(fResult);
82 const char *TMySQLResult::GetFieldName(Int_t field)
88 fFieldInfo = mysql_fetch_fields(fResult);
91 Error(
"GetFieldName",
"cannot get field info");
95 return fFieldInfo[field].name;
102 TSQLRow *TMySQLResult::Next()
107 Error(
"Next",
"result set closed");
110 row = mysql_fetch_row(fResult);
114 return new TMySQLRow((
void *) fResult, (ULong_t) row);