bottrap
< Prev Back to Table of Contents Next >

Creating Records and Databases

The new subcommand is used to create records of the specified type within the database identified by the database command. If no record type is specified, the new command creates a new database. Each database, including the master database, can be used to create new, empty databases.

Syntax:

% dbcmd new ?recordType? ?option value ...?

..where dbcmd is the name of the database, recordType is an optional record type, and a series of option/value pairs, same as those supported by the set command for the specified record type, may be present to configure the record at creation time.

Returns:

Fully-qualified name of the created record.

Common Properties

The -name property, which is allowed for all record types except files and databases themselves, is used to specify the name of the new record. If no name is specified, the SDK will automatically assign a name that is guaranteed to be unique within the database.

The -in property is used to specify the parent/container record where appropriate. If the -in property is not specified, the location of the created record may be indeterminate, but is usually in the last appropriate container that was created, if any. (For example, creating a module record without specifying the file to create it in results in the module being placed within the last created file.) An error will result if no appropriate container exists (for example, attempting to create a conformance module if there are no conformance records).

Specifying Record Types

The values accepted for the recordType property are:

Option Description
-file Create a new File record
-module Create a new Module record
-typedef Create a new Type Assignment or TEXTUAL-CONVENTION
-node Create a new OBJECT-IDENTITY or OID Value Assignment
-moduleid Create a new MODULE-IDENTITY record
-object Create a new OBJECT-TYPE record
-ogroup Create a new OBJECT-GROUP record
-ngroup Create a new NOTIFICATION-GROUP record
-notification Create a new NOTIFICATION-TYPE or TRAP-TYPE record
-capability Create a new AGENT-CAPABILITIES record
-compliance Create a new MODULE-COMPLIANCE record
-cmodule Create a Conformance Module record in an AC or MC record
-variation Create a new Variation in a Conformance Module
-cgroup Create a new GROUP record within a MODULE-COMPLIANCE Module

Example 1 - Creating a new database:

% set db [smilib new]
smilib1

Example 2 - Creating a new file:

% set file [$db new -file]
@File1

Example 3 - Creating a new module:

% set module [$db new -module -name EXAMPLE-MIB -in $file]
@File1!EXAMPLE-MIB
< Prev Back to Table of Contents Next >