The db and dbm database command line applications take interactive commands and send requests to the Bbuuzzb database engine/server. db is a stand-alone GPL application and dbm is the same GPL application for the client/server Bbuuzzb database server.
Each command request starts with a command keyword followed by a series of parameters. The command keyword must be complete (no abbreviations are allowed) and can be given in upper, lower or mixed case. All parameters are space delimited command words. All parameters containing spaces must be quoted with either single or double quotes but they must match. These command line applications use the single quote to pass parameters to the Bbuuzzb database engine/server so the use of single quotes within a parameter is not allowed. Unless specifically mentioned, all commands are valid for the single-user db and the multi-user dbm applications.
Note that starting in GPL package version 1.2-2000.05.03, the keyword connecting character has been changed from an underscore (_) to a period (.).
Here is a list of the database commands:
Syntax: off
This command will exit the db or dbm application. Note that no check is currently made for open tables. Make sure you close all tables that you have opened before exiting the application.
Syntax: open file_name|table_name
This command will open a Bbuuzzb table. The actual OS file name should be given in the case of the single-user db application or with the client/server dbm application when the catalog is not in use (refer to the config.set.catalog.flag command). The complete path and file name must be given when opening a table based on its OS file name. When the catalog is in use, you may only open a table using the table name instead of the physical OS file name. The catalog is only valid in multi-user mode.
Once the table is successfully open, the tid will be displayed on the screen. Most db/dbm commands require the tid as the first parameter. The table file pointer will be positioned at the top of the table. The will be no current record and the enforce change record flag will not be on.
Syntax: close tid
This command will close a table. The table must have already be opened and the tid must be valid. If the current record has changed and record changes are enforced, the table will not close. The current record must be written or the enforce change record flag must be lowered.
Syntax: next tid
This command will advance the table file pointer to the next record in the table. The record contents will be loaded into the record buffer. If the file pointer is already at the end of the table, eof will be returned. If the current record has changed and record changes are enforced, the file pointer will not be advanced. The current record must be written or the enforce change record flag must be lowered.
Syntax: top tid
This command will move the table file pointer to the top of the table. There will be no current record. If the current record has changed and record changes are enforced, the file pointer will not be move to the top of the table. The current record must be written or the enforce change record flag must be lowered.
Syntax: get.rec tid
This command will get and display the contents of the current record.
Syntax: get.field tid field_number
This command will get and display the contents of the specific field_number.
Syntax: goto tid record_number
This command will move the table file pointer to the specific record_number from the top of the table. The record_number is a sequential count from top of the table. The contents of the specific record will be loaded into the record buffer. If the current record has changed and record changes are enforced, the file pointer will not be moved. The current record must be written or the enforce change record flag must be lowered.
Syntax: count tid [all]
This command will count records in the table. Records will be counted in accordance with the delete flag (see the get.delete.flag command) unless the all option is specified, in which case, all records will be counted (even ones marked for deletion). If the current record has changed and record changes are enforced, the count will not take place. The current record must be written or the enforce change record flag must be lowered.
Syntax: put.field tid field_number field_data
This command will put field_data into the specified field_number of the current record. There must be a current record or you must have declared a new record. If field_data contains spaces, you must quote the string.
Syntax: write tid
This command will write a new record or re-write an existing record. An existing record will be re-written even if has not been changed. A new record must contain data. Empty records are not allowed to be written.
Syntax: delete tid
This command will mark the current record for deletion. The record will not be physically deleted until a pack is performed. If the current record has changed and record changes are enforced, the delete will not take place. The current record must be written or the enforce change record flag must be lowered.
Syntax: get.delete.flag tid
This command will get the current value of the process deleted flag. The Bbuuzzb database engine uses this flag to indicate whether records marked for deletion should be included in record processing.
Syntax: set.delete.flag tid flag_value
This command will set the process deleted flag to the flag_value which must be zero or one. The Bbuuzzb database engine uses this flag to indicate whether records marked for deletion should be included in record processing.
Syntax: get.nfields tid
This command will get and display the number of fields in the current record. There must be a current record to report on.
Syntax: get.rec.size tid
This command will get and display the size (in bytes) of the current record. There must be a current record to report on.
Syntax: get.field.size tid field_number
This command will get and display the size (in bytes) of the field field_number within the current record. Zero bytes is a valid field size. There must be a current record to report on.
Syntax: get.rec.num tid
This command will get and display the current record number. Record numbers are sequential from the top of the table.
Syntax: get.pos tid
This command will get and display the current file position within the table. The file position starts from zero which is the top of the table.
Syntax: set.pos tid file_position
This command will set the file pointer to the file_position which must be a numeric byte offset from the beginning of the table (which is offset zero). The file_position must be the start of a record. An error will be flagged (upon the next read record) if you attempt to position the file pointer to anywhere except the start of a record. If the current record has changed and record changes are enforced, the set position will not take place. The current record must be written or the enforce change record flag must be lowered.
Syntax: get.change.rec.flag tid
This command will get and display the current value of the table change record flag. This flag is automatically maintained by the Bbuuzzb database engine to indicate when a record has been changed/updated. This flag may be manually updated with the command set.change.rec.flag.
Syntax: set.change.rec.flag tid flag_value
This command will set the change record flag to the flag_value which must be zero or one.
Syntax: pack tid
This command will pack the table by physically removing all records marked for deletion. The table is packed by copying all active records to a temporary table (built in the directory specified by the temporary path configuration parameter) and then deleting the original table and renaming the temporary table back to the original file name. If the current record has changed and record changes are enforced, the pack will not take place. The current record must be written or the enforce change record flag must be lowered.
Syntax: new tid
This command will set up the table for a new record. This command must be issued just prior to building a new table record. When this command is executed, the Bbuuzzb database engine will move the record pointer to the top of the table and change the current record number to zero. The write command uses these indicators to detect a new record as opposed to an existing record. If the current record has changed and record changes are enforced, the set up for a new record will not take place. The current record must be written or the enforce change record flag must be lowered.
Syntax: find tid search_string [case_flag]
This command will search the table from the start of the current record (if any) for the search_string. All fields in each record will be searched. Only whole words will match. This command will stop at the first match and display the field number where the match occurred. This form of search cannot be used to locate a string containing multiple words. String comparison is case insensitive by default unless the case_flag is specified (zero indicates case sensitive, one indicates case insensitive).
Syntax: find.field tid field_number search_string [case_flag]
This command will search the table from the start of the current record (if any) for the search_string. Only field field_number will be searched in each record. Only whole words will match. This command will stop at the first match and display the field number where the match occurred. This form of search cannot be used to locate a string containing multiple words. String comparison is case insensitive by default unless the case_flag is specified (zero indicates case sensitive, one indicates case insensitive).
Syntax: find.part tid search_string [case_flag]
This command will search the table from the start of the current record (if any) for the search_string. All fields in each record will be searched. Any part of the word will match. This command will stop at the first match and display the field number where the match occurred. This form of search can be used to locate a string containing multiple words by using a space delimited quoted search_string. String comparison is case insensitive by default unless the case_flag is specified (zero indicates case sensitive, one indicates case insensitive).
Syntax: find.field.part tid field_number search_string [case_flag]
This command will search the table from the start of the current record (if any) for the search_string. Only field field_numberwill be searched in each record. Any part of the word will match. This command will stop at the first match and display the field number where the match occurred. This form of search can be used to locate a string containing multiple words by using a space delimited quoted search_string. String comparison is case insensitive by default unless the case_flag is specified (zero indicates case sensitive, one indicates case insensitive).
Syntax: get.rec.count tid
This command will get and display the current record count.
Syntax: get.enf.change.rec.flag tid
This command will get and display the value of the enforce change record flag. The Bbuuzzb database engine uses this flag to determine whether record changes should be enforced. When record changes are enforced, no re-positioning of the file pointer is allowed until the changed record has been written to disk.
Syntax: set.enf.change.rec.flag tid flag_value
This command will set the enforce change record flag to the flag_value which must be zero or one.
Syntax: get.is.table.locked tid
This command will get and display the value of the table locked flag. The Bbuuzzb database engine uses this flag when table maintenance is taking place. Normally, this flag is only used in multi-user environments.
Syntax: set.is.table.locked tid flag_value
This command will set the value of the table locked flag to flag_value which must be zero or one.
Syntax: new.table file_name tid_flag
This command will create a new Bbuuzzb table. In addition, if the tid_flag is one, the new table will be opened and the tid will be displayed. The file_name must contain the path and file name. The tid_flag must have the value of zero or one.
Syntax: config.get.tmp.path
This command will get and display the value of the current temporary path. The temporary path is used to store temporary files.
Syntax: config.get.log
This command will get and display the value of the current log file. Note that the log is always the system log server in the case of multi-user environments. Database logging may be turned on or off using the config.set.log.flag command. Note that when logging is turned on, the speed of the Bbuuzzb database engine will be affected and the size of the log file will grow rapidly.
Syntax: config.get.session
This command will get and display the current session table. The Bbuuzzb database server uses the session table to store record contents when the particular table is not currently being worked on. The session table may be turned off (at the penalty of the Bbuuzzb database server using much more memory) by using the config.set.session.flag command. This command is only valid in multi-user mode.
Syntax: config.get.catalog
This command will get and display the current catalog table. The Bbuuzzb database server uses the catalog table to store a list of available tables including their physical file names and aliases. The catalog table feature may be turned off by using the config.set.catalog.flag command. This command is only valid in multi-user mode.
Syntax: config.get.log.flag
This command will get and display the current value of the log flag. The log flag controls whether Bbuuzzb database logging will take place.
Syntax: config.get.session.flag
This command will get and display the current value of the session flag. The session flag controls whether the Bbuuzzb database server uses the session table during its operation. Note that session table processing is active only in multi-user mode.
Syntax: config.get.catalog.flag
This command will get and display the current value of the catalog flag. The catalog flag controls whether the Bbuuzzb database server uses the catalog table during its operation. Note that catalog table processing is active only in multi-user mode.
Syntax: config.get.version
This command will get and display the current version of the Bbuuzzb database engine. Note that this version number is different than the version of db or dbm.
Syntax: config.set.tmp.path tmp_path
This command will set the Bbuuzzb database engine temporary files path to tmp_path which must be a valid path that the engine can create files in. The path will be tested for read/write ability.
Syntax: config.set.log log_file
This command will set the Bbuuzzb database engine log file to log_file. Since the log is always set to the system logger in multi-user mode, this command is invalid when in multi-user mode.
Syntax: config.set.session session_table
This command will set the Bbuuzzb database server session table to session_table which may or may not exist. If the session_table does not exist, it will be created. Since the session table is valid only in multi-user mode, this command is also only valid in multi-user mode.
Syntax: config.set.catalog catalog_table
This command will set the Bbuuzzb database server catalog table to catalog_table which must already exist. The engine will attempt to open the given catalog. Since the catalog table is valid only in multi-user mode, this command is also only valid in multi-user mode.
Syntax: config.set.log.flag log_flag
This command will set the log flag to log_flag which must be either zero or one. The log flag allows you to turn application logging on or off.
Syntax: config.set.session.flag session_flag
This command will set the session flag to session_flag which must be either zero or one. The session flag allows you to turn the database server session table support on or off. Note that since the session table is specific to multi-user mode only, this command is only valid in multi-user mode.
Syntax: config.set.catalog.flag catalog_flag
This command will set the catalog flag to catalog_flag which must be either zero or one. The catalog flag allows you to turn the database server catalog table support on or off. Note that since the catalog table is specific to multi-user mode only, this command is only valid in multi-user mode.
Syntax: version
This command will obtain and display the current version of the currently connected Bbuuzzb server. This command is only valid in multi-user mode.