.TH snmpa_local_db 3erl "snmp 5.13.5" "Ericsson AB" "Erlang Module Definition" .SH NAME snmpa_local_db \- The SNMP built-in database .SH DESCRIPTION .LP The module \fIsnmpa_local_db\fR\& contains functions for implementing tables (and variables) using the SNMP built-in database\&. The database exists in two instances, one volatile and one persistent\&. The volatile database is implemented with ets\&. The persistent database is implemented with dets\&. .LP There is a scaling problem with this database\&. .RS 2 .TP 2 * Insertions and deletions are inefficient for large tables\&. .LP .RE .LP This problem is best solved by using Mnesia instead\&. .LP The following functions describe the interface to \fIsnmpa_local_db\fR\&\&. Each function has a Mnesia equivalent\&. The argument \fINameDb\fR\& is a tuple \fI{Name, Db}\fR\& where \fIName\fR\& is the symbolic name of the managed object (as defined in the MIB), and \fIDb\fR\& is either \fIvolatile\fR\& or \fIpersistent\fR\&\&. \fImnesia\fR\& is not possible since all these functions are \fIsnmpa_local_db\fR\& specific\&. .SH "COMMON DATA TYPES" .LP In the functions defined below, the following types are used: .RS 2 .TP 2 * \fINameDb = {Name, Db}\fR\& .LP .TP 2 * \fIName = atom(), Db = volatile | persistent\fR\& .LP .TP 2 * \fIRowIndex = [int()]\fR\& .LP .TP 2 * \fICols = [Col] | [{Col, Value}], Col = int(), Value = term()\fR\& .LP .RE .LP where \fIRowIndex\fR\& denotes the last part of the OID, that specifies the index of the row in the table\&. \fICols\fR\& is a list of column numbers in case of a get operation, and a list of column numbers and values in case of a set operation\&. .SH EXPORTS .LP .B dump() -> ok | {error, Reason} .br .RS .LP Types: .RS 3 Reason = term() .br .RE .RE .RS .LP This function can be used to manually dump the database to file\&. .RE .LP .B match(NameDb, Pattern) .br .RS .LP Performs an ets/dets matching on the table\&. See Stdlib documentation, module ets, for a description of \fIPattern\fR\& and the return values\&. .RE .LP .B print() .br .B print(TableName) .br .B print(TableName, Db) .br .RS .LP Types: .RS 3 TableName = atom() .br .RE .RE .RS .LP Prints the contents of the database on screen\&. This is useful for debugging since the \fISTANDARD-MIB\fR\& and \fIOTP-SNMPEA-MIB\fR\& (and maybe your own MIBs) are stored in \fIsnmpa_local_db\fR\&\&. .LP \fITableName\fR\& is an atom for a table in the database\&. When no name is supplied, the whole database is shown\&. .RE .LP .B table_create(NameDb) -> bool() .br .RS .LP Creates a table\&. If the table already exist, the old copy is destroyed\&. .LP Returns \fIfalse\fR\& if the \fINameDb\fR\& argument is incorrectly specified, \fItrue\fR\& otherwise\&. .RE .LP .B table_create_row(NameDb, RowIndex, Row) -> bool() .br .RS .LP Types: .RS 3 Row = {Val1, Val2, \&.\&.\&., ValN} .br Val1 = Val2 = \&.\&.\&. = ValN = term() .br .RE .RE .RS .LP Creates a row in a table\&. \fIRow\fR\& is a tuple with values for all columns, including the index columns\&. .RE .LP .B table_delete(NameDb) -> void() .br .RS .LP Deletes a table\&. .RE .LP .B table_delete_row(NameDb, RowIndex) -> bool() .br .RS .LP Deletes the row in the table\&. .RE .LP .B table_exists(NameDb) -> bool() .br .RS .LP Checks if a table exists\&. .RE .LP .B table_get_row(NameDb, RowIndex) -> Row | undefined .br .RS .LP Types: .RS 3 Row = {Val1, Val2, \&.\&.\&., ValN} .br Val1 = Val2 = \&.\&.\&. = ValN = term() .br .RE .RE .RS .LP \fIRow\fR\& is a tuple with values for all columns, including the index columns\&. .RE .SH "SEE ALSO" .LP ets(3erl), dets(3erl), snmp_generic(3erl)