DotDBF: DBF Tool
The DotHRB DotDBF executable is a command-line tool for direct management, inspection, and manipulation of DBF files. It supports command execution via JSON input and direct command options.
Important
Currently, DotDBF exclusively supports DBFCDX with CDX production indexes. Support for additional DBF drivers and index schemas will be evaluated and introduced in future releases based on community demand and user feedback.
Usage Syntax
dotdbf [options]
1. ⚙️ Core Options and Configuration
These options control output, logging, connection, and file operations.
| Option | Description |
|---|---|
-h / -help | Display the help documentation. |
-v | Enable Verbose output. |
-o <file> | Set the output file path for results. |
-dbs <json|file> | Set dotdbs connection parameters (used for remote operations). |
-t <table.dbf> | Set the default DBF table to be used for subsequent commands. |
--license | Display license and copyright information. |
--version | Display the tool version. |
2. 📊 Data Query and Structure Options
These options are used to inspect the DBF file or define data retrieval criteria.
| Option | Description |
|---|---|
-model | Create a model file (e.g., Test.json) from the DBF structure in the Models directory. |
-stru | List the DBF structure (field names, types, etc.). |
-list ["params"] | List records based on query parameters. Syntax: "[field, ...] <where clause> [bool expr.]" |
-count <all|n> | Set the maximum number of records to list (n is the count, or all). |
-order <ordname> | Set a specific index order to use for listing records. |
-scope <top,bot> | Set the record scope using string boundary values (e.g., "A,Z"). |
-fields <f1,...> | Set the specific fields to display in the output list. |
-where <clause> | Set the SQL-style WHERE condition to filter records. |
-deleted | Include deleted records in the result set. |
-no-pretty | Output results as unformatted JSON (no pretty printing). |
3. 📊 Faker Options (requires npm "@faker-js/faker installed)
| Option | Description |
|---|---|
-faker-set | Set faker params. |
-faker-out | Creates the "Table".faker.json file. |
-faker-run | Run the faker script and update the "Table" |
4. ⌨️ Commands History
These commands are used for managing the command history.
| Command | Description |
|---|---|
: | List the history of log entries (previous commands). |
:? <search> | List log entries that contain the specified <search> string. |
:<n> | Recall and execute log entry number <n>. |
:$ | Recall and execute the last log entry. |
:@<template> | Recall a template** (e.g., @select). |
5. 📝 Practical Examples
| Scenario | Command | Result |
|---|---|---|
| Create Model File | dotdbf -t test.dbf -model | Creates the Test.json model file in the Models directory. |
| Output the create json | dotdbf test.dbf | Output the "create using json" to recreate the test.dbf and the indexes. |
| Quick List Records | dotdbf -list test.dbf | Lists the structure and all rows of test.dbf as a json. |
| Filtered List | dotdbf -list "first, last, zip where zip = '12345'" test.dbf | Lists first, last, zip where zip equals '12345'. |
| Execute Command File | dotdbf mydbsetup.json | Executes the set of commands defined within the mydbsetup.json file. |
| Export to Spreadsheet | dotdbf -o test.xlsx test.dbf | Creates an Excel spreadsheet (test.xlsx) from the DBF data and opens it automatically. |
| Remote DB Access | dotdbf -dbs "dbs.json" -u net:test.dbf :@select | Connects to the dotdbs server using connection parameters in dbs.json, sets the remote table, and runs a stored select template. |