From efa2666ada7fcc7679ee8b6031d71855f46e5c6d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 8 Sep 2022 16:26:08 +0300 Subject: Use ad hoc recipes to compile options.cli file --- build/root.build | 19 +- doc/.gitignore | 5 +- doc/buildfile | 187 +- doc/doc.sh | 78 - doc/pregenerated/odb.1 | 799 ++++++++ doc/pregenerated/odb.xhtml | 978 ++++++++++ manifest | 2 + odb/.gitignore | 5 +- odb/buildfile | 91 +- odb/options.cxx | 3984 -------------------------------------- odb/options.hxx | 2340 ---------------------- odb/options.ixx | 3471 --------------------------------- odb/pregenerated/odb/options.cxx | 3984 ++++++++++++++++++++++++++++++++++++++ odb/pregenerated/odb/options.hxx | 2340 ++++++++++++++++++++++ odb/pregenerated/odb/options.ixx | 3471 +++++++++++++++++++++++++++++++++ repositories.manifest | 4 + 16 files changed, 11837 insertions(+), 9921 deletions(-) delete mode 100755 doc/doc.sh create mode 100644 doc/pregenerated/odb.1 create mode 100644 doc/pregenerated/odb.xhtml delete mode 100644 odb/options.cxx delete mode 100644 odb/options.hxx delete mode 100644 odb/options.ixx create mode 100644 odb/pregenerated/odb/options.cxx create mode 100644 odb/pregenerated/odb/options.hxx create mode 100644 odb/pregenerated/odb/options.ixx diff --git a/build/root.build b/build/root.build index aea8d03..a07e058 100644 --- a/build/root.build +++ b/build/root.build @@ -1,6 +1,13 @@ # file : build/root.build # license : GNU GPL v3; see accompanying LICENSE file +config [bool] config.odb.develop ?= false + +develop = $config.odb.develop + +define cli: file +cli{*}: extension = cli + cxx.std = latest using cxx @@ -46,11 +53,11 @@ if ($build.mode != 'skeleton') config [config.report] plugin_dir - # Load the cli module but only if it's available. This way a distribution - # that includes pre-generated files can be built without installing cli. - # This is also the reason why we need to explicitly spell out individual - # source file prerequisites instead of using the cli.cxx{} group (it won't - # be there unless the module is configured). + # Extract the copyright notice from the LICENSE file. + # + # Note that cat is a builtin which means this is both portable and fast. # - using? cli + copyright = $process.run_regex(cat $src_root/LICENSE, \ + 'Copyright \(c\) (.+)\.', \ + '\1') } diff --git a/doc/.gitignore b/doc/.gitignore index 5accfef..9ee2af2 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,4 +1,5 @@ -odb.xhtml -odb.1 +/odb.1 +/odb.xhtml + *.ps *.pdf diff --git a/doc/buildfile b/doc/buildfile index 45b7ac2..832897c 100644 --- a/doc/buildfile +++ b/doc/buildfile @@ -7,14 +7,187 @@ css{*}: extension = css define xhtml: doc xhtml{*}: extension = xhtml -./: css{default} +define ps: doc +ps{*}: extension = ps -# @@ BUILD2 TMP: auto-generated and not in git (also odb-manual.* below) +define pdf: doc +pdf{*}: extension = pdf + +define html2ps: file +html2ps{*}: extension = html2ps + +./: css{default} xhtml{manual} doc{*.png} file{*.svg} + +# Man pages. +# + +## Consumption build ($develop == false). +# + +# Use pregenerated versions in the consumption build. # -./: file{odb-*.1} file{odb-*.xhtml} - # {man1 xhtml}{odb} +./: pregenerated/{man1 xhtml}{*}: include = (!$develop) + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{man1 xhtml}{*}: dist = (!$develop) + +# +## + +## Development build ($develop == true). +# + +./: {man1 xhtml}{odb}: include = $develop + +if $develop +{ + doc_version = [string] "$version.major\.$version.minor\.$version.patch" + if $version.pre_release + doc_version += "-$version.pre_release_string" -./: doc{manual.xhtml} doc{*.png} file{*.svg +*.html2ps} - #doc{odb-manual.ps odb-manual.pdf} + doc_version = "3.0.0" -./: file{doc.sh} + # Let's take the last four-digit number to cover 2000-2021,2022. + # + doc_year = $regex.replace($copyright, '.+[-, ]([0-9][0-9][0-9][0-9]) .+', '\1') + + man_options = -v project="ODB" -v version="$doc_version" \ + -v copyright="$copyright" --suppress-undocumented + + import! [metadata] cli = cli%exe{cli} +} + +# In the development build distribute regenerated versions, remapping their +# locations to the paths of the pregenerated versions (which are only +# distributed in the consumption build; see above). This way we make sure that +# the distributed files are always up-to-date. +# +{man1 xhtml}{odb}: dist = ($develop ? pregenerated/ : false) + +# @@ TMP Note that the project, version, and date variables we are passing to +# cli are currently unused since the respective values are hard-coded +# in the odb-prologue.* files. +# +man1{odb}: ../odb/cli{options} file{odb-prologue.1 odb-epilogue.1} $cli +% +if $develop +{{ + # Use the copyright year to approximate the last authoring date. + # + $cli --generate-man $man_options \ + -v date="January $doc_year" \ + --man-prologue-file $path($<[1]) \ + --man-epilogue-file $path($<[2]) \ + --stdout $path($<[0]) >$path($>) + + # If the result differs from the pregenerated version, copy it over. + # + if! diff $src_base/pregenerated/odb.1 $path($>) >- + cp $path($>) $src_base/pregenerated/odb.1 + end +}} + +xhtml{odb}: ../odb/cli{options} file{odb-prologue.xhtml odb-epilogue.xhtml} $cli +% +if $develop +{{ + $cli --generate-html $man_options \ + --html-prologue-file $path($<[1]) \ + --html-epilogue-file $path($<[2]) \ + --stdout $path($<[0]) >$path($>) + + if! diff $src_base/pregenerated/odb.xhtml $path($>) >- + cp $path($>) $src_base/pregenerated/odb.xhtml + end +}} + +# +## + +# Manual. +# +# This case is slightly more involved because we make the generation of the +# manual's ps/pdf optional and also don't keep the result in the repository. +# Specifically: +# +# 1. In the consumption build we will install/redistribute ps/pdf if present. +# +# 2. In the development build we will generate ps/pdf if we are able to import +# the needed tools, issuing a warning otherwise. + +## Consumption build ($develop == false). +# + +# Use pregenerated versions, if exist, in the consumption build. +# +./: pregenerated/{ps pdf}{*}: include = (!$develop) + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{ps pdf}{*}: dist = (!$develop) + +# +## + +## Development build ($develop == true). +# + +html2pdf = false + +if $develop +{ + # Import the html2ps and ps2pdf programs from the system, if available. + # + import? html2ps = html2ps%exe{html2ps} + import? ps2pdf = ps2pdf14%exe{ps2pdf14} + + html2pdf = ($html2ps != [null] && $ps2pdf != [null]) + + if! $html2pdf + warn "html2ps and/or ps2pdf14 are not available, not generating .ps and .pdf documentation" +} + +./: {ps pdf}{odb-manual}: include = $html2pdf + +# In the development build distribute regenerated versions, remapping their +# locations to the paths of the pregenerated versions (which are only +# distributed in the consumption build; see above). This way we make sure that +# the distributed files are always up-to-date. +# +{ps pdf}{odb-manual}: dist = ($html2pdf ? pregenerated/ : false) + +# Note: the pregenerated file may not exist, thus --no-cleanup option is +# required for the cp builtin call. Strictly speaking we don't really need to +# copy them since they are not stored in the repository, but let's do that for +# consistency with the distributed source tree. +# +# @@ TMP Note that manual.{xhtml,html2ps} still have copyright years, ODB +# version, document revision/date, etc hard-coded. +# +ps{odb-manual}: {xhtml html2ps}{manual} $html2ps +% +if $html2pdf +{{ + options = + + diag html2ps ($<[0]) + $html2ps $options -f $path($<[1]) -o $path($>) $path($<[0]) + + cp --no-cleanup $path($>) $src_base/pregenerated/odb-manual.ps +}} + +pdf{odb-manual}: ps{odb-manual} $ps2pdf +% +if $html2pdf +{{ + options = -dOptimize=true -dEmbedAllFonts=true + + diag ps2pdf ($<[0]) + $ps2pdf $options $path($<[0]) $path($>) + + cp --no-cleanup $path($>) $src_base/pregenerated/odb-manual.pdf +}} + +# +## diff --git a/doc/doc.sh b/doc/doc.sh deleted file mode 100755 index 4e96aed..0000000 --- a/doc/doc.sh +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env bash - -version=2.5.0-b.6 - -trap 'exit 1' ERR -set -o errtrace # Trap in functions. - -function info () { echo "$*" 1>&2; } -function error () { info "$*"; exit 1; } - -date="$(date +"%B %Y")" -copyright="$(sed -n -re 's%^Copyright \(c\) (.+)\.$%\1%p' ../LICENSE)" - -while [ $# -gt 0 ]; do - case $1 in - --clean) - rm -f odb.xhtml odb.1 - rm -f odb-manual.ps odb-manual.pdf - exit 0 - ;; - *) - error "unexpected $1" - ;; - esac -done - -function compile () # -{ - local i=$1; shift - local o=$1; shift - - # Use a bash array to handle empty arguments. - # - local ops=() - while [ $# -gt 0 ]; do - ops=("${ops[@]}" "$1") - shift - done - - # --html-suffix .xhtml - cli -I .. \ --v project="odb" \ --v version="$version" \ --v date="$date" \ --v copyright="$copyright" \ -"${ops[@]}" --generate-html --stdout \ ---html-prologue-file odb-prologue.xhtml \ ---html-epilogue-file odb-epilogue.xhtml \ -"../odb/$i.cli" >"$o.xhtml" - - # --man-suffix .1 - cli -I .. \ --v project="odb" \ --v version="$version" \ --v date="$date" \ --v copyright="$copyright" \ -"${ops[@]}" --generate-man --stdout \ ---man-prologue-file odb-prologue.1 \ ---man-epilogue-file odb-epilogue.1 \ -"../odb/$i.cli" >"$o.1" -} - -compile options odb --suppress-undocumented - -# Manual. -# - -#function compile_doc () -#{ -# html2ps -f doc.html2ps:a4.html2ps -o "$n-a4.ps" "$n.xhtml" -# ps2pdf14 -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true "$n-a4.ps" "$n-a4.pdf" -# -# html2ps -f doc.html2ps:letter.html2ps -o "$n-letter.ps" "$n.xhtml" -# ps2pdf14 -sPAPERSIZE=letter -dOptimize=true -dEmbedAllFonts=true "$n-letter.ps" "$n-letter.pdf" -#} - -html2ps -f manual.html2ps -o odb-manual.ps manual.xhtml -ps2pdf14 -dOptimize=true -dEmbedAllFonts=true odb-manual.ps odb-manual.pdf diff --git a/doc/pregenerated/odb.1 b/doc/pregenerated/odb.1 new file mode 100644 index 0000000..10367a9 --- /dev/null +++ b/doc/pregenerated/odb.1 @@ -0,0 +1,799 @@ +.\" Process this file with +.\" groff -man -Tascii odb.1 +.\" +.TH ODB 1 "February 2015" "ODB 2.4.0" +.SH NAME +odb \- object-relational mapping (ORM) compiler for C++ +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH SYNOPSIS +.\"-------------------------------------------------------------------- +.B odb +.B [ +.I options +.B ] +.I file +.B [ +.IR file... +.B ] +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH DESCRIPTION +.\"-------------------------------------------------------------------- +Given a set of C++ classes in a header file, +.B odb +generates C++ code that allows you to persist, query, and update objects +of these classes in a relational database (RDBMS). The relational +database that the generated code should target is specified with the +required +.B --database +option (see below). + + +For an input file in the form +.B name.hxx +(other file extensions can be used instead of +.BR .hxx ), +in the single-database mode (the default), the generated C++ files by +default have the following names: +.B name-odb.hxx +(header file), +.B name-odb.ixx +(inline file), and +.B name-odb.cxx +(source file). Additionally, if the +.B --generate-schema +option is specified and the +.B sql +schema format is requested (see +.BR --schema-format ), +the +.B name.sql +database schema file is generated. If the +.B separate +schema format is requested, the database creation code is generated into +the separate +.B name-schema.cxx +file. + + +In the multi-database mode (see the +.B --multi-database +option below), the generated files corresponding to the +.B common +database have the same names as in the single-database mode. For other +databases, the file names include the database name: +.BR name-odb-\fIdb\fB.hxx , +.BR name-odb-\fIdb\fB.ixx , +.BR name-odb-\fIdb\fB.cxx , +.BR name-\fIdb\fB.sql , +and +.B name-schema-\fIdb\fB.cxx +(where +.I db +is the database name). +.\" +.\" +.\" +.\"-------------------------------------------------------------------- +.SH OPTIONS +.\"-------------------------------------------------------------------- +.IP "\fB--help\fR" +Print usage information and exit\. +.IP "\fB--version\fR" +Print version and exit\. +.IP "\fB-I\fR \fIdir\fR" +Add \fIdir\fR to the beginning of the list of directories to be searched for +included header files\. +.IP "\fB-D\fR \fIname\fR[=\fIdef\fR]" +Define macro \fIname\fR with definition \fIdef\fR\. If definition is omitted, +define \fIname\fR to be 1\. +.IP "\fB-U\fR \fIname\fR" +Cancel any previous definitions of macro \fIname\fR, either built-in or +provided with the \fB-D\fR option\. +.IP "\fB--database\fR|\fB-d\fR \fIdb\fR" +Generate code for the \fIdb\fR database\. Valid values are \fBmssql\fR, +\fBmysql\fR, \fBoracle\fR, \fBpgsql\fR, \fBsqlite\fR, and \fBcommon\fR +(multi-database mode only)\. +.IP "\fB--multi-database\fR|\fB-m\fR \fItype\fR" +Enable multi-database support and specify its type\. Valid values for this +option are \fBstatic\fR and \fBdynamic\fR\. + +In the multi-database mode, options that determine the kind (for example, +\fB--schema-format\fR), names (for example, \fB--odb-file-suffix\fR), or +content (for example, prologue and epilogue options) of the output files can +be prefixed with the database name followed by a colon, for example, +\fBmysql:value\fR\. This restricts the value of such an option to only apply +to generated files corresponding to this database\. +.IP "\fB--default-database\fR \fIdb\fR" +When static multi-database support is used, specify the database that should +be made the default\. When dynamic multi-database support is used, +\fBcommon\fR is always made the default database\. +.IP "\fB--generate-query\fR|\fB-q\fR" +Generate query support code\. Without this support you cannot use views and +can only load objects via their ids\. +.IP "\fB--generate-prepared\fR" +Generate prepared query execution support code\. +.IP "\fB--omit-unprepared\fR" +Omit un-prepared (once-off) query execution support code\. +.IP "\fB--generate-session\fR|\fB-e\fR" +Generate session support code\. With this option session support will be +enabled by default for all the persistent classes except those for which it +was explicitly disabled using the \fBdb session\fR pragma\. +.IP "\fB--generate-schema\fR|\fB-s\fR" +Generate the database schema\. The database schema contains SQL statements +that create database tables necessary to store persistent classes defined in +the file being compiled\. Note that by applying this schema, all the existing +information stored in such tables will be lost\. + +Depending on the database being used (\fB--database\fR option), the schema is +generated either as a standalone SQL file or embedded into the generated C++ +code\. By default the SQL file is generated for the MySQL, PostgreSQL, Oracle, +and Microsoft SQL Server databases and the schema is embedded into the C++ +code for the SQLite database\. Use the \fB--schema-format\fR option to alter +the default schema format\. + +If database schema evolution support is enabled (that is, the object model +version is specified), then this option also triggers the generation of +database schema migration statements, again either as standalong SQL files or +embedded into the generated C++ code\. You can suppress the generation of +schema migration statements by specifying the \fB--suppress-migration\fR +option\. +.IP "\fB--generate-schema-only\fR" +Generate only the database schema\. Note that this option is only valid when +generating schema as a standalone SQL file (see \fB--schema-format\fR for +details)\. +.IP "\fB--suppress-migration\fR" +Suppress the generation of database schema migration statements\. +.IP "\fB--suppress-schema-version\fR" +Suppress the generation of schema version table\. If you specify this option +then you are also expected to manually specify the database schema version and +migration state at runtime using the \fBodb::database::schema_version()\fR +function\. +.IP "\fB--schema-version-table\fR \fIname\fR" +Specify the alternative schema version table name instead of the default +\fBschema_version\fR\. If you specify this option then you are also expected +to manually specify the schema version table name at runtime using the +\fBodb::database::schema_version_table()\fR function\. The table name can be +qualified\. +.IP "\fB--schema-format\fR \fIformat\fR" +Generate the database schema in the specified format\. Pass \fBsql\fR as +\fIformat\fR to generate the database schema as a standalone SQL file or pass +\fBembedded\fR to embed the schema into the generated C++ code\. The +\fBseparate\fR value is similar to \fBembedded\fR except the schema creation +code is generated into a separate C++ file (\fBname-schema\.cxx\fR by +default)\. This value is primarily useful if you want to place the schema +creation functionality into a separate program or library\. Repeat this option +to generate the same database schema in multiple formats\. +.IP "\fB--omit-drop\fR" +Omit \fBDROP\fR statements from the generated database schema\. +.IP "\fB--omit-create\fR" +Omit \fBCREATE\fR statements from the generated database schema\. +.IP "\fB--schema-name\fR \fIname\fR" +Use \fIname\fR as the database schema name\. Schema names are primarily used +to distinguish between multiple embedded schemas in the schema catalog\. They +are not to be confused with database schemas (database namespaces) which are +specified with the \fB--schema\fR option\. If this option is not specified, +the empty name, which is the default schema name, is used\. +.IP "\fB--fkeys-deferrable-mode\fR \fIm\fR" +Use constraint checking mode \fIm\fR in foreign keys generated for object +relationships\. Valid values for this option are \fBnot_deferrable\fR, +\fBimmediate\fR, and \fBdeferred\fR (default)\. MySQL and SQL Server do not +support deferrable foreign keys and for these databases such keys are +generated commented out\. Other foreign keys generated by the ODB compiler +(such as the ones used to support containers and polymorphic hierarchies) are +always generated as not deferrable\. + +Note also that if you use either \fBnot_deferrable\fR or \fBimmediate\fR mode, +then the order in which you persist, update, and erase objects within a +transaction becomes important\. +.IP "\fB--default-pointer\fR \fIptr\fR" +Use \fIptr\fR as the default pointer for persistent objects and views\. +Objects and views that do not have a pointer assigned with the \fBdb +pointer\fR pragma will use this pointer by default\. The value of this option +can be '\fB*\fR' which denotes the raw pointer and is the default, or +qualified name of a smart pointer class template, for example, +\fBstd::shared_ptr\fR\. In the latter case, the ODB compiler constructs the +object or view pointer by adding a single template argument of the object or +view type to the qualified name, for example \fBstd::shared_ptr\fR\. +The ODB runtime uses object and view pointers to return, and, in case of +objects, pass and cache dynamically allocated instances of object and view +types\. + +Except for the raw pointer and the standard smart pointers defined in the +\fB\fR header file, you are expected to include the definition of the +default pointer at the beginning of the generated header file\. There are two +common ways to achieve this: you can either include the necessary header in +the file being compiled or you can use the \fB--hxx-prologue\fR option to add +the necessary \fB#include\fR directive to the generated code\. +.IP "\fB--session-type\fR \fItype\fR" +Use \fItype\fR as the alternative session type instead of the default +\fBodb::session\fR\. This option can be used to specify a custom session +implementation to be use by the persistent classes\. Note that you will also +need to include the definition of the custom session type into the generated +header file\. This is normally achieved with the \fB--hxx-prologue*\fR +options\. +.IP "\fB--profile\fR|\fB-p\fR \fIname\fR" +Specify a profile that should be used during compilation\. A profile is an +options file\. The ODB compiler first looks for a database-specific version +with the name constructed by appending the +\fB-\fR\fIdatabase\fR\fB\.options\fR suffix to \fIname\fR, where +\fIdatabase\fR is the database name as specified with the \fB--database\fR +option\. If this file is not found, then the ODB compiler looks for a +database-independant version with the name constructed by appending just the +\fB\.options\fR suffix\. + +The profile options files are searched for in the same set of directories as +C++ headers included with the \fB#include <\.\.\.>\fR directive (built-in +paths plus those specified with the \fB-I\fR options)\. The options file is +first searched for in the directory itself and then in its \fBodb/\fR +subdirectory\. + +For the format of the options file refer to the \fB--options-file\fR option +below\. You can repeat this option to specify more than one profile\. +.IP "\fB--at-once\fR" +Generate code for all the input files as well as for all the files that they +include at once\. The result is a single set of source/schema files that +contain all the generated code\. If more than one input file is specified +together with this option, then the \fB--input-name\fR option must also be +specified in order to provide the base name for the output files\. In this +case, the directory part of such a base name is used as the location of the +combined file\. This can be important for the \fB#include\fR directive +resolution\. +.IP "\fB--schema\fR \fIschema\fR" +Specify a database schema (database namespace) that should be assigned to the +persistent classes in the file being compiled\. Database schemas are not to be +confused with database schema names (schema catalog names) which are specified +with the \fB--schema-name\fR option\. +.IP "\fB--export-symbol\fR \fIsymbol\fR" +Insert \fIsymbol\fR in places where DLL export/import control statements +(\fB__declspec(dllexport/dllimport)\fR) are necessary\. See also the +\fB--extern-symbol\fR option below\. +.IP "\fB--extern-symbol\fR \fIsymbol\fR" +If \fIsymbol\fR is defined, insert it in places where a template instantiation +must be declared \fBextern\fR\. This option is normally used together with +\fB--export-symbol\fR when both multi-database support and queries are +enabled\. +.IP "\fB--std\fR \fIversion\fR" +Specify the C++ standard that should be used during compilation\. Valid values +are \fBc++98\fR (default), \fBc++11\fR, \fBc++14\fR, \fBc++17\fR, and +\fBc++20\fR\. +.IP "\fB--warn-hard-add\fR" +Warn about hard-added data members\. +.IP "\fB--warn-hard-delete\fR" +Warn about hard-deleted data members and persistent classes\. +.IP "\fB--warn-hard\fR" +Warn about both hard-added and hard-deleted data members and persistent +classes\. +.IP "\fB--output-dir\fR|\fB-o\fR \fIdir\fR" +Write the generated files to \fIdir\fR instead of the current directory\. +.IP "\fB--input-name\fR \fIname\fR" +Use \fIname\fR instead of the input file to derive the names of the generated +files\. If the \fB--at-once\fR option is specified, then the directory part of +\fIname\fR is used as the location of the combined file\. Refer to the +\fB--at-once\fR option for details\. +.IP "\fB--changelog\fR \fIfile\fR" +Read/write changelog from/to \fIfile\fR instead of the default changelog +file\. The default changelog file name is derived from the input file name and +it is placed into the same directory as the input file\. Note that the +\fB--output-dir\fR option does not affect the changelog file location\. In +other words, by default, the changelog file is treated as another input rather +than output even though the ODB compiler may modify it\. Use the +\fB--changelog-in\fR and \fB--changelog-out\fR options to specify different +input and output chaneglog files\. +.IP "\fB--changelog-in\fR \fIfile\fR" +Read changelog from \fIfile\fR instead of the default changelog file\. If this +option is specified, then you must also specify the output chanegelog file +with \fB--changelog-out\fR\. +.IP "\fB--changelog-out\fR \fIfile\fR" +Write changelog to \fIfile\fR instead of the default changelog file\. If this +option is specified, then you must also specify the input chanegelog file with +\fB--changelog-in\fR\. +.IP "\fB--changelog-dir\fR \fIdir\fR" +Use \fIdir\fR instead of the input file directory as the changelog file +directory\. This directory is also added to changelog files specified with the +\fB--changelog\fR, \fB--changelog-in\fR, and \fB--changelog-in\fR options +unless they are absolute paths\. +.IP "\fB--init-changelog\fR" +Force re-initialization of the changelog even if one exists (all the existing +change history will be lost)\. This option is primarily useful for automated +testing\. +.IP "\fB--odb-file-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR to construct the names of the generated C++ files\. In the +single-database mode the default value for this option is \fB-odb\fR\. In the +multi-database mode it is \fB-odb\fR for the files corresponding to the +\fBcommon\fR database and \fB-odb-\fR\fIdb\fR\fR (where \fIdb\fR is the +database name) for other databases\. +.IP "\fB--sql-file-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR to construct the name of the generated schema SQL file\. In +the single-database mode by default no suffix is used\. In the multi-database +mode the default value for this option is \fB-\fR\fIdb\fR\fR (where \fIdb\fR +is the database name)\. +.IP "\fB--schema-file-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR to construct the name of the generated schema C++ source +file\. In the single-database mode the default value for this option is +\fB-schema\fR\. In the multi-database mode it is \fB-schema-\fR\fIdb\fR\fR +(where \fIdb\fR is the database name)\. See the \fB--schema-format\fR option +for details\. +.IP "\fB--changelog-file-suffix\fR \fIsfx\fR" +Use \fIsfx\fR to construct the name of the changelog file\. In the +single-database mode by default no suffix is used\. In the multi-database mode +the default value for this option is \fB-\fR\fIdb\fR\fR (where \fIdb\fR is the +database name)\. +.IP "\fB--hxx-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB\.hxx\fR to construct the name of +the generated C++ header file\. +.IP "\fB--ixx-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB\.ixx\fR to construct the name of +the generated C++ inline file\. +.IP "\fB--cxx-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB\.cxx\fR to construct the name of +the generated C++ source file\. +.IP "\fB--sql-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB\.sql\fR to construct the name of +the generated database schema file\. +.IP "\fB--changelog-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB\.xml\fR to construct the name of +the changelog file\. +.IP "\fB--hxx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated C++ header file\. +.IP "\fB--ixx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated C++ inline file\. +.IP "\fB--cxx-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated C++ source file\. +.IP "\fB--schema-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated schema C++ source file\. +.IP "\fB--sql-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated database schema file\. +.IP "\fB--migration-prologue\fR \fItext\fR" +Insert \fItext\fR at the beginning of the generated database migration file\. +.IP "\fB--sql-interlude\fR \fItext\fR" +Insert \fItext\fR after all the \fBDROP\fR and before any \fBCREATE\fR +statements in the generated database schema file\. +.IP "\fB--hxx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated C++ header file\. +.IP "\fB--ixx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated C++ inline file\. +.IP "\fB--cxx-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated C++ source file\. +.IP "\fB--schema-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated schema C++ source file\. +.IP "\fB--sql-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated database schema file\. +.IP "\fB--migration-epilogue\fR \fItext\fR" +Insert \fItext\fR at the end of the generated database migration file\. +.IP "\fB--hxx-prologue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the beginning of the generated C++ header +file\. +.IP "\fB--ixx-prologue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the beginning of the generated C++ inline +file\. +.IP "\fB--cxx-prologue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the beginning of the generated C++ source +file\. +.IP "\fB--schema-prologue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the beginning of the generated schema C++ +source file\. +.IP "\fB--sql-prologue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the beginning of the generated database +schema file\. +.IP "\fB--migration-prologue-file\fR \fIf\fR" +Insert the content of file \fIf\fR at the beginning of the generated database +migration file\. +.IP "\fB--sql-interlude-file\fR \fIfile\fR" +Insert the content of \fIfile\fR after all the \fBDROP\fR and before any +\fBCREATE\fR statements in the generated database schema file\. +.IP "\fB--hxx-epilogue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the end of the generated C++ header file\. +.IP "\fB--ixx-epilogue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the end of the generated C++ inline file\. +.IP "\fB--cxx-epilogue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the end of the generated C++ source file\. +.IP "\fB--schema-epilogue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the end of the generated schema C++ source +file\. +.IP "\fB--sql-epilogue-file\fR \fIfile\fR" +Insert the content of \fIfile\fR at the end of the generated database schema +file\. +.IP "\fB--migration-epilogue-file\fR \fIf\fR" +Insert the content of file \fIf\fR at the end of the generated database +migration file\. +.IP "\fB--odb-prologue\fR \fItext\fR" +Compile \fItext\fR before the input header file\. This option allows you to +add additional declarations, such as custom traits specializations, to the ODB +compilation process\. +.IP "\fB--odb-prologue-file\fR \fIfile\fR" +Compile \fIfile\fR contents before the input header file\. Prologue files are +compiled after all the prologue text fragments (\fB--odb-prologue\fR option)\. +.IP "\fB--odb-epilogue\fR \fItext\fR" +Compile \fItext\fR after the input header file\. This option allows you to add +additional declarations, such as custom traits specializations, to the ODB +compilation process\. +.IP "\fB--odb-epilogue-file\fR \fIfile\fR" +Compile \fIfile\fR contents after the input header file\. Epilogue files are +compiled after all the epilogue text fragments (\fB--odb-epilogue\fR option)\. +.IP "\fB--table-prefix\fR \fIprefix\fR" +Add \fIprefix\fR to table names and, for databases that have global index +and/or foreign key names, to those names as well\. The prefix is added to both +names that were specified with the \fBdb table\fR and \fBdb index\fR pragmas +and those that were automatically derived from class and data member names\. +If you require a separator, such as an underscore, between the prefix and the +name, then you should include it into the prefix value\. +.IP "\fB--index-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB_i\fR to construct index names\. +The suffix is only added to names that were automatically derived from data +member names\. If you require a separator, such as an underscore, between the +name and the suffix, then you should include it into the suffix value\. +.IP "\fB--fkey-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB_fk\fR to construct foreign key +names\. If you require a separator, such as an underscore, between the name +and the suffix, then you should include it into the suffix value\. +.IP "\fB--sequence-suffix\fR \fIsuffix\fR" +Use \fIsuffix\fR instead of the default \fB_seq\fR to construct sequence +names\. If you require a separator, such as an underscore, between the name +and the suffix, then you should include it into the suffix value\. +.IP "\fB--sql-name-case\fR \fIcase\fR" +Convert all automatically-derived SQL names to upper or lower case\. Valid +values for this option are \fBupper\fR and \fBlower\fR\. +.IP "\fB--table-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived table names\. See the SQL NAME TRANSFORMATIONS section +below for details\. +.IP "\fB--column-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived column names\. See the SQL NAME TRANSFORMATIONS section +below for details\. +.IP "\fB--index-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived index names\. See the SQL NAME TRANSFORMATIONS section +below for details\. +.IP "\fB--fkey-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived foreign key names\. See the SQL NAME TRANSFORMATIONS +section below for details\. +.IP "\fB--sequence-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived sequence names\. See the SQL NAME TRANSFORMATIONS +section below for details\. +.IP "\fB--statement-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +automatically-derived prepared statement names\. See the SQL NAME +TRANSFORMATIONS section below for details\. +.IP "\fB--sql-name-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions that is used to transform +all automatically-derived SQL names\. See the SQL NAME TRANSFORMATIONS section +below for details\. +.IP "\fB--sql-name-regex-trace\fR" +Trace the process of applying regular expressions specified with the SQL name +\fB--*-regex\fR options\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--accessor-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to transform data +member names to function names when searching for a suitable accessor +function\. The argument to this option is a Perl-like regular expression in +the form \fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any +character can be used as a delimiter instead of '\fB/\fR' and the delimiter +can be escaped inside \fIpattern\fR and \fIreplacement\fR with a backslash +(\fB\e\fR)\. You can specify multiple regular expressions by repeating this +option\. + +All the regular expressions are tried in the order specified and the first +expression that produces a suitable accessor function is used\. Each +expression is tried twice: first with the actual member name and then with the +member's \fIpublic name\fR which is obtained by removing the common member +name decorations, such as leading and trailing underscores, the \fBm_\fR +prefix, etc\. The ODB compiler also includes a number of built-in expressions +for commonly used accessor names, such as \fBget_foo\fR, \fBgetFoo\fR, +\fBgetfoo\fR, and just \fBfoo\fR\. The built-in expressions are tried last\. + +As an example, the following expression transforms data members with public +names in the form \fBfoo\fR to accessor names in the form \fBGetFoo\fR: + +\fB/(\.+)/Get\eu$1/\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--accessor-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--accessor-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--modifier-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to transform data +member names to function names when searching for a suitable modifier +function\. The argument to this option is a Perl-like regular expression in +the form \fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any +character can be used as a delimiter instead of '\fB/\fR' and the delimiter +can be escaped inside \fIpattern\fR and \fIreplacement\fR with a backslash +(\fB\e\fR)\. You can specify multiple regular expressions by repeating this +option\. + +All the regular expressions are tried in the order specified and the first +expression that produces a suitable modifier function is used\. Each +expression is tried twice: first with the actual member name and then with the +member's \fIpublic name\fR which is obtained by removing the common member +name decorations, such as leading and trailing underscores, the \fBm_\fR +prefix, etc\. The ODB compiler also includes a number of built-in expressions +for commonly used modifier names, such as \fBset_foo\fR, \fBsetFoo\fR, +\fBsetfoo\fR, and just \fBfoo\fR\. The built-in expressions are tried last\. + +As an example, the following expression transforms data members with public +names in the form \fBfoo\fR to modifier names in the form \fBSetFoo\fR: + +\fB/(\.+)/Set\eu$1/\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--modifier-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--modifier-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--include-with-brackets\fR" +Use angle brackets (<>) instead of quotes ("") in the generated \fB#include\fR +directives\. +.IP "\fB--include-prefix\fR \fIprefix\fR" +Add \fIprefix\fR to the generated \fB#include\fR directive paths\. +.IP "\fB--include-regex\fR \fIregex\fR" +Add \fIregex\fR to the list of regular expressions used to transform generated +\fB#include\fR directive paths\. The argument to this option is a Perl-like +regular expression in the form +\fB/\fR\fIpattern\fR\fB/\fR\fIreplacement\fR\fB/\fR\fR\. Any character can be +used as a delimiter instead of '\fB/\fR' and the delimiter can be escaped +inside \fIpattern\fR and \fIreplacement\fR with a backslash (\fB\e\fR)\. You +can specify multiple regular expressions by repeating this option\. All the +regular expressions are tried in the order specified and the first expression +that matches is used\. + +As an example, the following expression transforms include paths in the form +\fBfoo/bar-odb\.h\fR to paths in the form \fBfoo/generated/bar-odb\.h\fR: + +\fB%foo/(\.+)-odb\.h%foo/generated/$1-odb\.h%\fR + +See also the REGEX AND SHELL QUOTING section below\. +.IP "\fB--include-regex-trace\fR" +Trace the process of applying regular expressions specified with the +\fB--include-regex\fR option\. Use this option to find out why your regular +expressions don't do what you expected them to do\. +.IP "\fB--guard-prefix\fR \fIprefix\fR" +Add \fIprefix\fR to the generated header inclusion guards\. The prefix is +transformed to upper case and characters that are illegal in a preprocessor +macro name are replaced with underscores\. +.IP "\fB--show-sloc\fR" +Print the number of generated physical source lines of code (SLOC)\. +.IP "\fB--sloc-limit\fR \fInum\fR" +Check that the number of generated physical source lines of code (SLOC) does +not exceed \fInum\fR\. +.IP "\fB--options-file\fR \fIfile\fR" +Read additional options from \fIfile\fR\. Each option should appear on a +separate line optionally followed by space or equal sign (\fB=\fR) and an +option value\. Empty lines and lines starting with \fB#\fR are ignored\. +Option values can be enclosed in double (\fB"\fR) or single (\fB'\fR) quotes +to preserve leading and trailing whitespaces as well as to specify empty +values\. If the value itself contains trailing or leading quotes, enclose it +with an extra pair of quotes, for example \fB'"x"'\fR\. Non-leading and +non-trailing quotes are interpreted as being part of the option value\. + +The semantics of providing options in a file is equivalent to providing the +same set of options in the same order on the command line at the point where +the \fB--options-file\fR option is specified except that the shell escaping +and quoting is not required\. Repeat this option to specify more than one +options file\. +.IP "\fB-x\fR \fIoption\fR" +Pass \fIoption\fR to the underlying C++ compiler (\fBg++\fR)\. The +\fIoption\fR value that doesn't start with '\fB-\fR' is considered the +\fBg++\fR executable name\. +.IP "\fB-v\fR" +Print the commands executed to run the stages of compilation\. +.IP "\fB--trace\fR" +Trace the compilation process\. +.IP "\fB--mysql-engine\fR \fIengine\fR" +Use \fIengine\fR instead of the default \fBInnoDB\fR in the generated database +schema file\. For more information on the storage engine options see the MySQL +documentation\. If you would like to use the database-default engine, pass +\fBdefault\fR as the value for this option\. +.IP "\fB--sqlite-override-null\fR" +Make all columns in the generated database schema allow \fBNULL\fR values\. +This is primarily useful in schema migration since SQLite does not support +dropping of columns\. By making all columns \fBNULL\fR we can later "delete" +them by setting their values to \fBNULL\fR\. Note that this option overrides +even the \fBnot_null\fR pragma\. +.IP "\fB--sqlite-lax-auto-id\fR" +Do not force monotonically increasing automatically-assigned object ids\. In +this mode the generated database schema omits the \fBAUTOINCREMENT\fR keyword +which results in faster object persistence but may lead to +automatically-assigned ids not being in a strictly ascending order\. Refer to +the SQLite documentation for details\. +.IP "\fB--pgsql-server-version\fR \fIver\fR" +Specify the minimum PostgreSQL server version with which the generated C++ +code and schema will be used\. This information is used to enable +version-specific optimizations and workarounds in the generated C++ code and +schema\. The version must be in the \fImajor\fR\fB\.\fR\fIminor\fR\fR form, +for example, \fB9\.1\fR\. If this option is not specified, then \fB7\.4\fR or +later is assumed\. +.IP "\fB--oracle-client-version\fR \fIver\fR" +Specify the minimum Oracle client library (OCI) version with which the +generated C++ code will be linked\. This information is used to enable +version-specific optimizations and workarounds in the generated C++ code\. The +version must be in the \fImajor\fR\fB\.\fR\fIminor\fR\fR form, for example, +\fB11\.2\fR\. If this option is not specified, then \fB10\.1\fR or later is +assumed\. +.IP "\fB--oracle-warn-truncation\fR" +Warn about SQL names that are longer than 30 characters and are therefore +truncated\. Note that during database schema generation +(\fB--generate-schema\fR) ODB detects when such truncations lead to name +conflicts and issues diagnostics even without this option specified\. +.IP "\fB--mssql-server-version\fR \fIver\fR" +Specify the minimum SQL Server server version with which the generated C++ +code and schema will be used\. This information is used to enable +version-specific optimizations and workarounds in the generated C++ code and +schema\. The version must be in the \fImajor\fR\fB\.\fR\fIminor\fR\fR form, +for example, \fB9\.0\fR (SQL Server 2005), \fB10\.5\fR (2008R2), or +\fB11\.0\fR (2012)\. If this option is not specified, then \fB10\.0\fR (SQL +Server 2008) or later is assumed\. +.IP "\fB--mssql-short-limit\fR \fIsize\fR" +Specify the short data size limit\. If a character, national character, or +binary data type has a maximum length (in bytes) less than or equal to this +limit, then it is treated as \fIshort data\fR, otherwise it is \fIlong +data\fR\. For short data ODB pre-allocates an intermediate buffer of the +maximum size and binds it directly to a parameter or result column\. This way +the underlying API (ODBC) can read/write directly from/to this buffer\. In the +case of long data, the data is read/written in chunks using the +\fBSQLGetData()\fR/\fBSQLPutData()\fR ODBC functions\. While the long data +approach reduces the amount of memory used by the application, it may require +greater CPU resources\. The default short data limit is 1024 bytes\. When +setting a custom short data limit, make sure that it is sufficiently large so +that no object id in the application is treated as long data\. +.\" +.\" SQL NAME TRANSFORMATIONS +.\" +.SH SQL NAME TRANSFORMATIONS +The ODB compiler provides a number of mechanisms for transforming +automatically-derived SQL names, such as tables, columns, etc., +to match a specific naming convention. At the higher level, we can +add a prefix to global names (tables and, for some databases, +indexes and/or foreign keys) with the +.B --table-prefix +option. Similarly, we can specify custom suffixes for automatically-derived +index +.RB ( --index-suffix ; +default is +.BR _i ), +foreign key +.RB ( --fkey-suffix ; +default is +.BR _fk ), +and sequence +.RB ( --sequence-suffix ; +default is +.BR _seq ) +names. Finally, we can also convert all the names to upper or lower +case with the +.B --sql-name-case +option (valid values are +.B upper +and +.BR lower ). + +At the lower level we can specify a set of regular expressions to +implement arbitrary transformations of the automatically-derived SQL +names. If we want a particular regular expression only to apply to +a specific name, for example, table or column, then we use one of the +.B --\fIkind\fB-regex +options, where +.I kind +can be +.BR table , +.BR column , +.BR index , +.BR fkey , +.BR sequence , +or +.BR statement . +On the other hand, if we want our regular expressions to apply to all SQL +names, then we use the +.B --sql-name-regex +option. + +The interaction between the higher and lower level transformations +is as follows. Prefixes and suffixes are added first. Then the +regular expression transformations are applied. Finally, if requested, +the name is converted to upper or lower case. Note also that all of +these transformations except for +.B --table-prefix +only apply to automatically-derived names. In other words, if a table, +column, etc., name was explicitly specified with a pragma, then it +is used as is, without applying any (except for the table prefix) +transformations. + +The value for the +.B --*-regex +options is a Perl-like regular expression in the form +.BI / pattern / replacement /\fR. +Any character can be used as a delimiter instead of +.B / +and the delimiter can be escaped inside +.I pattern +and +.I replacement +with a backslash +.RB ( \e ). +You can also specify multiple regular expressions by repeating these +options. + +All the regular expressions are tried in the order specified with the +name-specific expressions (for example, +.BR --table-regex) +tried first followed by the generic expressions +.RB ( --sql-name-regex ). +The first expression that matches is used. + +As an example, consider a regular expression that transforms a class +name in the form +.B CFoo +to a table name in the form +.BR FOO: + +.B --table-regex '/C(.+)/\eU$1/' + +As a more interesting example, consider the transformation of class +names that follow the upper camel case convention (for example, +.BR FooBar ) +to table names that follow the underscore-separated, all upper case +convention (for example, +.BR FOO_BAR ). +For this case we have to use separate expressions to handle one-word, +two-word, etc., names: + +.B --table-regex '/([A-z][a-z]+)/\eU$1/' + +.B --table-regex '/([A-z][a-z]+)([A-z][a-z]+)/\eU$1_$2/' + +See also the REGEX AND SHELL QUOTING section below. +.\" +.\" REGEX AND SHELL QUOTING +.\" +.SH REGEX AND SHELL QUOTING +When entering a regular expression argument in the shell command line +it is often necessary to use quoting (enclosing the argument in " " +or ' ') in order to prevent the shell from interpreting certain +characters, for example, spaces as argument separators and $ as +variable expansions. + +Unfortunately it is hard to achieve this in a manner that is portable +across POSIX shells, such as those found on GNU/Linux and UNIX, and +Windows shell. For example, if you use " " for quoting you will get +a wrong result with POSIX shells if your expression contains $. The +standard way of dealing with this on POSIX systems is to use ' ' +instead. Unfortunately, Windows shell does not remove ' ' from +arguments when they are passed to applications. As a result you may +have to use ' ' for POSIX and " " for Windows ($ is not treated as +a special character on Windows). + +Alternatively, you can save regular expression options into a file, +one option per line, and use this file with the +.B --options-file +option. With this approach you don't need to worry about shell quoting. +.\" +.\" DIAGNOSTICS +.\" +.SH DIAGNOSTICS +If the input file is not valid C++, +.B odb +will issue diagnostic messages to STDERR and exit with non-zero exit code. +.\" +.\" BUGS +.\" +.SH BUGS +Send bug reports to the odb-users@codesynthesis.com mailing list. +.\" +.\" COPYRIGHT +.\" +.SH COPYRIGHT +Copyright (c) 2009-2022 Code Synthesis Tools CC. + +Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, +version 1.2; with no Invariant Sections, no Front-Cover Texts and +no Back-Cover Texts. Copy of the license can be obtained from +http://www.codesynthesis.com/licenses/fdl-1.3.txt diff --git a/doc/pregenerated/odb.xhtml b/doc/pregenerated/odb.xhtml new file mode 100644 index 0000000..a987633 --- /dev/null +++ b/doc/pregenerated/odb.xhtml @@ -0,0 +1,978 @@ + + + + + ODB 2.4.0 Compiler Command Line Manual + + + + + + + + + + + +
+
+ +

