tdbcmd
Perform basic database table queries.
tdbcmd [tablename] [-sortby fieldname] [-for fieldname=value ...] [-forexpr expr] [-all] [-rec recno ...] [-set fieldname=value ...] [-delete] [-append fieldname=value ...] [-loadcsv filename] [-html] [-csv] [-xml] [-wiki] [-print [fieldname [...]]] [-input fieldname filename] [-sort [fieldname [...]]] [-else] [-tdbcmd]
tdbcmd -tables
tdbcmd [tablename] -schema
The tdbcmd command allows the shell scriptor to perform basic database table operations: search, change fields, delete, append, and print. By default, operations are performed on PC database table. Specify a different database table with the first parameter.
Option |
Description |
tablename |
Specify the database table name such as PC (default), Setting, PCLog, Monster,and so on. Default: PC. |
-sortby fieldname -sortby +fieldname -sortby -fieldname |
When querying records using -for, specify how the results should be sorted. Specify a leading + for ascending order (the default) or a leading - for descending order. |
-for fieldname=value ... |
Search for database table records using one or more matching search criteria which is ANDed together. Note that the field name must be valid for the database table. Since field names or values may have spaces in them, it is good practice to enclose them in quotes, e.g. "IP Hostname=paris.hanoversoft.com". The -for command line option must come before an operation so the operation will act upon the records found. |
-forexpr expr |
Search for database table records that matches the provided expression, which contains valid field names comparison operators, logic operators, and parenthesis. |
-rec recno ... |
Use the specified records (referenced by record number) for the operations that follow. |
-all |
Use all records in the database table for the operations that follow. |
-set fieldname=value ... |
From the records found with -for, perform the field assignment(s) specified. Dates may be specified as either YYYY-MM-DD or MM/DD/YYYY (and YYYY may be just YY). |
-delete |
From the records found with -for, delete them. |
-else |
If no records were found, then perform the operations on the rest of the command line. This is handy when doing a search to set a value, but the search turned up no record (so you want to append instead): -for search -set assignment -else -append assignments |
-append fieldname=value ... |
Append a new record to the database table and perform the specified field assignment(s) to initialize the new record. |
-html |
Output the fields for -print using HTML tags. |
-csv |
Output the fields for -print using CVS format (comma value separators). |
-xml |
Output the fields for -print using XML tags. The DTD is output standalone with the data. |
-wiki |
Output the fields for -print using Wiki markup tags. |
-schema |
Output the table schema (field ids, field names, field types). |
-print [fieldname [ ... ]] |
From the records found with -for, output the specified fields. If no fields are specified, then output the record numbers. The field names may be separated by spaces or commas. |
-input fieldname filename |
From the records found with -for, input the specified field's value from the file specified. |
-sort [fieldname [ ... ]] |
From the records found with -for, sort them using the specified fields (first field primary). If no fields are specified, then they are sorted by record numbers. The field names may be separated by spaces or commas. |
-loadcsv filename |
Load records into the database table from the CSV file filename. The top row of the CSV file must have the field names for the data below them (case matters). If the record has an Id field, tdbcmd will check to see if the record already exists; if it exists, it will update the record, otherwise it will append the new record. |
-tdbcmd |
Generate command line output to run tdbcmd and set the values of the found records, whether appending them or setting them. The record id is set, too. |
-tables |
Output a list of all known database tables. |
-schema |
Output the schema for the table provided. |