dynamic MIB table row fetched from DB only when requested?

Kjersti Grønnevik kgr____morecom.no
Tue Mar 19 13:57:43 CET 2002


Hi,

is it possible to implement a MIB table which has not preloaded any rows.
Our MIB table represents a DB table where rows are sporadically inserted or
deleted. My first thought was to not hold the rows in the MibTable between
requests, but dynamically update the MibTable for each request.

Here comes my problem: If I do not hold the rows in the MibTable, apparently
GETNEXT requests will not function - because there are no "next" row
instanciated in the MibTable. Hence, I get the error message - "No such
name" from my mib browser tool (MG-SOFT).

Here's some of my code:

void lvAptIndex::get_request(Request* req, int ind)
{
 //--AgentGen BEGIN=lvAptIndex::get_request

 if(lvAptEntry::instance)
 {
  lvAptEntry::instance->update(req, ind);
  set_state(lvAptEntry::instance->size());
 }

 //--AgentGen END
 MibLeaf::get_request(req, ind);
}


void lvAptEntry::update(Request* req, int subReqIndex)
{
  start_synch();
  currentSubReqIndex = subReqIndex;
  update( req );
  lastRequest = req;
  end_synch();
}

void aptEntry::update(Request* req)
{
 if( req != lastRequest )
 {
  //rows()->clearAll();  // this did'n work .....  only in debug mode  ....?
   }

  Oidx oid = req->get_oid( currentSubReqIndex );
  Oidx oid_aptId = oid.cut_left( 16 );//fetch the index from the oid

  MibTableRow* existingRow = find_index( oid_aptId );

 //add the row if the same row has not been added in this request.
 if( existingRow == 0 )
 {
  //fetch row from db
  long aptId = oid.last();
  LVDatabase *db = LVDatabase::getInstance();
  APTEntry aptEntry = db->getAPTEntry( aptId );

   // add the row with the row data from db
   MibTableRow* newRow = add_row( oid_aptId );

  set_row(
  newRow,
  (long)aptEntry.getId(),
  (char*)aptEntry.getFriendlyName().c_str(),
  (char*)aptEntry.formatDateString().c_str(),
    ......
 }
}

Hope this is understandable and thanks so much for great help so far!

Best regards,
Kjersti






More information about the AGENTPP mailing list