NAME

+ +

odb - object-relational mapping (ORM) compiler for C++

+ +

SYNOPSIS

+ +
+
odb [options] file [file...]
+
+ +

DESCRIPTION

+ +

Given a set of C++ classes in a header file, odb + generates C++ code that allows you to persist, query, and update objects + of these classes in a relational database (RDBMS). The relational + database that the generated code should target is specified with the + required --database option (see below).

+ +

For an input file in the form name.hxx (other + file extensions can be used instead of .hxx), + in the single-database mode (the default), the generated C++ files + by default have the following names: + name-odb.hxx (header file), + name-odb.ixx (inline file), and + name-odb.cxx (source file). + + Additionally, if the --generate-schema option is + specified and the sql schema format is requested (see + --schema-format), the name.sql + database schema file is generated. If the separate + schema format is requested, the database creation code is generated + into the separate name-schema.cxx file.

+ +

In the multi-database mode (see the --multi-database + option below), the generated files corresponding to the + common database have the same names as in the + single-database mode. For other databases, the file names include + the database name: + name-odb-db.hxx, + name-odb-db.ixx, + name-odb-db.cxx, + name-db.sql, and + name-schema-db.cxx + (where db is the database name).

+ +

OPTIONS

+
+
--help
+
Print usage information and exit.
+ +
--version
+
Print version and exit.
+ +
-I dir
+
Add dir to the beginning of the list of + directories to be searched for included header files.
+ +
-D name[=def]
+
Define macro name with definition + def. If definition is omitted, define + name to be 1.
+ +
-U name
+
Cancel any previous definitions of macro name, + either built-in or provided with the -D option.
+ +
--database|-d db
+
Generate code for the db database. Valid values + are mssql, mysql, + oracle, pgsql, + sqlite, and common (multi-database + mode only).
+ +
--multi-database|-m type
+
Enable multi-database support and specify its type. Valid values for + this option are static and + dynamic. + +

In the multi-database mode, options that determine the kind (for + example, --schema-format), names (for example, + --odb-file-suffix), or content (for example, prologue + and epilogue options) of the output files can be prefixed with the + database name followed by a colon, for example, + mysql:value. This restricts the value of such an + option to only apply to generated files corresponding to this + database.

+ +
--default-database db
+
When static multi-database support is used, specify the database that + should be made the default. When dynamic multi-database support is used, + common is always made the default database.
+ +
--generate-query|-q
+
Generate query support code. Without this support you cannot use views + and can only load objects via their ids.
+ +
--generate-prepared
+
Generate prepared query execution support code.
+ +
--omit-unprepared
+
Omit un-prepared (once-off) query execution support code.
+ +
--generate-session|-e
+
Generate session support code. With this option session support will + be enabled by default for all the persistent classes except those for + which it was explicitly disabled using the db session + pragma.
+ +
--generate-schema|-s
+
Generate the database schema. The database schema contains SQL + statements that create database tables necessary to store persistent + classes defined in the file being compiled. Note that by applying this + schema, all the existing information stored in such tables will be lost. + +

Depending on the database being used (--database + option), the schema is generated either as a standalone SQL file or + embedded into the generated C++ code. By default the SQL file is generated + for the MySQL, PostgreSQL, Oracle, and Microsoft SQL Server databases and + the schema is embedded into the C++ code for the SQLite database. Use the + --schema-format option to alter the default schema + format.

