On 25 July 2010 19:54, Angela Perez <perez.ange...@gmail.com> wrote: > I haven't worked out how to get the snmp code to > fetch only the specific row from the database table (i.e. SELECT * > FROM DB_TABLE WHERE rowNum = snmpRequestedRowNum)
I presume the difficulty here is in determining the appropriate value for "snmpRequestedRowNum" ? I'll let Robert comment on how to do this within the MfD framework. But in most of the other approaches, you'd do this using code such as the following: netsnmp_table_request_info *tinfo; for ( request = requests; request; request = request->next) { tinfo = netsnmp_extract_table_info(request); snprintf( query, sizeof(query), "SELECT * FROM DB_TABLE WHERE rowNum = %d", *tinfo->indexes->val.integer) // etc, etc, etc } The field 'indexes' is the head of a linked list of varbind structures, one per index value. The name (object ID) field is unused, and the value field holds the relevant index value. For a simple single-indexed table, you would use code such as that above. For a multiple-indexed table, you'd need to refer to 'tinfo->indexes->next_variable->val', and so on. The other thing to note is that this needs to be done for each varbind in the request. There's no guarantee that all the varbinds in a single SNMP request will necessarily refer to the same row of the table. Hence the netsnmp_extract_table_info() call is placed within the loop, in the code fragment shown above. I'll now let Robert explain how you'd do the same thing in MfD. Dave ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders