#include "TMySQLRow.h"
ClassImp(TMySQLRow)
TMySQLRow::TMySQLRow(void *res, ULong_t rowHandle)
{
   
   fResult      = (MYSQL_RES *) res;
   fFields      = (MYSQL_ROW) rowHandle;
   fFieldLength = 0;
}
TMySQLRow::~TMySQLRow()
{
   
   if (fFields)
      Close();
}
void TMySQLRow::Close(Option_t *)
{
   
   
   if (!fFields)
      return;
   fFields      = 0;
   fResult      = 0;
   fFieldLength = 0;
}
Bool_t TMySQLRow::IsValid(Int_t field)
{
   
   
   if (!fFields) {
      Error("IsValid", "row closed");
      return kFALSE;
   }
   if (field < 0 || field >= (Int_t)mysql_num_fields(fResult)) {
      Error("IsValid", "field index out of bounds");
      return kFALSE;
   }
   return kTRUE;
}
ULong_t TMySQLRow::GetFieldLength(Int_t field)
{
   
   
   if (!IsValid(field))
      return 0;
   if (!fFieldLength)
      fFieldLength = mysql_fetch_lengths(fResult);
   
   if (!fFieldLength) {
      Error("GetFieldLength", "cannot get field length");
      return 0;
   }
   return fFieldLength[field];
}
const char *TMySQLRow::GetField(Int_t field)
{
   
   if (!IsValid(field))
      return 0;
   return fFields[field];
}
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.