+ +

If database schema evolution support is enabled (that is, the object + model version is specified), then this option also triggers the generation + of database schema migration statements, again either as standalong SQL + files or embedded into the generated C++ code. You can suppress the + generation of schema migration statements by specifying the + --suppress-migration option.

+ +
--generate-schema-only
+
Generate only the database schema. Note that this option is only valid + when generating schema as a standalone SQL file (see + --schema-format for details).
+ +
--suppress-migration
+
Suppress the generation of database schema migration statements.
+ +
--suppress-schema-version
+
Suppress the generation of schema version table. If you specify this + option then you are also expected to manually specify the database schema + version and migration state at runtime using the + odb::database::schema_version() function.
+ +
--schema-version-table name
+
Specify the alternative schema version table name instead of the + default schema_version. If you specify this option + then you are also expected to manually specify the schema version table + name at runtime using the + odb::database::schema_version_table() function. The + table name can be qualified.
+ +
--schema-format format
+
Generate the database schema in the specified format. Pass + sql as format to generate the + database schema as a standalone SQL file or pass + embedded to embed the schema into the generated C++ + code. The separate value is similar to + embedded except the schema creation code is generated + into a separate C++ file (name-schema.cxx by default). + This value is primarily useful if you want to place the schema creation + functionality into a separate program or library. Repeat this option to + generate the same database schema in multiple formats.
+ +
--omit-drop
+
Omit DROP statements from the generated database + schema.
+ +
--omit-create
+
Omit CREATE statements from the generated database + schema.
+ +
--schema-name name
+
Use name as the database schema name. Schema names + are primarily used to distinguish between multiple embedded schemas in the + schema catalog. They are not to be confused with database schemas + (database namespaces) which are specified with the + --schema option. If this option is not specified, the + empty name, which is the default schema name, is used.
+ +
--fkeys-deferrable-mode m
+
Use constraint checking mode m in foreign keys + generated for object relationships. Valid values for this option are + not_deferrable, immediate, and + deferred (default). MySQL and SQL Server do not + support deferrable foreign keys and for these databases such keys are + generated commented out. Other foreign keys generated by the ODB compiler + (such as the ones used to support containers and polymorphic hierarchies) + are always generated as not deferrable. + +

Note also that if you use either not_deferrable or + immediate mode, then the order in which you persist, + update, and erase objects within a transaction becomes important.

+ +
--default-pointer ptr
+
Use ptr as the default pointer for persistent + objects and views. Objects and views that do not have a pointer assigned + with the db pointer pragma will use this pointer by + default. The value of this option can be '*' which + denotes the raw pointer and is the default, or qualified name of a smart + pointer class template, for example, std::shared_ptr. + In the latter case, the ODB compiler constructs the object or view pointer + by adding a single template argument of the object or view type to the + qualified name, for example + std::shared_ptr<object>. The ODB runtime uses + object and view pointers to return, and, in case of objects, pass and + cache dynamically allocated instances of object and view types. + +

Except for the raw pointer and the standard smart pointers defined in + the <memory> header file, you are expected to + include the definition of the default pointer at the beginning of the + generated header file. There are two common ways to achieve this: you can + either include the necessary header in the file being compiled or you can + use the --hxx-prologue option to add the necessary + #include directive to the generated code.

+ +
--session-type type
+
Use type as the alternative session type instead + of the default odb::session. This option can be used + to specify a custom session implementation to be use by the persistent + classes. Note that you will also need to include the definition of the + custom session type into the generated header file. This is normally + achieved with the --hxx-prologue* options.
+ +
--profile|-p name
+
Specify a profile that should be used during compilation. A profile is + an options file. The ODB compiler first looks for a database-specific + version with the name constructed by appending the + -database.options + suffix to name, where database is + the database name as specified with the --database + option. If this file is not found, then the ODB compiler looks for a + database-independant version with the name constructed by appending just + the .options suffix. + +

The profile options files are searched for in the same set of + directories as C++ headers included with the #include + <...> directive (built-in paths plus those specified with + the -I options). The options file is first searched + for in the directory itself and then in its odb/ + subdirectory.

+ +

For the format of the options file refer to the + --options-file option below. You can repeat this + option to specify more than one profile.

