{
    "content": [
        {
            "type": "text",
            "text": "# db5.3_codegen (man)\n\n## NAME\n\ndb5.3codegen — generate application code for Berkeley DB\n\n## SYNOPSIS\n\ndb5.3codegen [-Vv] [-a api] [-i file] [-o prefix]\n\n## DESCRIPTION\n\nThe  db5.3codegen  utility  generates  application  code to create and configure Berkeley DB\ndatabase environments and databases based on a simple description language and writes  it  to\none  or  more output files.  The generated code may need modification, in the case of compli‐\ncated applications, but will usually significantly reduce the time required to create  Berke‐\nley DB applications.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (5 subsections)\n- **Specification Language** (2 subsections)\n- **AUTHORS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "db5.3_codegen",
        "section": "",
        "mode": "man",
        "summary": "db5.3codegen — generate application code for Berkeley DB",
        "synopsis": "db5.3codegen [-Vv] [-a api] [-i file] [-o prefix]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "Generate code for the specified API (currently, only “c” is accepted)."
            },
            {
                "flag": "-i",
                "long": null,
                "arg": null,
                "description": "Specify an input file; by default, standard input is used."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "Specify an output file prefix; by default, “application” is used."
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": "The db5.3codegen utility exits 0 on success, and >0 if an error occurs. C Language Specific Information By default, when the db5.3codegen 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 (DBENV) handles and database (DB) handles, as specified by the description language. The database environ‐ ment handle variables are named “XXXdbenv”, 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 “XXXYYY”, 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: bdbstartup() and bdbshutdown(). The bdbstartup() function should be called to create and configure the database environments and databases, and the bdbshutdown() function should be called to gracefully shut down the envi‐ ronments and databases."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": [
                    {
                        "name": "-a _",
                        "lines": 2,
                        "flag": "-a"
                    },
                    {
                        "name": "-i _",
                        "lines": 2,
                        "flag": "-i"
                    },
                    {
                        "name": "-o _",
                        "lines": 2,
                        "flag": "-o"
                    },
                    {
                        "name": "-V",
                        "lines": 1,
                        "flag": "-V"
                    },
                    {
                        "name": "-v",
                        "lines": 19,
                        "flag": "-v"
                    }
                ]
            },
            {
                "name": "Specification Language",
                "lines": 70,
                "subsections": [
                    {
                        "name": "Environment Keywords",
                        "lines": 23
                    },
                    {
                        "name": "Database Keywords",
                        "lines": 74
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "db5.3codegen — generate application code for Berkeley DB\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "db5.3codegen [-Vv] [-a api] [-i file] [-o prefix]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The  db5.3codegen  utility  generates  application  code to create and configure Berkeley DB\ndatabase environments and databases based on a simple description language and writes  it  to\none  or  more output files.  The generated code may need modification, in the case of compli‐\ncated applications, but will usually significantly reduce the time required to create  Berke‐\nley DB applications.\n\nThe options are as follows:\n",
                "subsections": [
                    {
                        "name": "-a _",
                        "content": "Generate code for the specified API (currently, only “c” is accepted).\n",
                        "flag": "-a"
                    },
                    {
                        "name": "-i _",
                        "content": "Specify an input file; by default, standard input is used.\n",
                        "flag": "-i"
                    },
                    {
                        "name": "-o _",
                        "content": "Specify an output file prefix; by default, “application” is used.\n",
                        "flag": "-o"
                    },
                    {
                        "name": "-V",
                        "content": "",
                        "flag": "-V"
                    },
                    {
                        "name": "-v",
                        "content": "The db5.3codegen utility exits 0 on success, and >0 if an error occurs.\n\nC Language Specific Information\nBy  default,  when  the  db5.3codegen  utility generates C-language code, the output file is\nnamed “application.c”.  The output filename can be specified with the -o option.\n\nAt the beginning of the output file is a list of public database environment (DBENV) handles\nand database (DB) handles, as specified by the description language.  The  database  environ‐\nment  handle  variables  are named “XXXdbenv”, where “XXX” is the name of the environment in\nthe input specification.  For databases associated with a database environment, the  database\nhandle  variables  are named “XXXYYY”, where “XXX” is the name of the environment, and “YYY”\nis the name of the database.  For standalone databases, the  database  handle  variables  are\nnamed “XXX”, where “XXX” is the name of the database.\n\nThere  are  two  public  functions in the output file: bdbstartup() and bdbshutdown().  The\nbdbstartup() function should be called to create and configure the database environments and\ndatabases, and the bdbshutdown() function should be called to gracefully shut down the envi‐\nronments and databases.\n",
                        "flag": "-v"
                    }
                ]
            },
            "Specification Language": {
                "content": "The db5.3codegen uses a simple description language:\n\n•   Lines in the input consist of white-space separated tokens.\n•   Tokens are case-insensitive.\n•   Empty lines and lines where the first non-space character is a hash mark  (“#”)  are  ig‐\nnored.   In  addition,  hash  marks may appear in lines, in which case the content of the\nline from the hash mark to the end of the line is ignored.\n\nThere are two top-level objects: “environment” and “database”, which correspond  to  database\nenvironments  and  databases,  respectively.   These top-level objects can be associated with\nkeywords to describe their configuration and relationships.\n\nFor example, the following input would create two standalone databases:\n\ndatabase dataone {\ntype btree\n}\ndatabase datatwo {\ntype btree\n}\n\nIn this case, there would be no DBENV handle, and the public DB handles would be:\n\nDB      *dataone;\nDB      *datatwo;\n\nFor example, the following input would create a database  environment  which  contains  three\ndatabases:\n\nenvironment myenv {\ndatabase dataone {\ntype btree\n}\ndatabase datatwo {\ntype btree\n}\ndatabase datathree {\ntype btree\n}\n}\n\nIn this case, the public DBENV and DB handles would be:\n\nDBENV  *myenvdbenv;\nDB      *myenvdataone;\nDB      *myenvdatatwo;\nDB      *myenvdatathree;\n\nA  variety of keywords can be specified for the databases and the environments.  For example,\nthe cache size can be specified for the database environment, and the page size can be speci‐\nfied for the database, as well as for secondary relationships:\n\nenvironment myenv {\ncachesize 2 0 10\ndatabase dataone {\ntype btree\npagesize 1024\n}\ndatabase datatwo {\nprimary dataone\nsecondaryoffset 10 15\ntype btree\npagesize 32768\n}\ndatabase datathree {\ntype btree\npagesize 512\n}\n}\n",
                "subsections": [
                    {
                        "name": "Environment Keywords",
                        "content": "environment       Start a database environment block.\n\nThere must be three tokens on the line: the keyword, the name of the  envi‐\nronment and an opening brace (“{”).\n\nhome              Specify the database environment home directory.\n\nThere must be two tokens on the line: the keyword and the home directory.\n\ncachesize         Specify the database environment cache size.\n\nThere  must be two tokens on the line: the keyword, the gigabytes of cache,\nthe bytes of cache, and the number of  caches  (the  number  of  underlying\nphysical areas into which the cache is logically divided).\n\nprivate           Specify the database environment is private.\n\nThere must be one token on the line: the keyword by itself.\n\n}                 End the database environment block.\n\nThere must be one token on the line: the keyword by itself.\n"
                    },
                    {
                        "name": "Database Keywords",
                        "content": "database          Start a database block.\n\nThere  must be three tokens on the line: the keyword, the name of the data‐\nbase and an opening brace (“{”).\n\ncustom            Specify a custom key-comparison routine.  This is used when the Btree data‐\nbase requires a specific sort that db5.3codegen cannot generate.   A  stub\nkey  comparison  routine  will  be  created and configured for the database\nwhich should be modified as necessary.  See the “keytype” keyword for more\ninformation.\n\nThere must be one token on the line: the keyword by itself.\n\ndupsort           Configure the database to support sorted duplicates.\n\nThere must be one token on the line: the keyword by itself.\n\nextentsize        Configure the size of the Queue database extent files.\n\nThere must be two tokens on the line: the keyword and the extent file size,\nas a number of pages.\n\nkeytype          Configure a integral type key-comparison routine.  This is  used  when  the\nBtree  database  key  is  an  integral  type  (such  as  “unsigned  int” or\n“uint32t”).  Any C-language integral type  may  be  specified.   See  the\n“custom” keyword for more information.  A Btree comparison routine based on\nthe type of the key will be created and configured.\n\nThere must be two tokens on the line: the keyword and the type.\n\npagesize          Configure the database page size.\n\nThere  must  be  two  tokens  on the line: the keyword and the page size in\nbytes.\n\nprimary           Configure the database as a secondary index.   A  stub  secondary  callback\nroutine  will  be  created and configured for the database, which should be\nmodified as necessary.  See the “secondaryoffset” keyword for more  infor‐\nmation.\n\nThere  must be two tokens on the line: the keyword and the name of the pri‐\nmary database for which this database is a secondary.\n\nrecnum            Configure the Btree database to support record number access.\n\nThere must be one token on the line: the keyword by itself.\n\nrelen            Configure the record length for a Queue database or  a  fixed-length  Recno\ndatabase.\n\nThere  must  be  two  tokens  on  the line: the keyword and the length of a\nrecord, in bytes.\n\nsecondaryoffset  Configure a secondary callback routine based on a byte string found in  the\nprimary database's data item.\n\nThere  must  be three tokens on the line: the keyword, the byte offset from\nthe beginning of the primary data item where the secondary key occurs,  and\nthe length of the secondary key in bytes.\n\ntransaction       Configure the database (and, by extension, the database environment), to be\ntransactional.\n\nThere must be one token on the line: the keyword by itself.\n\ntype              Configure the database type.\n\nThere  must  be two tokens on the line: the keyword and the type, where the\ntype is one of “btree”, “hash”, “queue” or “recno”.\n\n}                 End the database environment block.\n\nThere must be one token on the line: the keyword by itself.\n"
                    }
                ]
            },
            "AUTHORS": {
                "content": "Thorsten Glaser <tg@debian.org> wrote this manual page for the Debian  project  (but  may  be\nused  by  others)  after the original HTML format documentation Copyright © 1996,2008 Oracle.\nAll rights reserved.\n\nBerkeley DB                               January 12, 2011                          DB5.3CODEGEN(1)",
                "subsections": []
            }
        }
    }
}