man > db5.3_codegen(1)

DB5.3_CODEGEN(1) BSD General Commands Manual DB5.3_CODEGEN(1)

πŸ“– NAME

db5.3_codegen β€” generate application code for Berkeley DB

πŸš€ Quick Reference

Use CaseCommandDescription
Generate C language code from a specification filedb5.3_codegen -a c -i spec.txtReads spec.txt and outputs C code to application.c
Specify an output file prefixdb5.3_codegen -a c -o myappGenerates myapp.c instead of default application.c
Show version informationdb5.3_codegen -VPrints library version and exits
Run in verbose modedb5.3_codegen -vProvides detailed output during code generation
Read from standard inputecho "..." | db5.3_codegen -a cAccepts specification via stdin

πŸ“‹ SYNOPSIS

db5.3_codegen [-Vv] [-a api] [-i file] [-o prefix]

πŸ“ DESCRIPTION

The db5.3_codegen utility generates application code to create and configure Berkeley DB database environments and databases based on a simple description language and writes it to one or more output files. The generated code may need modification, in the case of complicated applications, but will usually significantly reduce the time required to create Berkeley DB applications.

The options are as follows:

πŸ”§ -a api

Generate code for the specified API (currently, only β€œc” is accepted).

πŸ“‚ -i file

Specify an input file; by default, standard input is used.

πŸ“ -o prefix

Specify an output file prefix; by default, β€œapplication” is used.

ℹ️ -V

Write the library version number to standard output and exit.

πŸ”Š -v

Run in verbose mode.

The db5.3_codegen utility exits 0 on success, and >0 if an error occurs.

πŸ’» C Language Specific Information

By default, when the db5.3_codegen utility generates C-language code, the output file is named β€œapplication.c”. The output filename can be specified with the -o option.

At the beginning of the output file is a list of public database environment (DB_ENV) handles and database (DB) handles, as specified by the description language. The database environment handle variables are named β€œXXX_dbenv”, where β€œXXX” is the name of the environment in the input specification. For databases associated with a database environment, the database handle variables are named β€œXXX_YYY”, where β€œXXX” is the name of the environment, and β€œYYY” is the name of the database. For standalone databases, the database handle variables are named β€œXXX”, where β€œXXX” is the name of the database.

There are two public functions in the output file: bdb_startup() and bdb_shutdown(). The bdb_startup() function should be called to create and configure the database environments and databases, and the bdb_shutdown() function should be called to gracefully shut down the environments and databases.

πŸ“œ Specification Language

The db5.3_codegen uses a simple description language:

There are two top-level objects: β€œenvironment” and β€œdatabase”, which correspond to database environments and databases, respectively. These top-level objects can be associated with keywords to describe their configuration and relationships.

For example, the following input would create two standalone databases:

database data_one {
    type btree
}
database data_two {
    type btree
}

In this case, there would be no DB_ENV handle, and the public DB handles would be:

DB      *data_one;
DB      *data_two;

For example, the following input would create a database environment which contains three databases:

environment myenv {
    database data_one {
        type btree
    }
    database data_two {
        type btree
    }
    database data_three {
        type btree
    }
}

In this case, the public DB_ENV and DB handles would be:

DB_ENV  *myenv_dbenv;
DB      *myenv_data_one;
DB      *myenv_data_two;
DB      *myenv_data_three;

A variety of keywords can be specified for the databases and the environments. For example, the cache size can be specified for the database environment, and the page size can be specified for the database, as well as for secondary relationships:

environment myenv {
    cachesize 2 0 10
    database data_one {
        type btree
        pagesize 1024
    }
    database data_two {
        primary data_one
        secondary_offset 10 15
        type btree
        pagesize 32768
    }
    database data_three {
        type btree
        pagesize 512
    }
}

🌐 Environment Keywords

πŸ—„οΈ Database Keywords

✍️ AUTHORS

Thorsten Glaser <tg AT debian.org> wrote this manual page for the Debian project (but may be used by others) after the original HTML format documentation Copyright Β© 1996,2008 Oracle. All rights reserved.

Berkeley DB January 12, 2011 Berkeley DB

db5.3_codegen(1)
DB5.3_CODEGEN(1) BSD General Commands Manual DB5.3_CODEGEN(1) πŸ“– NAME πŸš€ Quick Reference πŸ“‹ SYNOPSIS πŸ“ DESCRIPTION
πŸ”§ -a api πŸ“‚ -i file πŸ“ -o prefix ℹ️ -V πŸ”Š -v
πŸ’» C Language Specific Information πŸ“œ Specification Language
🌐 Environment Keywords πŸ—„οΈ Database Keywords
✍️ AUTHORS

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-03 19:01 @216.73.216.23
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^