+ +
--at-once
+
Generate code for all the input files as well as for all the files + that they include at once. The result is a single set of source/schema + files that contain all the generated code. If more than one input file is + specified together with this option, then the + --input-name option must also be specified in order to + provide the base name for the output files. In this case, the directory + part of such a base name is used as the location of the combined file. + This can be important for the #include directive + resolution.
+ +
--schema schema
+
Specify a database schema (database namespace) that should be assigned + to the persistent classes in the file being compiled. Database schemas are + not to be confused with database schema names (schema catalog names) which + are specified with the --schema-name option.
+ +
--export-symbol symbol
+
Insert symbol in places where DLL export/import + control statements (__declspec(dllexport/dllimport)) + are necessary. See also the --extern-symbol option + below.
+ +
--extern-symbol symbol
+
If symbol is defined, insert it in places where a + template instantiation must be declared extern. This + option is normally used together with --export-symbol + when both multi-database support and queries are enabled.
+ +
--std version
+
Specify the C++ standard that should be used during compilation. Valid + values are c++98 (default), c++11, + c++14, c++17, and + c++20.
+ +
--warn-hard-add
+
Warn about hard-added data members.
+ +
--warn-hard-delete
+
Warn about hard-deleted data members and persistent classes.
+ +
--warn-hard
+
Warn about both hard-added and hard-deleted data members and + persistent classes.
+ +
--output-dir|-o dir
+
Write the generated files to dir instead of the + current directory.
+ +
--input-name name
+
Use name instead of the input file to derive the + names of the generated files. If the --at-once option + is specified, then the directory part of name is used + as the location of the combined file. Refer to the + --at-once option for details.
+ +
--changelog file
+
Read/write changelog from/to file instead of the + default changelog file. The default changelog file name is derived from + the input file name and it is placed into the same directory as the input + file. Note that the --output-dir option does not + affect the changelog file location. In other words, by default, the + changelog file is treated as another input rather than output even though + the ODB compiler may modify it. Use the --changelog-in + and --changelog-out options to specify different input + and output chaneglog files.
+ +
--changelog-in file
+
Read changelog from file instead of the default + changelog file. If this option is specified, then you must also specify + the output chanegelog file with --changelog-out.
+ +
--changelog-out file
+
Write changelog to file instead of the default + changelog file. If this option is specified, then you must also specify + the input chanegelog file with --changelog-in.
+ +
--changelog-dir dir
+
Use dir instead of the input file directory as the + changelog file directory. This directory is also added to changelog files + specified with the --changelog, + --changelog-in, and --changelog-in + options unless they are absolute paths.
+ +
--init-changelog
+
Force re-initialization of the changelog even if one exists (all the + existing change history will be lost). This option is primarily useful for + automated testing.
+ +
--odb-file-suffix suffix
+
Use suffix to construct the names of the generated + C++ files. In the single-database mode the default value for this option + is -odb. In the multi-database mode it is + -odb for the files corresponding to the + common database and -odb-db + (where db is the database name) for other + databases.
+ +
--sql-file-suffix suffix
+
Use suffix to construct the name of the generated + schema SQL file. In the single-database mode by default no suffix is used. + In the multi-database mode the default value for this option is + -db (where db is the + database name).
+ +
--schema-file-suffix suffix
+
Use suffix to construct the name of the generated + schema C++ source file. In the single-database mode the default value for + this option is -schema. In the multi-database mode it + is -schema-db (where db is + the database name). See the --schema-format option for + details.
+ +
--changelog-file-suffix sfx
+
Use sfx to construct the name of the changelog + file. In the single-database mode by default no suffix is used. In the + multi-database mode the default value for this option is + -db (where db is the + database name).
+ +
--hxx-suffix suffix
+
Use suffix instead of the default + .hxx to construct the name of the generated C++ header + file.
+ +
--ixx-suffix suffix
+
Use suffix instead of the default + .ixx to construct the name of the generated C++ inline + file.
+ +
--cxx-suffix suffix
+
Use suffix instead of the default + .cxx to construct the name of the generated C++ source + file.
+ +
--sql-suffix suffix
+
Use suffix instead of the default + .sql to construct the name of the generated database + schema file.
+ +
--changelog-suffix suffix
+
Use suffix instead of the default + .xml to construct the name of the changelog file.
+ +
--hxx-prologue text
+
Insert text at the beginning of the generated C++ + header file.
+ +
--ixx-prologue text
+
Insert text at the beginning of the generated C++ + inline file.
+ +
--cxx-prologue text
+
Insert text at the beginning of the generated C++ + source file.
+ +
--schema-prologue text
+
Insert text at the beginning of the generated + schema C++ source file.
+ +
--sql-prologue text
+
Insert text at the beginning of the generated + database schema file.
+ +
--migration-prologue text
+
Insert text at the beginning of the generated + database migration file.
+ +
--sql-interlude text
+
Insert text after all the DROP + and before any CREATE statements in the generated + database schema file.
+ +
--hxx-epilogue text
+
Insert text at the end of the generated C++ header + file.
+ +
--ixx-epilogue text
+
Insert text at the end of the generated C++ inline + file.
+ +
--cxx-epilogue text
+
Insert text at the end of the generated C++ source + file.
+ +
--schema-epilogue text
+
Insert text at the end of the generated schema C++ + source file.
+ +
--sql-epilogue text
+
Insert text at the end of the generated database + schema file.
+ +
--migration-epilogue text
+
Insert text at the end of the generated database + migration file.
+ +
--hxx-prologue-file file
+
Insert the content of file at the beginning of the + generated C++ header file.
+ +
--ixx-prologue-file file
+
Insert the content of file at the beginning of the + generated C++ inline file.
+ +
--cxx-prologue-file file
+
Insert the content of file at the beginning of the + generated C++ source file.
+ +
--schema-prologue-file file
+
Insert the content of file at the beginning of the + generated schema C++ source file.
+ +
--sql-prologue-file file
+
Insert the content of file at the beginning of the + generated database schema file.
+ +
--migration-prologue-file f
+
Insert the content of file f at the beginning of + the generated database migration file.
+ +
--sql-interlude-file file
+
Insert the content of file after all the + DROP and before any CREATE + statements in the generated database schema file.
+ +
--hxx-epilogue-file file
+
Insert the content of file at the end of the + generated C++ header file.
+ +
--ixx-epilogue-file file
+
Insert the content of file at the end of the + generated C++ inline file.
+ +
--cxx-epilogue-file file
+
Insert the content of file at the end of the + generated C++ source file.
+ +
--schema-epilogue-file file
+
Insert the content of file at the end of the + generated schema C++ source file.
+ +
--sql-epilogue-file file
+
Insert the content of file at the end of the + generated database schema file.
+ +
--migration-epilogue-file f
+
Insert the content of file f at the end of the + generated database migration file.
+ +
--odb-prologue text
+
Compile text before the input header file. This + option allows you to add additional declarations, such as custom traits + specializations, to the ODB compilation process.
+ +
--odb-prologue-file file
+
Compile file contents before the input header + file. Prologue files are compiled after all the prologue text fragments + (--odb-prologue option).
+ +
--odb-epilogue text
+
Compile text after the input header file. This + option allows you to add additional declarations, such as custom traits + specializations, to the ODB compilation process.
+ +
--odb-epilogue-file file
+
Compile file contents after the input header file. + Epilogue files are compiled after all the epilogue text fragments + (--odb-epilogue option).
+ +
--table-prefix prefix
+
Add prefix to table names and, for databases that + have global index and/or foreign key names, to those names as well. The + prefix is added to both names that were specified with the db + table and db index pragmas and those that + were automatically derived from class and data member names. If you + require a separator, such as an underscore, between the prefix and the + name, then you should include it into the prefix value.
+ +
--index-suffix suffix
+
Use suffix instead of the default + _i to construct index names. The suffix is only added + to names that were automatically derived from data member names. If you + require a separator, such as an underscore, between the name and the + suffix, then you should include it into the suffix value.
+ +
--fkey-suffix suffix
+
Use suffix instead of the default + _fk to construct foreign key names. If you require a + separator, such as an underscore, between the name and the suffix, then + you should include it into the suffix value.
+ +
--sequence-suffix suffix
+
Use suffix instead of the default + _seq to construct sequence names. If you require a + separator, such as an underscore, between the name and the suffix, then + you should include it into the suffix value.
+ +
--sql-name-case case
+
Convert all automatically-derived SQL names to upper or lower case. + Valid values for this option are upper and + lower.
+ +
--table-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived table names. See the SQL NAME + TRANSFORMATIONS section below for details.
+ +
--column-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived column names. See the SQL NAME + TRANSFORMATIONS section below for details.
+ +
--index-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived index names. See the SQL NAME + TRANSFORMATIONS section below for details.
+ +
--fkey-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived foreign key names. See the SQL + NAME TRANSFORMATIONS section below for details.
+ +
--sequence-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived sequence names. See the SQL + NAME TRANSFORMATIONS section below for details.
+ +
--statement-regex regex
+
Add regex to the list of regular expressions that + is used to transform automatically-derived prepared statement names. See + the SQL NAME TRANSFORMATIONS section below for details.
+ +
--sql-name-regex regex
+
Add regex to the list of regular expressions that + is used to transform all automatically-derived SQL names. See the SQL NAME + TRANSFORMATIONS section below for details.
+ +
--sql-name-regex-trace
+
Trace the process of applying regular expressions specified with the + SQL name --*-regex options. Use this option to find + out why your regular expressions don't do what you expected them to + do.
+ +
--accessor-regex regex
+
Add regex to the list of regular expressions used + to transform data member names to function names when searching for a + suitable accessor function. The argument to this option is a Perl-like + regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/' + and the delimiter can be escaped inside pattern and + replacement with a backslash (\). + You can specify multiple regular expressions by repeating this option. + +

All the regular expressions are tried in the order specified and the + first expression that produces a suitable accessor function is used. Each + expression is tried twice: first with the actual member name and then with + the member's public name which is obtained by removing the common + member name decorations, such as leading and trailing underscores, the + m_ prefix, etc. The ODB compiler also includes a + number of built-in expressions for commonly used accessor names, such as + get_foo, getFoo, + getfoo, and just foo. The built-in + expressions are tried last.

+ +

As an example, the following expression transforms data members with + public names in the form foo to accessor names in the + form GetFoo:

+ +

/(.+)/Get\u$1/

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--accessor-regex-trace
+
Trace the process of applying regular expressions specified with the + --accessor-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--modifier-regex regex
+
Add regex to the list of regular expressions used + to transform data member names to function names when searching for a + suitable modifier function. The argument to this option is a Perl-like + regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/' + and the delimiter can be escaped inside pattern and + replacement with a backslash (\). + You can specify multiple regular expressions by repeating this option. + +

All the regular expressions are tried in the order specified and the + first expression that produces a suitable modifier function is used. Each + expression is tried twice: first with the actual member name and then with + the member's public name which is obtained by removing the common + member name decorations, such as leading and trailing underscores, the + m_ prefix, etc. The ODB compiler also includes a + number of built-in expressions for commonly used modifier names, such as + set_foo, setFoo, + setfoo, and just foo. The built-in + expressions are tried last.

+ +

As an example, the following expression transforms data members with + public names in the form foo to modifier names in the + form SetFoo:

+ +

/(.+)/Set\u$1/

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--modifier-regex-trace
+
Trace the process of applying regular expressions specified with the + --modifier-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--include-with-brackets
+
Use angle brackets (<>) instead of quotes ("") in the generated + #include directives.
+ +
--include-prefix prefix
+
Add prefix to the generated + #include directive paths.
+ +
--include-regex regex
+
Add regex to the list of regular expressions used + to transform generated #include directive paths. The + argument to this option is a Perl-like regular expression in the form + /pattern/replacement/. Any + character can be used as a delimiter instead of '/' + and the delimiter can be escaped inside pattern and + replacement with a backslash (\). + You can specify multiple regular expressions by repeating this option. All + the regular expressions are tried in the order specified and the first + expression that matches is used. + +

As an example, the following expression transforms include paths in the + form foo/bar-odb.h to paths in the form + foo/generated/bar-odb.h:

+ +

%foo/(.+)-odb.h%foo/generated/$1-odb.h%

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +
--include-regex-trace
+
Trace the process of applying regular expressions specified with the + --include-regex option. Use this option to find out + why your regular expressions don't do what you expected them to do.
+ +
--guard-prefix prefix
+
Add prefix to the generated header inclusion + guards. The prefix is transformed to upper case and characters that are + illegal in a preprocessor macro name are replaced with underscores.
+ +
--show-sloc
+
Print the number of generated physical source lines of code + (SLOC).
+ +
--sloc-limit num
+
Check that the number of generated physical source lines of code + (SLOC) does not exceed num.
+ +
--options-file file
+
Read additional options from file. Each option + should appear on a separate line optionally followed by space or equal + sign (=) and an option value. Empty lines and lines + starting with # are ignored. Option values can be + enclosed in double (") or single + (') quotes to preserve leading and trailing + whitespaces as well as to specify empty values. If the value itself + contains trailing or leading quotes, enclose it with an extra pair of + quotes, for example '"x"'. Non-leading and + non-trailing quotes are interpreted as being part of the option value. + +

The semantics of providing options in a file is equivalent to providing + the same set of options in the same order on the command line at the point + where the --options-file option is specified except + that the shell escaping and quoting is not required. Repeat this option to + specify more than one options file.

+ +
-x option
+
Pass option to the underlying C++ compiler + (g++). The option value that + doesn't start with '-' is considered the + g++ executable name.
+ +
-v
+
Print the commands executed to run the stages of compilation.
+ +
--trace
+
Trace the compilation process.
+ +
--mysql-engine engine
+
Use engine instead of the default + InnoDB in the generated database schema file. For more + information on the storage engine options see the MySQL documentation. If + you would like to use the database-default engine, pass + default as the value for this option.
+ +
--sqlite-override-null
+
Make all columns in the generated database schema allow + NULL values. This is primarily useful in schema + migration since SQLite does not support dropping of columns. By making all + columns NULL we can later "delete" them by setting + their values to NULL. Note that this option overrides + even the not_null pragma.
+ +
--sqlite-lax-auto-id
+
Do not force monotonically increasing automatically-assigned object + ids. In this mode the generated database schema omits the + AUTOINCREMENT keyword which results in faster object + persistence but may lead to automatically-assigned ids not being in a + strictly ascending order. Refer to the SQLite documentation for + details.
+ +
--pgsql-server-version ver
+
Specify the minimum PostgreSQL server version with which the generated + C++ code and schema will be used. This information is used to enable + version-specific optimizations and workarounds in the generated C++ code + and schema. The version must be in the + major.minor form, for example, + 9.1. If this option is not specified, then + 7.4 or later is assumed.
+ +
--oracle-client-version ver
+
Specify the minimum Oracle client library (OCI) version with which the + generated C++ code will be linked. This information is used to enable + version-specific optimizations and workarounds in the generated C++ code. + The version must be in the major.minor + form, for example, 11.2. If this option is not + specified, then 10.1 or later is assumed.
+ +
--oracle-warn-truncation
+
Warn about SQL names that are longer than 30 characters and are + therefore truncated. Note that during database schema generation + (--generate-schema) ODB detects when such truncations + lead to name conflicts and issues diagnostics even without this option + specified.
+ +
--mssql-server-version ver
+
Specify the minimum SQL Server server version with which the generated + C++ code and schema will be used. This information is used to enable + version-specific optimizations and workarounds in the generated C++ code + and schema. The version must be in the + major.minor form, for example, + 9.0 (SQL Server 2005), 10.5 + (2008R2), or 11.0 (2012). If this option is not + specified, then 10.0 (SQL Server 2008) or later is + assumed.
+ +
--mssql-short-limit size
+
Specify the short data size limit. If a character, national character, + or binary data type has a maximum length (in bytes) less than or equal to + this limit, then it is treated as short data, otherwise it is + long data. For short data ODB pre-allocates an intermediate buffer + of the maximum size and binds it directly to a parameter or result column. + This way the underlying API (ODBC) can read/write directly from/to this + buffer. In the case of long data, the data is read/written in chunks using + the SQLGetData()/SQLPutData() ODBC + functions. While the long data approach reduces the amount of memory used + by the application, it may require greater CPU resources. The default + short data limit is 1024 bytes. When setting a custom short data limit, + make sure that it is sufficiently large so that no object id in the + application is treated as long data.
+
+ +

SQL NAME TRANSFORMATIONS

+ +

The ODB compiler provides a number of mechanisms for transforming + automatically-derived SQL names, such as tables, columns, etc., + to match a specific naming convention. At the higher level, we can + add a prefix to global names (tables and, for some databases, + indexes and/or foreign keys) with the --table-prefix + option. Similarly, we can specify custom suffixes for + automatically-derived + index (--index-suffix; default is _i), + foreign key (--fkey-suffix; default is _fk), and + sequence (--sequence-suffix; default is _seq) + names. Finally, we can also convert all the names to upper or lower + case with the --sql-name-case option (valid values + are upper and lower).

+ +

At the lower level we can specify a set of regular expressions to + implement arbitrary transformations of the automatically-derived SQL + names. If we want a particular regular expression only to apply to + a specific name, for example, table or column, then we use one of the + --kind-regex options, where + kind can be table, + column, index, + fkey, sequence, or + statement. On the other hand, if we want our + regular expressions to apply to all SQL names, then we use the + --sql-name-regex option.

+ +

The interaction between the higher and lower level transformations + is as follows. Prefixes and suffixes are added first. Then the + regular expression transformations are applied. Finally, if requested, + the name is converted to upper or lower case. Note also that all of + these transformations except for --table-prefix + only apply to automatically-derived names. In other words, if a table, + column, etc., name was explicitly specified with a pragma, then it + is used as is, without applying any (except for the table prefix) + transformations.

+ +

The value for the --*-regex options is a Perl-like + regular expression in the form + /pattern/replacement/. + Any character can be used as a delimiter instead of / + and the delimiter can be escaped inside pattern and + replacement with a backslash (\). + You can also specify multiple regular expressions by repeating these + options.

+ +

All the regular expressions are tried in the order specified with the + name-specific expressions (for example, --table-regex) + tried first followed by the generic expressions + (--sql-name-regex). The first expression that + matches is used.

+ +

As an example, consider a regular expression that transforms a class + name in the form CFoo to a table name in the + form FOO:

+ +

--table-regex '/C(.+)/\U$1/'

+ +

As a more interesting example, consider the transformation of class + names that follow the upper camel case convention (for example, + FooBar) to table names that follow the + underscore-separated, all upper case convention (for example, + FOO_BAR). For this case we have to use + separate expressions to handle one-word, two-word, etc., + names:

+ +

--table-regex '/([A-z][a-z]+)/\U$1/'

+

--table-regex '/([A-z][a-z]+)([A-z][a-z]+)/\U$1_$2/'

+ +

See also the REGEX AND SHELL QUOTING section below.

+ +

REGEX AND SHELL QUOTING

+ +

When entering a regular expression argument in the shell + command line it is often necessary to use quoting (enclosing + the argument in " " or + ' ') in order to prevent the shell + from interpreting certain characters, for example, spaces as + argument separators and $ as variable + expansions.

+ +

Unfortunately it is hard to achieve this in a manner that is + portable across POSIX shells, such as those found on + GNU/Linux and UNIX, and Windows shell. For example, if you + use " " for quoting you will get a + wrong result with POSIX shells if your expression contains + $. The standard way of dealing with this + on POSIX systems is to use ' ' instead. + Unfortunately, Windows shell does not remove ' ' + from arguments when they are passed to applications. As a result you + may have to use ' ' for POSIX and + " " for Windows ($ is + not treated as a special character on Windows).

+ +

Alternatively, you can save regular expression options into + a file, one option per line, and use this file with the + --options-file option. With this approach + you don't need to worry about shell quoting.

+ +

DIAGNOSTICS

+ +

If the input file is not valid C++, odb + will issue diagnostic messages to STDERR and exit with non-zero exit + code.

+ +

BUGS

+ +

Send bug reports to the + odb-users@codesynthesis.com mailing list.

+ +
+ +
+ + diff --git a/manifest b/manifest index 6e00bf3..7df2fa0 100644 --- a/manifest +++ b/manifest @@ -27,3 +27,5 @@ depends: libcutl ^1.11.0- #depends: libstudxml == 1.1.0-b.10 #depends: libcutl == 1.11.0-b.9 + +depends: * cli ^1.2.0- ? ($config.odb.develop) diff --git a/odb/.gitignore b/odb/.gitignore index 7e97b78..4fd410e 100644 --- a/odb/.gitignore +++ b/odb/.gitignore @@ -1,3 +1,2 @@ -odb -odb.so -#options.?xx +/odb +/options.?xx diff --git a/odb/buildfile b/odb/buildfile index 2625e0d..20f8718 100644 --- a/odb/buildfile +++ b/odb/buildfile @@ -94,49 +94,80 @@ switch $cxx.target.system plugin{odb}: cxx.loptions += -undefined dynamic_lookup } -libus{odb}: {hxx ixx txx cxx}{** -odb -options} {hxx ixx cxx}{options} $libs +libus{odb}: {hxx ixx txx cxx}{** -odb -options -pregenerated/**} $libs # Build options. # cxx.poptions += "-I$plugin_dir/include" "-DODB_GXX_NAME=\"$gxx_name\"" cxx.poptions += -DODB_BUILD2 # @@ TMP while supporting other build systems. -# Pass the copyright notice extracted from the LICENSE file. +## Consumption build ($develop == false). # -copyright = $process.run_regex(cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+)\.', \ - '\1') -obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" +# Use pregenerated versions in the consumption build. +# +libus{odb}: pregenerated/{hxx ixx cxx}{**}: include = (!$develop) + +if! $develop + cxx.poptions =+ "-I($src_base/pregenerated)" # Note: must come first. + +# Distribute pregenerated versions only in the consumption build. +# +pregenerated/{hxx ixx cxx}{*}: dist = (!$develop) -# Generated options parser. # -# @@ TMP: currently generated code is committed to allow building from git. +## + +## Development build ($develop == true). +# + +libus{odb}: {hxx ixx cxx}{options}: include = $develop + +if $develop + import! [metadata] cli = cli%exe{cli} + +# In the development build distribute regenerated {hxx ixx cxx}{options}, +# remapping their locations to the paths of the pregenerated versions (which +# are only distributed in the consumption build; see above). This way we make +# sure that the distributed files are always up-to-date. # -if $cli.configured +<{hxx ixx cxx}{options}>: cli{options} $cli { - cli.cxx{options}: cli{options} - - cli.options += --include-with-brackets --include-prefix odb \ ---guard-prefix ODB --generate-file-scanner --generate-specifier \ ---generate-modifier --generate-description --suppress-undocumented \ ---cxx-prologue '#include ' - - cli.cxx{*}: - { - # Include the generated cli files into the distribution and don't remove - # them when cleaning in src (so that clean results in a state identical to - # distributed). - # - dist = true - clean = ($src_root != $out_root) - - # We keep the generated code in the repository so copy it back to src in - # case of a forwarded configuration. - # - backlink = overwrite - } + dist = ($develop ? pregenerated/odb/ : false) + + # Symlink the generated code in src for convenience of development. + # + backlink = true } +% +if $develop +{{ + options = --include-with-brackets --include-prefix odb --guard-prefix ODB \ + --generate-file-scanner --generate-specifier --generate-modifier \ + --generate-description --suppress-undocumented \ + --cxx-prologue '#include ' + + $cli $options -o $out_base $path($<[0]) + + # If the result differs from the pregenerated version, copy it over. + # + if diff $src_base/pregenerated/odb/options.hxx $path($>[0]) >- && \ + diff $src_base/pregenerated/odb/options.ixx $path($>[1]) >- && \ + diff $src_base/pregenerated/odb/options.cxx $path($>[2]) >- + exit + end + + cp $path($>[0]) $src_base/pregenerated/odb/options.hxx + cp $path($>[1]) $src_base/pregenerated/odb/options.ixx + cp $path($>[2]) $src_base/pregenerated/odb/options.cxx +}} + +# +## + +# Pass the copyright notice extracted from the LICENSE file. +# +obj{odb}: cxx.poptions += -DODB_COPYRIGHT=\"$copyright\" # Don't install any of the plugin's headers. # diff --git a/odb/options.cxx b/odb/options.cxx deleted file mode 100644 index 93335d2..0000000 --- a/odb/options.cxx +++ /dev/null @@ -1,3984 +0,0 @@ -// -*- C++ -*- -// -// This file was generated by CLI, a command line interface -// compiler for C++. -// - -// Begin prologue. -// -#include -// -// End prologue. - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace cli -{ - // unknown_option - // - unknown_option:: - ~unknown_option () throw () - { - } - - void unknown_option:: - print (::std::ostream& os) const - { - os << "unknown option '" << option ().c_str () << "'"; - } - - const char* unknown_option:: - what () const throw () - { - return "unknown option"; - } - - // unknown_argument - // - unknown_argument:: - ~unknown_argument () throw () - { - } - - void unknown_argument:: - print (::std::ostream& os) const - { - os << "unknown argument '" << argument ().c_str () << "'"; - } - - const char* unknown_argument:: - what () const throw () - { - return "unknown argument"; - } - - // missing_value - // - missing_value:: - ~missing_value () throw () - { - } - - void missing_value:: - print (::std::ostream& os) const - { - os << "missing value for option '" << option ().c_str () << "'"; - } - - const char* missing_value:: - what () const throw () - { - return "missing option value"; - } - - // invalid_value - // - invalid_value:: - ~invalid_value () throw () - { - } - - void invalid_value:: - print (::std::ostream& os) const - { - os << "invalid value '" << value ().c_str () << "' for option '" - << option ().c_str () << "'"; - - if (!message ().empty ()) - os << ": " << message ().c_str (); - } - - const char* invalid_value:: - what () const throw () - { - return "invalid option value"; - } - - // eos_reached - // - void eos_reached:: - print (::std::ostream& os) const - { - os << what (); - } - - const char* eos_reached:: - what () const throw () - { - return "end of argument stream reached"; - } - - // file_io_failure - // - file_io_failure:: - ~file_io_failure () throw () - { - } - - void file_io_failure:: - print (::std::ostream& os) const - { - os << "unable to open file '" << file ().c_str () << "' or read failure"; - } - - const char* file_io_failure:: - what () const throw () - { - return "unable to open file or read failure"; - } - - // unmatched_quote - // - unmatched_quote:: - ~unmatched_quote () throw () - { - } - - void unmatched_quote:: - print (::std::ostream& os) const - { - os << "unmatched quote in argument '" << argument ().c_str () << "'"; - } - - const char* unmatched_quote:: - what () const throw () - { - return "unmatched quote"; - } - - // scanner - // - scanner:: - ~scanner () - { - } - - // argv_scanner - // - bool argv_scanner:: - more () - { - return i_ < argc_; - } - - const char* argv_scanner:: - peek () - { - if (i_ < argc_) - return argv_[i_]; - else - throw eos_reached (); - } - - const char* argv_scanner:: - next () - { - if (i_ < argc_) - { - const char* r (argv_[i_]); - - if (erase_) - { - for (int i (i_ + 1); i < argc_; ++i) - argv_[i - 1] = argv_[i]; - - --argc_; - argv_[argc_] = 0; - } - else - ++i_; - - ++start_position_; - return r; - } - else - throw eos_reached (); - } - - void argv_scanner:: - skip () - { - if (i_ < argc_) - { - ++i_; - ++start_position_; - } - else - throw eos_reached (); - } - - std::size_t argv_scanner:: - position () - { - return start_position_; - } - - // argv_file_scanner - // - int argv_file_scanner::zero_argc_ = 0; - std::string argv_file_scanner::empty_string_; - - bool argv_file_scanner:: - more () - { - if (!args_.empty ()) - return true; - - while (base::more ()) - { - // See if the next argument is the file option. - // - const char* a (base::peek ()); - const option_info* oi = 0; - const char* ov = 0; - - if (!skip_) - { - if ((oi = find (a)) != 0) - { - base::next (); - - if (!base::more ()) - throw missing_value (a); - - ov = base::next (); - } - else if (std::strncmp (a, "-", 1) == 0) - { - if ((ov = std::strchr (a, '=')) != 0) - { - std::string o (a, 0, ov - a); - if ((oi = find (o.c_str ())) != 0) - { - base::next (); - ++ov; - } - } - } - } - - if (oi != 0) - { - if (oi->search_func != 0) - { - std::string f (oi->search_func (ov, oi->arg)); - - if (!f.empty ()) - load (f); - } - else - load (ov); - - if (!args_.empty ()) - return true; - } - else - { - if (!skip_) - skip_ = (std::strcmp (a, "--") == 0); - - return true; - } - } - - return false; - } - - const char* argv_file_scanner:: - peek () - { - if (!more ()) - throw eos_reached (); - - return args_.empty () ? base::peek () : args_.front ().value.c_str (); - } - - const std::string& argv_file_scanner:: - peek_file () - { - if (!more ()) - throw eos_reached (); - - return args_.empty () ? empty_string_ : *args_.front ().file; - } - - std::size_t argv_file_scanner:: - peek_line () - { - if (!more ()) - throw eos_reached (); - - return args_.empty () ? 0 : args_.front ().line; - } - - const char* argv_file_scanner:: - next () - { - if (!more ()) - throw eos_reached (); - - if (args_.empty ()) - return base::next (); - else - { - hold_[i_ == 0 ? ++i_ : --i_].swap (args_.front ().value); - args_.pop_front (); - ++start_position_; - return hold_[i_].c_str (); - } - } - - void argv_file_scanner:: - skip () - { - if (!more ()) - throw eos_reached (); - - if (args_.empty ()) - return base::skip (); - else - { - args_.pop_front (); - ++start_position_; - } - } - - const argv_file_scanner::option_info* argv_file_scanner:: - find (const char* a) const - { - for (std::size_t i (0); i < options_count_; ++i) - if (std::strcmp (a, options_[i].option) == 0) - return &options_[i]; - - return 0; - } - - std::size_t argv_file_scanner:: - position () - { - return start_position_; - } - - void argv_file_scanner:: - load (const std::string& file) - { - using namespace std; - - ifstream is (file.c_str ()); - - if (!is.is_open ()) - throw file_io_failure (file); - - files_.push_back (file); - - arg a; - a.file = &*files_.rbegin (); - - for (a.line = 1; !is.eof (); ++a.line) - { - string line; - getline (is, line); - - if (is.fail () && !is.eof ()) - throw file_io_failure (file); - - string::size_type n (line.size ()); - - // Trim the line from leading and trailing whitespaces. - // - if (n != 0) - { - const char* f (line.c_str ()); - const char* l (f + n); - - const char* of (f); - while (f < l && (*f == ' ' || *f == '\t' || *f == '\r')) - ++f; - - --l; - - const char* ol (l); - while (l > f && (*l == ' ' || *l == '\t' || *l == '\r')) - --l; - - if (f != of || l != ol) - line = f <= l ? string (f, l - f + 1) : string (); - } - - // Ignore empty lines, those that start with #. - // - if (line.empty () || line[0] == '#') - continue; - - string::size_type p (string::npos); - if (line.compare (0, 1, "-") == 0) - { - p = line.find (' '); - - string::size_type q (line.find ('=')); - if (q != string::npos && q < p) - p = q; - } - - string s1; - if (p != string::npos) - { - s1.assign (line, 0, p); - - // Skip leading whitespaces in the argument. - // - if (line[p] == '=') - ++p; - else - { - n = line.size (); - for (++p; p < n; ++p) - { - char c (line[p]); - if (c != ' ' && c != '\t' && c != '\r') - break; - } - } - } - else if (!skip_) - skip_ = (line == "--"); - - string s2 (line, p != string::npos ? p : 0); - - // If the string (which is an option value or argument) is - // wrapped in quotes, remove them. - // - n = s2.size (); - char cf (s2[0]), cl (s2[n - 1]); - - if (cf == '"' || cf == '\'' || cl == '"' || cl == '\'') - { - if (n == 1 || cf != cl) - throw unmatched_quote (s2); - - s2 = string (s2, 1, n - 2); - } - - if (!s1.empty ()) - { - // See if this is another file option. - // - const option_info* oi; - if (!skip_ && (oi = find (s1.c_str ()))) - { - if (s2.empty ()) - throw missing_value (oi->option); - - if (oi->search_func != 0) - { - string f (oi->search_func (s2.c_str (), oi->arg)); - if (!f.empty ()) - load (f); - } - else - { - // If the path of the file being parsed is not simple and the - // path of the file that needs to be loaded is relative, then - // complete the latter using the former as a base. - // -#ifndef _WIN32 - string::size_type p (file.find_last_of ('/')); - bool c (p != string::npos && s2[0] != '/'); -#else - string::size_type p (file.find_last_of ("/\\")); - bool c (p != string::npos && s2[1] != ':'); -#endif - if (c) - s2.insert (0, file, 0, p + 1); - - load (s2); - } - - continue; - } - - a.value = s1; - args_.push_back (a); - } - - a.value = s2; - args_.push_back (a); - } - } - - void options:: - push_back (const option& o) - { - container_type::size_type n (size ()); - container_type::push_back (o); - map_[o.name ()] = n; - - for (option_names::const_iterator i (o.aliases ().begin ()); - i != o.aliases ().end (); ++i) - map_[*i] = n; - } - - template - struct parser - { - static void - parse (X& x, bool& xs, scanner& s) - { - using namespace std; - - const char* o (s.next ()); - if (s.more ()) - { - string v (s.next ()); - istringstream is (v); - if (!(is >> x && is.peek () == istringstream::traits_type::eof ())) - throw invalid_value (o, v); - } - else - throw missing_value (o); - - xs = true; - } - }; - - template <> - struct parser - { - static void - parse (bool& x, bool& xs, scanner& s) - { - const char* o (s.next ()); - - if (s.more ()) - { - const char* v (s.next ()); - - if (std::strcmp (v, "1") == 0 || - std::strcmp (v, "true") == 0 || - std::strcmp (v, "TRUE") == 0 || - std::strcmp (v, "True") == 0) - x = true; - else if (std::strcmp (v, "0") == 0 || - std::strcmp (v, "false") == 0 || - std::strcmp (v, "FALSE") == 0 || - std::strcmp (v, "False") == 0) - x = false; - else - throw invalid_value (o, v); - } - else - throw missing_value (o); - - xs = true; - } - }; - - template <> - struct parser - { - static void - parse (std::string& x, bool& xs, scanner& s) - { - const char* o (s.next ()); - - if (s.more ()) - x = s.next (); - else - throw missing_value (o); - - xs = true; - } - }; - - template - struct parser > - { - static void - parse (std::pair& x, bool& xs, scanner& s) - { - x.second = s.position (); - parser::parse (x.first, xs, s); - } - }; - - template - struct parser > - { - static void - parse (std::vector& c, bool& xs, scanner& s) - { - X x; - bool dummy; - parser::parse (x, dummy, s); - c.push_back (x); - xs = true; - } - }; - - template - struct parser > - { - static void - parse (std::set& c, bool& xs, scanner& s) - { - X x; - bool dummy; - parser::parse (x, dummy, s); - c.insert (x); - xs = true; - } - }; - - template - struct parser > - { - static void - parse (std::map& m, bool& xs, scanner& s) - { - const char* o (s.next ()); - - if (s.more ()) - { - std::size_t pos (s.position ()); - std::string ov (s.next ()); - std::string::size_type p = ov.find ('='); - - K k = K (); - V v = V (); - std::string kstr (ov, 0, p); - std::string vstr (ov, (p != std::string::npos ? p + 1 : ov.size ())); - - int ac (2); - char* av[] = - { - const_cast (o), - 0 - }; - - bool dummy; - if (!kstr.empty ()) - { - av[1] = const_cast (kstr.c_str ()); - argv_scanner s (0, ac, av, false, pos); - parser::parse (k, dummy, s); - } - - if (!vstr.empty ()) - { - av[1] = const_cast (vstr.c_str ()); - argv_scanner s (0, ac, av, false, pos); - parser::parse (v, dummy, s); - } - - m[k] = v; - } - else - throw missing_value (o); - - xs = true; - } - }; - - template - void - thunk (X& x, scanner& s) - { - parser::parse (x.*M, s); - } - - template - void - thunk (X& x, scanner& s) - { - s.next (); - x.*M = true; - } - - template - void - thunk (X& x, scanner& s) - { - parser::parse (x.*M, x.*S, s); - } -} - -#include - -// options -// - -options:: -options () -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ -} - -options:: -options (int& argc, - char** argv, - bool erase, - ::cli::unknown_mode opt, - ::cli::unknown_mode arg) -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ - ::cli::argv_scanner s (argc, argv, erase); - _parse (s, opt, arg); -} - -options:: -options (int start, - int& argc, - char** argv, - bool erase, - ::cli::unknown_mode opt, - ::cli::unknown_mode arg) -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ - ::cli::argv_scanner s (start, argc, argv, erase); - _parse (s, opt, arg); -} - -options:: -options (int& argc, - char** argv, - int& end, - bool erase, - ::cli::unknown_mode opt, - ::cli::unknown_mode arg) -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ - ::cli::argv_scanner s (argc, argv, erase); - _parse (s, opt, arg); - end = s.end (); -} - -options:: -options (int start, - int& argc, - char** argv, - int& end, - bool erase, - ::cli::unknown_mode opt, - ::cli::unknown_mode arg) -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ - ::cli::argv_scanner s (start, argc, argv, erase); - _parse (s, opt, arg); - end = s.end (); -} - -options:: -options (::cli::scanner& s, - ::cli::unknown_mode opt, - ::cli::unknown_mode arg) -: build2_metadata_ (), - build2_metadata_specified_ (false), - help_ (), - version_ (), - I_ (), - I_specified_ (false), - D_ (), - D_specified_ (false), - U_ (), - U_specified_ (false), - database_ (), - database_specified_ (false), - multi_database_ (::multi_database::disabled), - multi_database_specified_ (false), - default_database_ (), - default_database_specified_ (false), - generate_query_ (), - generate_prepared_ (), - omit_unprepared_ (), - generate_session_ (), - generate_schema_ (), - generate_schema_only_ (), - suppress_migration_ (), - suppress_schema_version_ (), - schema_version_table_ (), - schema_version_table_specified_ (false), - schema_format_ (), - schema_format_specified_ (false), - omit_drop_ (), - omit_create_ (), - schema_name_ (), - schema_name_specified_ (false), - fkeys_deferrable_mode_ (), - fkeys_deferrable_mode_specified_ (false), - default_pointer_ ("*"), - default_pointer_specified_ (false), - session_type_ ("odb::session"), - session_type_specified_ (false), - profile_ (), - profile_specified_ (false), - at_once_ (), - schema_ (), - schema_specified_ (false), - export_symbol_ (), - export_symbol_specified_ (false), - extern_symbol_ (), - extern_symbol_specified_ (false), - std_ (cxx_version::cxx98), - std_specified_ (false), - warn_hard_add_ (), - warn_hard_delete_ (), - warn_hard_ (), - output_dir_ (), - output_dir_specified_ (false), - input_name_ (), - input_name_specified_ (false), - changelog_ (), - changelog_specified_ (false), - changelog_in_ (), - changelog_in_specified_ (false), - changelog_out_ (), - changelog_out_specified_ (false), - changelog_dir_ (), - changelog_dir_specified_ (false), - init_changelog_ (), - odb_file_suffix_ (), - odb_file_suffix_specified_ (false), - sql_file_suffix_ (), - sql_file_suffix_specified_ (false), - schema_file_suffix_ (), - schema_file_suffix_specified_ (false), - changelog_file_suffix_ (), - changelog_file_suffix_specified_ (false), - hxx_suffix_ (".hxx"), - hxx_suffix_specified_ (false), - ixx_suffix_ (".ixx"), - ixx_suffix_specified_ (false), - cxx_suffix_ (".cxx"), - cxx_suffix_specified_ (false), - sql_suffix_ (".sql"), - sql_suffix_specified_ (false), - changelog_suffix_ (".xml"), - changelog_suffix_specified_ (false), - hxx_prologue_ (), - hxx_prologue_specified_ (false), - ixx_prologue_ (), - ixx_prologue_specified_ (false), - cxx_prologue_ (), - cxx_prologue_specified_ (false), - schema_prologue_ (), - schema_prologue_specified_ (false), - sql_prologue_ (), - sql_prologue_specified_ (false), - migration_prologue_ (), - migration_prologue_specified_ (false), - sql_interlude_ (), - sql_interlude_specified_ (false), - hxx_epilogue_ (), - hxx_epilogue_specified_ (false), - ixx_epilogue_ (), - ixx_epilogue_specified_ (false), - cxx_epilogue_ (), - cxx_epilogue_specified_ (false), - schema_epilogue_ (), - schema_epilogue_specified_ (false), - sql_epilogue_ (), - sql_epilogue_specified_ (false), - migration_epilogue_ (), - migration_epilogue_specified_ (false), - hxx_prologue_file_ (), - hxx_prologue_file_specified_ (false), - ixx_prologue_file_ (), - ixx_prologue_file_specified_ (false), - cxx_prologue_file_ (), - cxx_prologue_file_specified_ (false), - schema_prologue_file_ (), - schema_prologue_file_specified_ (false), - sql_prologue_file_ (), - sql_prologue_file_specified_ (false), - migration_prologue_file_ (), - migration_prologue_file_specified_ (false), - sql_interlude_file_ (), - sql_interlude_file_specified_ (false), - hxx_epilogue_file_ (), - hxx_epilogue_file_specified_ (false), - ixx_epilogue_file_ (), - ixx_epilogue_file_specified_ (false), - cxx_epilogue_file_ (), - cxx_epilogue_file_specified_ (false), - schema_epilogue_file_ (), - schema_epilogue_file_specified_ (false), - sql_epilogue_file_ (), - sql_epilogue_file_specified_ (false), - migration_epilogue_file_ (), - migration_epilogue_file_specified_ (false), - odb_prologue_ (), - odb_prologue_specified_ (false), - odb_prologue_file_ (), - odb_prologue_file_specified_ (false), - odb_epilogue_ (), - odb_epilogue_specified_ (false), - odb_epilogue_file_ (), - odb_epilogue_file_specified_ (false), - table_prefix_ (), - table_prefix_specified_ (false), - index_suffix_ (), - index_suffix_specified_ (false), - fkey_suffix_ (), - fkey_suffix_specified_ (false), - sequence_suffix_ (), - sequence_suffix_specified_ (false), - sql_name_case_ (), - sql_name_case_specified_ (false), - table_regex_ (), - table_regex_specified_ (false), - column_regex_ (), - column_regex_specified_ (false), - index_regex_ (), - index_regex_specified_ (false), - fkey_regex_ (), - fkey_regex_specified_ (false), - sequence_regex_ (), - sequence_regex_specified_ (false), - statement_regex_ (), - statement_regex_specified_ (false), - sql_name_regex_ (), - sql_name_regex_specified_ (false), - sql_name_regex_trace_ (), - accessor_regex_ (), - accessor_regex_specified_ (false), - accessor_regex_trace_ (), - modifier_regex_ (), - modifier_regex_specified_ (false), - modifier_regex_trace_ (), - include_with_brackets_ (), - include_prefix_ (), - include_prefix_specified_ (false), - include_regex_ (), - include_regex_specified_ (false), - include_regex_trace_ (), - guard_prefix_ (), - guard_prefix_specified_ (false), - show_sloc_ (), - sloc_limit_ (), - sloc_limit_specified_ (false), - options_file_ (), - options_file_specified_ (false), - x_ (), - x_specified_ (false), - v_ (), - trace_ (), - mysql_engine_ ("InnoDB"), - mysql_engine_specified_ (false), - sqlite_override_null_ (), - sqlite_lax_auto_id_ (), - pgsql_server_version_ (7, 4), - pgsql_server_version_specified_ (false), - oracle_client_version_ (10, 1), - oracle_client_version_specified_ (false), - oracle_warn_truncation_ (), - mssql_server_version_ (10, 0), - mssql_server_version_specified_ (false), - mssql_short_limit_ (1024), - mssql_short_limit_specified_ (false) -{ - _parse (s, opt, arg); -} - -::cli::usage_para options:: -print_usage (::std::ostream& os, ::cli::usage_para p) -{ - CLI_POTENTIALLY_UNUSED (os); - - if (p == ::cli::usage_para::text) - os << ::std::endl; - - os << "--help Print usage information and exit." << ::std::endl; - - os << "--version Print version and exit." << ::std::endl; - - os << "-I Add to the beginning of the list of" << ::std::endl - << " directories to be searched for included header" << ::std::endl - << " files." << ::std::endl; - - os << "-D [=] Define macro with definition ." << ::std::endl; - - os << "-U Cancel any previous definitions of macro ," << ::std::endl - << " either built-in or provided with the -D option." << ::std::endl; - - os << "--database|-d Generate code for the database." << ::std::endl; - - os << "--multi-database|-m Enable multi-database support and specify its" << ::std::endl - << " type." << ::std::endl; - - os << "--default-database When static multi-database support is used," << ::std::endl - << " specify the database that should be made the" << ::std::endl - << " default." << ::std::endl; - - os << "--generate-query|-q Generate query support code." << ::std::endl; - - os << "--generate-prepared Generate prepared query execution support code." << ::std::endl; - - os << "--omit-unprepared Omit un-prepared (once-off) query execution" << ::std::endl - << " support code." << ::std::endl; - - os << "--generate-session|-e Generate session support code." << ::std::endl; - - os << "--generate-schema|-s Generate the database schema." << ::std::endl; - - os << "--generate-schema-only Generate only the database schema." << ::std::endl; - - os << "--suppress-migration Suppress the generation of database schema" << ::std::endl - << " migration statements." << ::std::endl; - - os << "--suppress-schema-version Suppress the generation of schema version table." << ::std::endl; - - os << "--schema-version-table Specify the alternative schema version table name" << ::std::endl - << " instead of the default schema_version." << ::std::endl; - - os << "--schema-format Generate the database schema in the specified" << ::std::endl - << " format." << ::std::endl; - - os << "--omit-drop Omit DROP statements from the generated database" << ::std::endl - << " schema." << ::std::endl; - - os << "--omit-create Omit CREATE statements from the generated" << ::std::endl - << " database schema." << ::std::endl; - - os << "--schema-name Use as the database schema name." << ::std::endl; - - os << "--fkeys-deferrable-mode Use constraint checking mode in foreign keys" << ::std::endl - << " generated for object relationships." << ::std::endl; - - os << "--default-pointer Use as the default pointer for persistent" << ::std::endl - << " objects and views." << ::std::endl; - - os << "--session-type Use as the alternative session type" << ::std::endl - << " instead of the default odb::session." << ::std::endl; - - os << "--profile|-p Specify a profile that should be used during" << ::std::endl - << " compilation." << ::std::endl; - - os << "--at-once Generate code for all the input files as well as" << ::std::endl - << " for all the files that they include at once." << ::std::endl; - - os << "--schema Specify a database schema (database namespace)" << ::std::endl - << " that should be assigned to the persistent classes" << ::std::endl - << " in the file being compiled." << ::std::endl; - - os << "--export-symbol Insert in places where DLL export/import" << ::std::endl - << " control statements" << ::std::endl - << " (__declspec(dllexport/dllimport)) are necessary." << ::std::endl; - - os << "--extern-symbol If is defined, insert it in places where" << ::std::endl - << " a template instantiation must be declared extern." << ::std::endl; - - os << "--std Specify the C++ standard that should be used" << ::std::endl - << " during compilation." << ::std::endl; - - os << "--warn-hard-add Warn about hard-added data members." << ::std::endl; - - os << "--warn-hard-delete Warn about hard-deleted data members and" << ::std::endl - << " persistent classes." << ::std::endl; - - os << "--warn-hard Warn about both hard-added and hard-deleted data" << ::std::endl - << " members and persistent classes." << ::std::endl; - - os << "--output-dir|-o Write the generated files to instead of the" << ::std::endl - << " current directory." << ::std::endl; - - os << "--input-name Use instead of the input file to derive" << ::std::endl - << " the names of the generated files." << ::std::endl; - - os << "--changelog Read/write changelog from/to instead of" << ::std::endl - << " the default changelog file." << ::std::endl; - - os << "--changelog-in Read changelog from instead of the default" << ::std::endl - << " changelog file." << ::std::endl; - - os << "--changelog-out Write changelog to instead of the default" << ::std::endl - << " changelog file." << ::std::endl; - - os << "--changelog-dir Use instead of the input file directory as" << ::std::endl - << " the changelog file directory." << ::std::endl; - - os << "--init-changelog Force re-initialization of the changelog even if" << ::std::endl - << " one exists (all the existing change history will" << ::std::endl - << " be lost)." << ::std::endl; - - os << "--odb-file-suffix Use to construct the names of the" << ::std::endl - << " generated C++ files." << ::std::endl; - - os << "--sql-file-suffix Use to construct the name of the" << ::std::endl - << " generated schema SQL file." << ::std::endl; - - os << "--schema-file-suffix Use to construct the name of the" << ::std::endl - << " generated schema C++ source file." << ::std::endl; - - os << "--changelog-file-suffix Use to construct the name of the changelog" << ::std::endl - << " file." << ::std::endl; - - os << "--hxx-suffix Use instead of the default .hxx to" << ::std::endl - << " construct the name of the generated C++ header" << ::std::endl - << " file." << ::std::endl; - - os << "--ixx-suffix Use instead of the default .ixx to" << ::std::endl - << " construct the name of the generated C++ inline" << ::std::endl - << " file." << ::std::endl; - - os << "--cxx-suffix Use instead of the default .cxx to" << ::std::endl - << " construct the name of the generated C++ source" << ::std::endl - << " file." << ::std::endl; - - os << "--sql-suffix Use instead of the default .sql to" << ::std::endl - << " construct the name of the generated database" << ::std::endl - << " schema file." << ::std::endl; - - os << "--changelog-suffix Use instead of the default .xml to" << ::std::endl - << " construct the name of the changelog file." << ::std::endl; - - os << "--hxx-prologue Insert at the beginning of the generated" << ::std::endl - << " C++ header file." << ::std::endl; - - os << "--ixx-prologue Insert at the beginning of the generated" << ::std::endl - << " C++ inline file." << ::std::endl; - - os << "--cxx-prologue Insert at the beginning of the generated" << ::std::endl - << " C++ source file." << ::std::endl; - - os << "--schema-prologue Insert at the beginning of the generated" << ::std::endl - << " schema C++ source file." << ::std::endl; - - os << "--sql-prologue Insert at the beginning of the generated" << ::std::endl - << " database schema file." << ::std::endl; - - os << "--migration-prologue Insert at the beginning of the generated" << ::std::endl - << " database migration file." << ::std::endl; - - os << "--sql-interlude Insert after all the DROP and before any" << ::std::endl - << " CREATE statements in the generated database" << ::std::endl - << " schema file." << ::std::endl; - - os << "--hxx-epilogue Insert at the end of the generated C++" << ::std::endl - << " header file." << ::std::endl; - - os << "--ixx-epilogue Insert at the end of the generated C++" << ::std::endl - << " inline file." << ::std::endl; - - os << "--cxx-epilogue Insert at the end of the generated C++" << ::std::endl - << " source file." << ::std::endl; - - os << "--schema-epilogue Insert at the end of the generated schema" << ::std::endl - << " C++ source file." << ::std::endl; - - os << "--sql-epilogue Insert at the end of the generated" << ::std::endl - << " database schema file." << ::std::endl; - - os << "--migration-epilogue Insert at the end of the generated" << ::std::endl - << " database migration file." << ::std::endl; - - os << "--hxx-prologue-file Insert the content of at the beginning of" << ::std::endl - << " the generated C++ header file." << ::std::endl; - - os << "--ixx-prologue-file Insert the content of at the beginning of" << ::std::endl - << " the generated C++ inline file." << ::std::endl; - - os << "--cxx-prologue-file Insert the content of at the beginning of" << ::std::endl - << " the generated C++ source file." << ::std::endl; - - os << "--schema-prologue-file Insert the content of at the beginning of" << ::std::endl - << " the generated schema C++ source file." << ::std::endl; - - os << "--sql-prologue-file Insert the content of at the beginning of" << ::std::endl - << " the generated database schema file." << ::std::endl; - - os << "--migration-prologue-file Insert the content of file at the beginning" << ::std::endl - << " of the generated database migration file." << ::std::endl; - - os << "--sql-interlude-file Insert the content of after all the DROP" << ::std::endl - << " and before any CREATE statements in the generated" << ::std::endl - << " database schema file." << ::std::endl; - - os << "--hxx-epilogue-file Insert the content of at the end of the" << ::std::endl - << " generated C++ header file." << ::std::endl; - - os << "--ixx-epilogue-file Insert the content of at the end of the" << ::std::endl - << " generated C++ inline file." << ::std::endl; - - os << "--cxx-epilogue-file Insert the content of at the end of the" << ::std::endl - << " generated C++ source file." << ::std::endl; - - os << "--schema-epilogue-file Insert the content of at the end of the" << ::std::endl - << " generated schema C++ source file." << ::std::endl; - - os << "--sql-epilogue-file Insert the content of at the end of the" << ::std::endl - << " generated database schema file." << ::std::endl; - - os << "--migration-epilogue-file Insert the content of file at the end of the" << ::std::endl - << " generated database migration file." << ::std::endl; - - os << "--odb-prologue Compile before the input header file." << ::std::endl; - - os << "--odb-prologue-file Compile contents before the input header" << ::std::endl - << " file." << ::std::endl; - - os << "--odb-epilogue Compile after the input header file." << ::std::endl; - - os << "--odb-epilogue-file Compile contents after the input header" << ::std::endl - << " file." << ::std::endl; - - os << "--table-prefix Add to table names and, for databases" << ::std::endl - << " that have global index and/or foreign key names," << ::std::endl - << " to those names as well." << ::std::endl; - - os << "--index-suffix Use instead of the default _i to" << ::std::endl - << " construct index names." << ::std::endl; - - os << "--fkey-suffix Use instead of the default _fk to" << ::std::endl - << " construct foreign key names." << ::std::endl; - - os << "--sequence-suffix Use instead of the default _seq to" << ::std::endl - << " construct sequence names." << ::std::endl; - - os << "--sql-name-case Convert all automatically-derived SQL names to" << ::std::endl - << " upper or lower case." << ::std::endl; - - os << "--table-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " table names." << ::std::endl; - - os << "--column-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " column names." << ::std::endl; - - os << "--index-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " index names." << ::std::endl; - - os << "--fkey-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " foreign key names." << ::std::endl; - - os << "--sequence-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " sequence names." << ::std::endl; - - os << "--statement-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform automatically-derived" << ::std::endl - << " prepared statement names." << ::std::endl; - - os << "--sql-name-regex Add to the list of regular expressions" << ::std::endl - << " that is used to transform all" << ::std::endl - << " automatically-derived SQL names." << ::std::endl; - - os << "--sql-name-regex-trace Trace the process of applying regular expressions" << ::std::endl - << " specified with the SQL name --*-regex options." << ::std::endl; - - os << "--accessor-regex Add to the list of regular expressions" << ::std::endl - << " used to transform data member names to function" << ::std::endl - << " names when searching for a suitable accessor" << ::std::endl - << " function." << ::std::endl; - - os << "--accessor-regex-trace Trace the process of applying regular expressions" << ::std::endl - << " specified with the --accessor-regex option." << ::std::endl; - - os << "--modifier-regex Add to the list of regular expressions" << ::std::endl - << " used to transform data member names to function" << ::std::endl - << " names when searching for a suitable modifier" << ::std::endl - << " function." << ::std::endl; - - os << "--modifier-regex-trace Trace the process of applying regular expressions" << ::std::endl - << " specified with the --modifier-regex option." << ::std::endl; - - os << "--include-with-brackets Use angle brackets (<>) instead of quotes (\"\") in" << ::std::endl - << " the generated #include directives." << ::std::endl; - - os << "--include-prefix Add to the generated #include directive" << ::std::endl - << " paths." << ::std::endl; - - os << "--include-regex Add to the list of regular expressions" << ::std::endl - << " used to transform generated #include directive" << ::std::endl - << " paths." << ::std::endl; - - os << "--include-regex-trace Trace the process of applying regular expressions" << ::std::endl - << " specified with the --include-regex option." << ::std::endl; - - os << "--guard-prefix Add to the generated header inclusion" << ::std::endl - << " guards." << ::std::endl; - - os << "--show-sloc Print the number of generated physical source" << ::std::endl - << " lines of code (SLOC)." << ::std::endl; - - os << "--sloc-limit Check that the number of generated physical" << ::std::endl - << " source lines of code (SLOC) does not exceed" << ::std::endl - << " ." << ::std::endl; - - os << "--options-file Read additional options from ." << ::std::endl; - - os << "-x