| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 2 |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> |
| 3 |
|
| 4 |
<head> |
| 5 |
<title>ODB 2.4.0 Compiler Command Line Manual</title> |
| 6 |
|
| 7 |
<meta name="copyright" content="© 2009-2015 Code Synthesis Tools CC"/> |
| 8 |
<meta name="keywords" content="odb,object,relational,mapping,compiler,c++"/> |
| 9 |
<meta name="description" content="ODB Compiler Command Line Manual"/> |
| 10 |
|
| 11 |
<link rel="stylesheet" type="text/css" href="default.css" /> |
| 12 |
|
| 13 |
<style type="text/css"> |
| 14 |
|
| 15 |
#synopsis { |
| 16 |
list-style-type: none; |
| 17 |
} |
| 18 |
|
| 19 |
#synopsis li { |
| 20 |
padding-top : 0.0em; |
| 21 |
padding-bottom : 0.0em; |
| 22 |
} |
| 23 |
|
| 24 |
#commands dt { |
| 25 |
padding-top : 0.4em; |
| 26 |
} |
| 27 |
|
| 28 |
#commands dd { |
| 29 |
padding-bottom : 0.4em; |
| 30 |
padding-left : 2em; |
| 31 |
} |
| 32 |
|
| 33 |
.options dt { |
| 34 |
padding-top : 0.4em; |
| 35 |
} |
| 36 |
|
| 37 |
.options dd { |
| 38 |
padding-top : 0.1em; |
| 39 |
padding-bottom : 0.4em; |
| 40 |
padding-left : 1.4em; |
| 41 |
} |
| 42 |
|
| 43 |
</style> |
| 44 |
</head> |
| 45 |
|
| 46 |
<body> |
| 47 |
<div id="container"> |
| 48 |
<div id="content"> |
| 49 |
|
| 50 |
<h1>NAME</h1> |
| 51 |
|
| 52 |
<p>odb - object-relational mapping (ORM) compiler for C++</p> |
| 53 |
|
| 54 |
<h1>SYNOPSIS</h1> |
| 55 |
|
| 56 |
<dl id="synopsis"> |
| 57 |
<dt><code><b>odb</b> [<i>options</i>] <i>file</i> [<i>file</i>...]</code></dt> |
| 58 |
</dl> |
| 59 |
|
| 60 |
<h1>DESCRIPTION</h1> |
| 61 |
|
| 62 |
<p>Given a set of C++ classes in a header file, <code><b>odb</b></code> |
| 63 |
generates C++ code that allows you to persist, query, and update objects |
| 64 |
of these classes in a relational database (RDBMS). The relational |
| 65 |
database that the generated code should target is specified with the |
| 66 |
required <code><b>--database</b></code> option (see below).</p> |
| 67 |
|
| 68 |
<p>For an input file in the form <code><b>name.hxx</b></code> (other |
| 69 |
file extensions can be used instead of <code><b>.hxx</b></code>), |
| 70 |
in the single-database mode (the default), the generated C++ files |
| 71 |
by default have the following names: |
| 72 |
<code><b>name-odb.hxx</b></code> (header file), |
| 73 |
<code><b>name-odb.ixx</b></code> (inline file), and |
| 74 |
<code><b>name-odb.cxx</b></code> (source file). |
| 75 |
|
| 76 |
Additionally, if the <code><b>--generate-schema</b></code> option is |
| 77 |
specified and the <code><b>sql</b></code> schema format is requested (see |
| 78 |
<code><b>--schema-format</b></code>), the <code><b>name.sql</b></code> |
| 79 |
database schema file is generated. If the <code><b>separate</b></code> |
| 80 |
schema format is requested, the database creation code is generated |
| 81 |
into the separate <code><b>name-schema.cxx</b></code> file.</p> |
| 82 |
|
| 83 |
<p>In the multi-database mode (see the <code><b>--multi-database</b></code> |
| 84 |
option below), the generated files corresponding to the |
| 85 |
<code><b>common</b></code> database have the same names as in the |
| 86 |
single-database mode. For other databases, the file names include |
| 87 |
the database name: |
| 88 |
<code><b>name-odb-</b><i>db</i><b>.hxx</b></code>, |
| 89 |
<code><b>name-odb-</b><i>db</i><b>.ixx</b></code>, |
| 90 |
<code><b>name-odb-</b><i>db</i><b>.cxx</b></code>, |
| 91 |
<code><b>name-</b><i>db</i><b>.sql</b></code>, and |
| 92 |
<code><b>name-schema-</b><i>db</i><b>.cxx</b></code> |
| 93 |
(where <code><i>db</i></code> is the database name).</p> |
| 94 |
|
| 95 |
<h1>OPTIONS</h1> |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
<dl class="options"> |
| 103 |
<dt><code><b>--help</b></code></dt> |
| 104 |
<dd>Print usage information and exit.</dd> |
| 105 |
|
| 106 |
<dt><code><b>--version</b></code></dt> |
| 107 |
<dd>Print version and exit.</dd> |
| 108 |
|
| 109 |
<dt><code><b>-I</b></code> <i>dir</i></dt> |
| 110 |
<dd>Add <i>dir</i> to the beginning of the list of directories to be searched |
| 111 |
for included header files.</dd> |
| 112 |
|
| 113 |
<dt><code><b>-D</b></code> <i>name</i>[=<i>def</i>]</dt> |
| 114 |
<dd>Define macro <i>name</i> with definition <i>def</i>. If definition is |
| 115 |
omitted, define <i>name</i> to be 1.</dd> |
| 116 |
|
| 117 |
<dt><code><b>-U</b></code> <i>name</i></dt> |
| 118 |
<dd>Cancel any previous definitions of macro <i>name</i>, either built-in or |
| 119 |
provided with the <code><b>-D</b></code> option.</dd> |
| 120 |
|
| 121 |
<dt><code><b>--database</b></code>|<code><b>-d</b></code> <i>db</i></dt> |
| 122 |
<dd>Generate code for the <i>db</i> database. Valid values are |
| 123 |
<code><b>mssql</b></code>, <code><b>mysql</b></code>, |
| 124 |
<code><b>oracle</b></code>, <code><b>pgsql</b></code>, |
| 125 |
<code><b>sqlite</b></code>, and <code><b>common</b></code> (multi-database |
| 126 |
mode only).</dd> |
| 127 |
|
| 128 |
<dt><code><b>--multi-database</b></code>|<code><b>-m</b></code> <i>type</i></dt> |
| 129 |
<dd>Enable multi-database support and specify its type. Valid values for this |
| 130 |
option are <code><b>static</b></code> and <code><b>dynamic</b></code>. |
| 131 |
|
| 132 |
<p>In the multi-database mode, options that determine the kind (for example, |
| 133 |
<code><b>--schema-format</b></code>), names (for example, |
| 134 |
<code><b>--odb-file-suffix</b></code>), or content (for example, prologue |
| 135 |
and epilogue options) of the output files can be prefixed with the database |
| 136 |
name followed by a colon, for example, <code><b>mysql:value</b></code>. This |
| 137 |
restricts the value of such an option to only apply to generated files |
| 138 |
corresponding to this database.</p></dd> |
| 139 |
|
| 140 |
<dt><code><b>--default-database</b></code> <i>db</i></dt> |
| 141 |
<dd>When static multi-database support is used, specify the database that should |
| 142 |
be made the default. When dynamic multi-database support is used, |
| 143 |
<code><b>common</b></code> is always made the default database.</dd> |
| 144 |
|
| 145 |
<dt><code><b>--generate-query</b></code>|<code><b>-q</b></code></dt> |
| 146 |
<dd>Generate query support code. Without this support you cannot use views and |
| 147 |
can only load objects via their ids.</dd> |
| 148 |
|
| 149 |
<dt><code><b>--generate-prepared</b></code></dt> |
| 150 |
<dd>Generate prepared query execution support code.</dd> |
| 151 |
|
| 152 |
<dt><code><b>--omit-unprepared</b></code></dt> |
| 153 |
<dd>Omit un-prepared (once-off) query execution support code.</dd> |
| 154 |
|
| 155 |
<dt><code><b>--generate-session</b></code>|<code><b>-e</b></code></dt> |
| 156 |
<dd>Generate session support code. With this option session support will be |
| 157 |
enabled by default for all the persistent classes except those for which it |
| 158 |
was explicitly disabled using the <code><b>db session</b></code> pragma.</dd> |
| 159 |
|
| 160 |
<dt><code><b>--generate-schema</b></code>|<code><b>-s</b></code></dt> |
| 161 |
<dd>Generate the database schema. The database schema contains SQL statements |
| 162 |
that create database tables necessary to store persistent classes defined in |
| 163 |
the file being compiled. Note that by applying this schema, all the existing |
| 164 |
information stored in such tables will be lost. |
| 165 |
|
| 166 |
<p>Depending on the database being used (<code><b>--database</b></code> |
| 167 |
option), the schema is generated either as a standalone SQL file or embedded |
| 168 |
into the generated C++ code. By default the SQL file is generated for the |
| 169 |
MySQL, PostgreSQL, Oracle, and Microsoft SQL Server databases and the schema |
| 170 |
is embedded into the C++ code for the SQLite database. Use the |
| 171 |
<code><b>--schema-format</b></code> option to alter the default schema |
| 172 |
format.</p> |
| 173 |
|
| 174 |
<p>If database schema evolution support is enabled (that is, the object |
| 175 |
model version is specified), then this option also triggers the generation |
| 176 |
of database schema migration statements, again either as standalong SQL |
| 177 |
files or embedded into the generated C++ code. You can suppress the |
| 178 |
generation of schema migration statements by specifying the |
| 179 |
<code><b>--suppress-migration</b></code> option.</p></dd> |
| 180 |
|
| 181 |
<dt><code><b>--generate-schema-only</b></code></dt> |
| 182 |
<dd>Generate only the database schema. Note that this option is only valid when |
| 183 |
generating schema as a standalone SQL file (see |
| 184 |
<code><b>--schema-format</b></code> for details).</dd> |
| 185 |
|
| 186 |
<dt><code><b>--suppress-migration</b></code></dt> |
| 187 |
<dd>Suppress the generation of database schema migration statements.</dd> |
| 188 |
|
| 189 |
<dt><code><b>--suppress-schema-version</b></code></dt> |
| 190 |
<dd>Suppress the generation of schema version table. If you specify this option |
| 191 |
then you are also expected to manually specify the database schema version |
| 192 |
and migration state at runtime using the |
| 193 |
<code><b>odb::database::schema_version()</b></code> function.</dd> |
| 194 |
|
| 195 |
<dt><code><b>--schema-version-table</b></code> <i>name</i></dt> |
| 196 |
<dd>Specify the alternative schema version table name instead of the default |
| 197 |
<code><b>schema_version</b></code>. If you specify this option then you are |
| 198 |
also expected to manually specify the schema version table name at runtime |
| 199 |
using the <code><b>odb::database::schema_version_table()</b></code> |
| 200 |
function. The table name can be qualified.</dd> |
| 201 |
|
| 202 |
<dt><code><b>--schema-format</b></code> <i>format</i></dt> |
| 203 |
<dd>Generate the database schema in the specified format. Pass |
| 204 |
<code><b>sql</b></code> as <i>format</i> to generate the database schema as |
| 205 |
a standalone SQL file or pass <code><b>embedded</b></code> to embed the |
| 206 |
schema into the generated C++ code. The <code><b>separate</b></code> value |
| 207 |
is similar to <code><b>embedded</b></code> except the schema creation code |
| 208 |
is generated into a separate C++ file (<code><b>name-schema.cxx</b></code> |
| 209 |
by default). This value is primarily useful if you want to place the schema |
| 210 |
creation functionality into a separate program or library. Repeat this |
| 211 |
option to generate the same database schema in multiple formats.</dd> |
| 212 |
|
| 213 |
<dt><code><b>--omit-drop</b></code></dt> |
| 214 |
<dd>Omit <code><b>DROP</b></code> statements from the generated database schema.</dd> |
| 215 |
|
| 216 |
<dt><code><b>--omit-create</b></code></dt> |
| 217 |
<dd>Omit <code><b>CREATE</b></code> statements from the generated database |
| 218 |
schema.</dd> |
| 219 |
|
| 220 |
<dt><code><b>--schema-name</b></code> <i>name</i></dt> |
| 221 |
<dd>Use <i>name</i> as the database schema name. Schema names are primarily used |
| 222 |
to distinguish between multiple embedded schemas in the schema catalog. They |
| 223 |
are not to be confused with database schemas (database namespaces) which are |
| 224 |
specified with the <code><b>--schema</b></code> option. If this option is |
| 225 |
not specified, the empty name, which is the default schema name, is used.</dd> |
| 226 |
|
| 227 |
<dt><code><b>--fkeys-deferrable-mode</b></code> <i>m</i></dt> |
| 228 |
<dd>Use constraint checking mode <i>m</i> in foreign keys generated for object |
| 229 |
relationships. Valid values for this option are |
| 230 |
<code><b>not_deferrable</b></code>, <code><b>immediate</b></code>, and |
| 231 |
<code><b>deferred</b></code> (default). MySQL and SQL Server do not support |
| 232 |
deferrable foreign keys and for these databases such keys are generated |
| 233 |
commented out. Other foreign keys generated by the ODB compiler (such as the |
| 234 |
ones used to support containers and polymorphic hierarchies) are always |
| 235 |
generated as not deferrable. |
| 236 |
|
| 237 |
<p>Note also that if you use either <code><b>not_deferrable</b></code> or |
| 238 |
<code><b>immediate</b></code> mode, then the order in which you persist, |
| 239 |
update, and erase objects within a transaction becomes important.</p></dd> |
| 240 |
|
| 241 |
<dt><code><b>--default-pointer</b></code> <i>ptr</i></dt> |
| 242 |
<dd>Use <i>ptr</i> as the default pointer for persistent objects and views. |
| 243 |
Objects and views that do not have a pointer assigned with the <code><b>db |
| 244 |
pointer</b></code> pragma will use this pointer by default. The value of |
| 245 |
this option can be <code><b>*</b></code> which denotes the raw pointer and |
| 246 |
is the default, or qualified name of a smart pointer class template, for |
| 247 |
example, <code><b>std::auto_ptr</b></code>. In the latter case, the ODB |
| 248 |
compiler constructs the object or view pointer by adding a single template |
| 249 |
argument of the object or view type to the qualified name, for example |
| 250 |
<code><b>std::auto_ptr<object></b></code>. The ODB runtime uses object |
| 251 |
and view pointers to return, and, in case of objects, pass and cache |
| 252 |
dynamically allocated instances of object and view types. |
| 253 |
|
| 254 |
<p>Except for the raw pointer and the standard smart pointers defined in the |
| 255 |
<code><b><memory></b></code> header file, you are expected to include the |
| 256 |
definition of the default pointer at the beginning of the generated header |
| 257 |
file. There are two common ways to achieve this: you can either include the |
| 258 |
necessary header in the file being compiled or you can use the |
| 259 |
<code><b>--hxx-prologue</b></code> option to add the necessary |
| 260 |
<code><b>#include</b></code> directive to the generated code.</p></dd> |
| 261 |
|
| 262 |
<dt><code><b>--session-type</b></code> <i>type</i></dt> |
| 263 |
<dd>Use <i>type</i> as the alternative session type instead of the default |
| 264 |
<code><b>odb::session</b></code>. This option can be used to specify a |
| 265 |
custom session implementation to be use by the persistent classes. Note that |
| 266 |
you will also need to include the definition of the custom session type into |
| 267 |
the generated header file. This is normally achieved with the |
| 268 |
<code><b>--hxx-prologue*</b></code> options.</dd> |
| 269 |
|
| 270 |
<dt><code><b>--profile</b></code>|<code><b>-p</b></code> <i>name</i></dt> |
| 271 |
<dd>Specify a profile that should be used during compilation. A profile is an |
| 272 |
options file. The ODB compiler first looks for a database-specific version |
| 273 |
with the name constructed by appending the |
| 274 |
<code><b>-</b></code><code><i>database</i></code><code><b>.options</b></code> |
| 275 |
suffix to <i>name</i>, where <code><i>database</i></code> is the database |
| 276 |
name as specified with the <code><b>--database</b></code> option. If this |
| 277 |
file is not found, then the ODB compiler looks for a database-independant |
| 278 |
version with the name constructed by appending just the |
| 279 |
<code><b>.options</b></code> suffix. |
| 280 |
|
| 281 |
<p>The profile options files are searched for in the same set of directories |
| 282 |
as C++ headers included with the <code><b>#include <...></b></code> |
| 283 |
directive (built-in paths plus those specified with the |
| 284 |
<code><b>-I</b></code> options). The options file is first searched for in |
| 285 |
the directory itself and then in its <code><b>odb/</b></code> |
| 286 |
subdirectory.</p> |
| 287 |
|
| 288 |
<p>For the format of the options file refer to the |
| 289 |
<code><b>--options-file</b></code> option below. You can repeat this option |
| 290 |
to specify more than one profile.</p></dd> |
| 291 |
|
| 292 |
<dt><code><b>--at-once</b></code></dt> |
| 293 |
<dd>Generate code for all the input files as well as for all the files that they |
| 294 |
include at once. The result is a single set of source/schema files that |
| 295 |
contain all the generated code. If more than one input file is specified |
| 296 |
together with this option, then the <code><b>--input-name</b></code> option |
| 297 |
must also be specified in order to provide the base name for the output |
| 298 |
files. In this case, the directory part of such a base name is used as the |
| 299 |
location of the combined file. This can be important for the |
| 300 |
<code><b>#include</b></code> directive resolution.</dd> |
| 301 |
|
| 302 |
<dt><code><b>--schema</b></code> <i>schema</i></dt> |
| 303 |
<dd>Specify a database schema (database namespace) that should be assigned to |
| 304 |
the persistent classes in the file being compiled. Database schemas are not |
| 305 |
to be confused with database schema names (schema catalog names) which are |
| 306 |
specified with the <code><b>--schema-name</b></code> option.</dd> |
| 307 |
|
| 308 |
<dt><code><b>--export-symbol</b></code> <i>symbol</i></dt> |
| 309 |
<dd>Insert <i>symbol</i> in places where DLL export/import control statements |
| 310 |
(<code><b>__declspec(dllexport/dllimport)</b></code>) are necessary. See |
| 311 |
also the <code><b>--extern-symbol</b></code> option below.</dd> |
| 312 |
|
| 313 |
<dt><code><b>--extern-symbol</b></code> <i>symbol</i></dt> |
| 314 |
<dd>If <i>symbol</i> is defined, insert it in places where a template |
| 315 |
instantiation must be declared <code><b>extern</b></code>. This option is |
| 316 |
normally used together with <code><b>--export-symbol</b></code> when both |
| 317 |
multi-database support and queries are enabled.</dd> |
| 318 |
|
| 319 |
<dt><code><b>--std</b></code> <i>version</i></dt> |
| 320 |
<dd>Specify the C++ standard that should be used during compilation. Valid |
| 321 |
values are <code><b>c++98</b></code> (default), <code><b>c++11</b></code>, |
| 322 |
and <code><b>c++14</b></code>.</dd> |
| 323 |
|
| 324 |
<dt><code><b>--warn-hard-add</b></code></dt> |
| 325 |
<dd>Warn about hard-added data members.</dd> |
| 326 |
|
| 327 |
<dt><code><b>--warn-hard-delete</b></code></dt> |
| 328 |
<dd>Warn about hard-deleted data members and persistent classes.</dd> |
| 329 |
|
| 330 |
<dt><code><b>--warn-hard</b></code></dt> |
| 331 |
<dd>Warn about both hard-added and hard-deleted data members and persistent |
| 332 |
classes.</dd> |
| 333 |
|
| 334 |
<dt><code><b>--output-dir</b></code>|<code><b>-o</b></code> <i>dir</i></dt> |
| 335 |
<dd>Write the generated files to <i>dir</i> instead of the current directory.</dd> |
| 336 |
|
| 337 |
<dt><code><b>--input-name</b></code> <i>name</i></dt> |
| 338 |
<dd>Use <i>name</i> instead of the input file to derive the names of the |
| 339 |
generated files. If the <code><b>--at-once</b></code> option is specified, |
| 340 |
then the directory part of <i>name</i> is used as the location of the |
| 341 |
combined file. Refer to the <code><b>--at-once</b></code> option for |
| 342 |
details.</dd> |
| 343 |
|
| 344 |
<dt><code><b>--changelog</b></code> <i>file</i></dt> |
| 345 |
<dd>Read/write changelog from/to <i>file</i> instead of the default changelog |
| 346 |
file. The default changelog file name is derived from the input file name |
| 347 |
and it is placed into the same directory as the input file. Note that the |
| 348 |
<code><b>--output-dir</b></code> option does not affect the changelog file |
| 349 |
location. In other words, by default, the changelog file is treated as |
| 350 |
another input rather than output even though the ODB compiler may modify it. |
| 351 |
Use the <code><b>--changelog-in</b></code> and |
| 352 |
<code><b>--changelog-out</b></code> options to specify different input and |
| 353 |
output chaneglog files.</dd> |
| 354 |
|
| 355 |
<dt><code><b>--changelog-in</b></code> <i>file</i></dt> |
| 356 |
<dd>Read changelog from <i>file</i> instead of the default changelog file. If |
| 357 |
this option is specified, then you must also specify the output chanegelog |
| 358 |
file with <code><b>--changelog-out</b></code>.</dd> |
| 359 |
|
| 360 |
<dt><code><b>--changelog-out</b></code> <i>file</i></dt> |
| 361 |
<dd>Write changelog to <i>file</i> instead of the default changelog file. If |
| 362 |
this option is specified, then you must also specify the input chanegelog |
| 363 |
file with <code><b>--changelog-in</b></code>.</dd> |
| 364 |
|
| 365 |
<dt><code><b>--changelog-dir</b></code> <i>dir</i></dt> |
| 366 |
<dd>Use <i>dir</i> instead of the input file directory as the changelog file |
| 367 |
directory. This directory is also added to changelog files specified with |
| 368 |
the <code><b>--changelog</b></code>, <code><b>--changelog-in</b></code>, and |
| 369 |
<code><b>--changelog-in</b></code> options unless they are absolute paths.</dd> |
| 370 |
|
| 371 |
<dt><code><b>--init-changelog</b></code></dt> |
| 372 |
<dd>Force re-initialization of the changelog even if one exists (all the |
| 373 |
existing change history will be lost). This option is primarily useful for |
| 374 |
automated testing.</dd> |
| 375 |
|
| 376 |
<dt><code><b>--odb-file-suffix</b></code> <i>suffix</i></dt> |
| 377 |
<dd>Use <i>suffix</i> to construct the names of the generated C++ files. In the |
| 378 |
single-database mode the default value for this option is |
| 379 |
<code><b>-odb</b></code>. In the multi-database mode it is |
| 380 |
<code><b>-odb</b></code> for the files corresponding to the |
| 381 |
<code><b>common</b></code> database and <code><b>-odb-</b><i>db</i></code> |
| 382 |
(where <code><i>db</i></code> is the database name) for other databases.</dd> |
| 383 |
|
| 384 |
<dt><code><b>--sql-file-suffix</b></code> <i>suffix</i></dt> |
| 385 |
<dd>Use <i>suffix</i> to construct the name of the generated schema SQL file. In |
| 386 |
the single-database mode by default no suffix is used. In the multi-database |
| 387 |
mode the default value for this option is <code><b>-</b><i>db</i></code> |
| 388 |
(where <code><i>db</i></code> is the database name).</dd> |
| 389 |
|
| 390 |
<dt><code><b>--schema-file-suffix</b></code> <i>suffix</i></dt> |
| 391 |
<dd>Use <i>suffix</i> to construct the name of the generated schema C++ source |
| 392 |
file. In the single-database mode the default value for this option is |
| 393 |
<code><b>-schema</b></code>. In the multi-database mode it is |
| 394 |
<code><b>-schema-</b><i>db</i></code> (where <code><i>db</i></code> is the |
| 395 |
database name). See the <code><b>--schema-format</b></code> option for |
| 396 |
details.</dd> |
| 397 |
|
| 398 |
<dt><code><b>--changelog-file-suffix</b></code> <i>sfx</i></dt> |
| 399 |
<dd>Use <i>sfx</i> to construct the name of the changelog file. In the |
| 400 |
single-database mode by default no suffix is used. In the multi-database |
| 401 |
mode the default value for this option is <code><b>-</b><i>db</i></code> |
| 402 |
(where <code><i>db</i></code> is the database name).</dd> |
| 403 |
|
| 404 |
<dt><code><b>--hxx-suffix</b></code> <i>suffix</i></dt> |
| 405 |
<dd>Use <i>suffix</i> instead of the default <code><b>.hxx</b></code> to |
| 406 |
construct the name of the generated C++ header file.</dd> |
| 407 |
|
| 408 |
<dt><code><b>--ixx-suffix</b></code> <i>suffix</i></dt> |
| 409 |
<dd>Use <i>suffix</i> instead of the default <code><b>.ixx</b></code> to |
| 410 |
construct the name of the generated C++ inline file.</dd> |
| 411 |
|
| 412 |
<dt><code><b>--cxx-suffix</b></code> <i>suffix</i></dt> |
| 413 |
<dd>Use <i>suffix</i> instead of the default <code><b>.cxx</b></code> to |
| 414 |
construct the name of the generated C++ source file.</dd> |
| 415 |
|
| 416 |
<dt><code><b>--sql-suffix</b></code> <i>suffix</i></dt> |
| 417 |
<dd>Use <i>suffix</i> instead of the default <code><b>.sql</b></code> to |
| 418 |
construct the name of the generated database schema file.</dd> |
| 419 |
|
| 420 |
<dt><code><b>--changelog-suffix</b></code> <i>suffix</i></dt> |
| 421 |
<dd>Use <i>suffix</i> instead of the default <code><b>.xml</b></code> to |
| 422 |
construct the name of the changelog file.</dd> |
| 423 |
|
| 424 |
<dt><code><b>--hxx-prologue</b></code> <i>text</i></dt> |
| 425 |
<dd>Insert <i>text</i> at the beginning of the generated C++ header file.</dd> |
| 426 |
|
| 427 |
<dt><code><b>--ixx-prologue</b></code> <i>text</i></dt> |
| 428 |
<dd>Insert <i>text</i> at the beginning of the generated C++ inline file.</dd> |
| 429 |
|
| 430 |
<dt><code><b>--cxx-prologue</b></code> <i>text</i></dt> |
| 431 |
<dd>Insert <i>text</i> at the beginning of the generated C++ source file.</dd> |
| 432 |
|
| 433 |
<dt><code><b>--schema-prologue</b></code> <i>text</i></dt> |
| 434 |
<dd>Insert <i>text</i> at the beginning of the generated schema C++ source file.</dd> |
| 435 |
|
| 436 |
<dt><code><b>--sql-prologue</b></code> <i>text</i></dt> |
| 437 |
<dd>Insert <i>text</i> at the beginning of the generated database schema file.</dd> |
| 438 |
|
| 439 |
<dt><code><b>--migration-prologue</b></code> <i>text</i></dt> |
| 440 |
<dd>Insert <i>text</i> at the beginning of the generated database migration |
| 441 |
file.</dd> |
| 442 |
|
| 443 |
<dt><code><b>--sql-interlude</b></code> <i>text</i></dt> |
| 444 |
<dd>Insert <i>text</i> after all the <code><b>DROP</b></code> and before any |
| 445 |
<code><b>CREATE</b></code> statements in the generated database schema file.</dd> |
| 446 |
|
| 447 |
<dt><code><b>--hxx-epilogue</b></code> <i>text</i></dt> |
| 448 |
<dd>Insert <i>text</i> at the end of the generated C++ header file.</dd> |
| 449 |
|
| 450 |
<dt><code><b>--ixx-epilogue</b></code> <i>text</i></dt> |
| 451 |
<dd>Insert <i>text</i> at the end of the generated C++ inline file.</dd> |
| 452 |
|
| 453 |
<dt><code><b>--cxx-epilogue</b></code> <i>text</i></dt> |
| 454 |
<dd>Insert <i>text</i> at the end of the generated C++ source file.</dd> |
| 455 |
|
| 456 |
<dt><code><b>--schema-epilogue</b></code> <i>text</i></dt> |
| 457 |
<dd>Insert <i>text</i> at the end of the generated schema C++ source file.</dd> |
| 458 |
|
| 459 |
<dt><code><b>--sql-epilogue</b></code> <i>text</i></dt> |
| 460 |
<dd>Insert <i>text</i> at the end of the generated database schema file.</dd> |
| 461 |
|
| 462 |
<dt><code><b>--migration-epilogue</b></code> <i>text</i></dt> |
| 463 |
<dd>Insert <i>text</i> at the end of the generated database migration file.</dd> |
| 464 |
|
| 465 |
<dt><code><b>--hxx-prologue-file</b></code> <i>file</i></dt> |
| 466 |
<dd>Insert the content of <i>file</i> at the beginning of the generated C++ |
| 467 |
header file.</dd> |
| 468 |
|
| 469 |
<dt><code><b>--ixx-prologue-file</b></code> <i>file</i></dt> |
| 470 |
<dd>Insert the content of <i>file</i> at the beginning of the generated C++ |
| 471 |
inline file.</dd> |
| 472 |
|
| 473 |
<dt><code><b>--cxx-prologue-file</b></code> <i>file</i></dt> |
| 474 |
<dd>Insert the content of <i>file</i> at the beginning of the generated C++ |
| 475 |
source file.</dd> |
| 476 |
|
| 477 |
<dt><code><b>--schema-prologue-file</b></code> <i>file</i></dt> |
| 478 |
<dd>Insert the content of <i>file</i> at the beginning of the generated schema |
| 479 |
C++ source file.</dd> |
| 480 |
|
| 481 |
<dt><code><b>--sql-prologue-file</b></code> <i>file</i></dt> |
| 482 |
<dd>Insert the content of <i>file</i> at the beginning of the generated database |
| 483 |
schema file.</dd> |
| 484 |
|
| 485 |
<dt><code><b>--migration-prologue-file</b></code> <i>f</i></dt> |
| 486 |
<dd>Insert the content of file <i>f</i> at the beginning of the generated |
| 487 |
database migration file.</dd> |
| 488 |
|
| 489 |
<dt><code><b>--sql-interlude-file</b></code> <i>file</i></dt> |
| 490 |
<dd>Insert the content of <i>file</i> after all the <code><b>DROP</b></code> and |
| 491 |
before any <code><b>CREATE</b></code> statements in the generated database |
| 492 |
schema file.</dd> |
| 493 |
|
| 494 |
<dt><code><b>--hxx-epilogue-file</b></code> <i>file</i></dt> |
| 495 |
<dd>Insert the content of <i>file</i> at the end of the generated C++ header |
| 496 |
file.</dd> |
| 497 |
|
| 498 |
<dt><code><b>--ixx-epilogue-file</b></code> <i>file</i></dt> |
| 499 |
<dd>Insert the content of <i>file</i> at the end of the generated C++ inline |
| 500 |
file.</dd> |
| 501 |
|
| 502 |
<dt><code><b>--cxx-epilogue-file</b></code> <i>file</i></dt> |
| 503 |
<dd>Insert the content of <i>file</i> at the end of the generated C++ source |
| 504 |
file.</dd> |
| 505 |
|
| 506 |
<dt><code><b>--schema-epilogue-file</b></code> <i>file</i></dt> |
| 507 |
<dd>Insert the content of <i>file</i> at the end of the generated schema C++ |
| 508 |
source file.</dd> |
| 509 |
|
| 510 |
<dt><code><b>--sql-epilogue-file</b></code> <i>file</i></dt> |
| 511 |
<dd>Insert the content of <i>file</i> at the end of the generated database |
| 512 |
schema file.</dd> |
| 513 |
|
| 514 |
<dt><code><b>--migration-epilogue-file</b></code> <i>f</i></dt> |
| 515 |
<dd>Insert the content of file <i>f</i> at the end of the generated database |
| 516 |
migration file.</dd> |
| 517 |
|
| 518 |
<dt><code><b>--odb-prologue</b></code> <i>text</i></dt> |
| 519 |
<dd>Compile <i>text</i> before the input header file. This option allows you to |
| 520 |
add additional declarations, such as custom traits specializations, to the |
| 521 |
ODB compilation process.</dd> |
| 522 |
|
| 523 |
<dt><code><b>--odb-prologue-file</b></code> <i>file</i></dt> |
| 524 |
<dd>Compile <i>file</i> contents before the input header file. Prologue files |
| 525 |
are compiled after all the prologue text fragments |
| 526 |
(<code><b>--odb-prologue</b></code> option).</dd> |
| 527 |
|
| 528 |
<dt><code><b>--odb-epilogue</b></code> <i>text</i></dt> |
| 529 |
<dd>Compile <i>text</i> after the input header file. This option allows you to |
| 530 |
add additional declarations, such as custom traits specializations, to the |
| 531 |
ODB compilation process.</dd> |
| 532 |
|
| 533 |
<dt><code><b>--odb-epilogue-file</b></code> <i>file</i></dt> |
| 534 |
<dd>Compile <i>file</i> contents after the input header file. Epilogue files are |
| 535 |
compiled after all the epilogue text fragments |
| 536 |
(<code><b>--odb-epilogue</b></code> option).</dd> |
| 537 |
|
| 538 |
<dt><code><b>--table-prefix</b></code> <i>prefix</i></dt> |
| 539 |
<dd>Add <i>prefix</i> to table names and, for databases that have global index |
| 540 |
and/or foreign key names, to those names as well. The prefix is added to |
| 541 |
both names that were specified with the <code><b>db table</b></code> and |
| 542 |
<code><b>db index</b></code> pragmas and those that were automatically |
| 543 |
derived from class and data member names. If you require a separator, such |
| 544 |
as an underscore, between the prefix and the name, then you should include |
| 545 |
it into the prefix value.</dd> |
| 546 |
|
| 547 |
<dt><code><b>--index-suffix</b></code> <i>suffix</i></dt> |
| 548 |
<dd>Use <i>suffix</i> instead of the default <code><b>_i</b></code> to construct |
| 549 |
index names. The suffix is only added to names that were automatically |
| 550 |
derived from data member names. If you require a separator, such as an |
| 551 |
underscore, between the name and the suffix, then you should include it into |
| 552 |
the suffix value.</dd> |
| 553 |
|
| 554 |
<dt><code><b>--fkey-suffix</b></code> <i>suffix</i></dt> |
| 555 |
<dd>Use <i>suffix</i> instead of the default <code><b>_fk</b></code> to |
| 556 |
construct foreign key names. If you require a separator, such as an |
| 557 |
underscore, between the name and the suffix, then you should include it into |
| 558 |
the suffix value.</dd> |
| 559 |
|
| 560 |
<dt><code><b>--sequence-suffix</b></code> <i>suffix</i></dt> |
| 561 |
<dd>Use <i>suffix</i> instead of the default <code><b>_seq</b></code> to |
| 562 |
construct sequence names. If you require a separator, such as an underscore, |
| 563 |
between the name and the suffix, then you should include it into the suffix |
| 564 |
value.</dd> |
| 565 |
|
| 566 |
<dt><code><b>--sql-name-case</b></code> <i>case</i></dt> |
| 567 |
<dd>Convert all automatically-derived SQL names to upper or lower case. Valid |
| 568 |
values for this option are <code><b>upper</b></code> and |
| 569 |
<code><b>lower</b></code>.</dd> |
| 570 |
|
| 571 |
<dt><code><b>--table-regex</b></code> <i>regex</i></dt> |
| 572 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 573 |
transform automatically-derived table names. See the SQL NAME |
| 574 |
TRANSFORMATIONS section below for details.</dd> |
| 575 |
|
| 576 |
<dt><code><b>--column-regex</b></code> <i>regex</i></dt> |
| 577 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 578 |
transform automatically-derived column names. See the SQL NAME |
| 579 |
TRANSFORMATIONS section below for details.</dd> |
| 580 |
|
| 581 |
<dt><code><b>--index-regex</b></code> <i>regex</i></dt> |
| 582 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 583 |
transform automatically-derived index names. See the SQL NAME |
| 584 |
TRANSFORMATIONS section below for details.</dd> |
| 585 |
|
| 586 |
<dt><code><b>--fkey-regex</b></code> <i>regex</i></dt> |
| 587 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 588 |
transform automatically-derived foreign key names. See the SQL NAME |
| 589 |
TRANSFORMATIONS section below for details.</dd> |
| 590 |
|
| 591 |
<dt><code><b>--sequence-regex</b></code> <i>regex</i></dt> |
| 592 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 593 |
transform automatically-derived sequence names. See the SQL NAME |
| 594 |
TRANSFORMATIONS section below for details.</dd> |
| 595 |
|
| 596 |
<dt><code><b>--statement-regex</b></code> <i>regex</i></dt> |
| 597 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 598 |
transform automatically-derived prepared statement names. See the SQL NAME |
| 599 |
TRANSFORMATIONS section below for details.</dd> |
| 600 |
|
| 601 |
<dt><code><b>--sql-name-regex</b></code> <i>regex</i></dt> |
| 602 |
<dd>Add <i>regex</i> to the list of regular expressions that is used to |
| 603 |
transform all automatically-derived SQL names. See the SQL NAME |
| 604 |
TRANSFORMATIONS section below for details.</dd> |
| 605 |
|
| 606 |
<dt><code><b>--sql-name-regex-trace</b></code></dt> |
| 607 |
<dd>Trace the process of applying regular expressions specified with the SQL |
| 608 |
name <code><b>--*-regex</b></code> options. Use this option to find out why |
| 609 |
your regular expressions don't do what you expected them to do.</dd> |
| 610 |
|
| 611 |
<dt><code><b>--accessor-regex</b></code> <i>regex</i></dt> |
| 612 |
<dd>Add <i>regex</i> to the list of regular expressions used to transform data |
| 613 |
member names to function names when searching for a suitable accessor |
| 614 |
function. The argument to this option is a Perl-like regular expression in |
| 615 |
the form |
| 616 |
<code><b>/</b><i>pattern</i><b>/</b><i>replacement</i><b>/</b></code>. Any |
| 617 |
character can be used as a delimiter instead of <code><b>/</b></code> and |
| 618 |
the delimiter can be escaped inside <code><i>pattern</i></code> and |
| 619 |
<code><i>replacement</i></code> with a backslash (<code><b>\</b></code>). |
| 620 |
You can specify multiple regular expressions by repeating this option. |
| 621 |
|
| 622 |
<p>All the regular expressions are tried in the order specified and the |
| 623 |
first expression that produces a suitable accessor function is used. Each |
| 624 |
expression is tried twice: first with the actual member name and then with |
| 625 |
the member's <i>public name</i> which is obtained by removing the common |
| 626 |
member name decorations, such as leading and trailing underscores, the |
| 627 |
<code><b>m_</b></code> prefix, etc. The ODB compiler also includes a number |
| 628 |
of built-in expressions for commonly used accessor names, such as |
| 629 |
<code><b>get_foo</b></code>, <code><b>getFoo</b></code>, |
| 630 |
<code><b>getfoo</b></code>, and just <code><b>foo</b></code>. The built-in |
| 631 |
expressions are tried last.</p> |
| 632 |
|
| 633 |
<p>As an example, the following expression transforms data members with |
| 634 |
public names in the form <code><b>foo</b></code> to accessor names in the |
| 635 |
form <code><b>GetFoo</b></code>:</p> |
| 636 |
|
| 637 |
<p><code><b>/(.+)/Get\u$1/</b></code></p> |
| 638 |
|
| 639 |
<p>See also the REGEX AND SHELL QUOTING section below.</p></dd> |
| 640 |
|
| 641 |
<dt><code><b>--accessor-regex-trace</b></code></dt> |
| 642 |
<dd>Trace the process of applying regular expressions specified with the |
| 643 |
<code><b>--accessor-regex</b></code> option. Use this option to find out why |
| 644 |
your regular expressions don't do what you expected them to do.</dd> |
| 645 |
|
| 646 |
<dt><code><b>--modifier-regex</b></code> <i>regex</i></dt> |
| 647 |
<dd>Add <i>regex</i> to the list of regular expressions used to transform data |
| 648 |
member names to function names when searching for a suitable modifier |
| 649 |
function. The argument to this option is a Perl-like regular expression in |
| 650 |
the form |
| 651 |
<code><b>/</b><i>pattern</i><b>/</b><i>replacement</i><b>/</b></code>. Any |
| 652 |
character can be used as a delimiter instead of <code><b>/</b></code> and |
| 653 |
the delimiter can be escaped inside <code><i>pattern</i></code> and |
| 654 |
<code><i>replacement</i></code> with a backslash (<code><b>\</b></code>). |
| 655 |
You can specify multiple regular expressions by repeating this option. |
| 656 |
|
| 657 |
<p>All the regular expressions are tried in the order specified and the |
| 658 |
first expression that produces a suitable modifier function is used. Each |
| 659 |
expression is tried twice: first with the actual member name and then with |
| 660 |
the member's <i>public name</i> which is obtained by removing the common |
| 661 |
member name decorations, such as leading and trailing underscores, the |
| 662 |
<code><b>m_</b></code> prefix, etc. The ODB compiler also includes a number |
| 663 |
of built-in expressions for commonly used modifier names, such as |
| 664 |
<code><b>set_foo</b></code>, <code><b>setFoo</b></code>, |
| 665 |
<code><b>setfoo</b></code>, and just <code><b>foo</b></code>. The built-in |
| 666 |
expressions are tried last.</p> |
| 667 |
|
| 668 |
<p>As an example, the following expression transforms data members with |
| 669 |
public names in the form <code><b>foo</b></code> to modifier names in the |
| 670 |
form <code><b>SetFoo</b></code>:</p> |
| 671 |
|
| 672 |
<p><code><b>/(.+)/Set\u$1/</b></code></p> |
| 673 |
|
| 674 |
<p>See also the REGEX AND SHELL QUOTING section below.</p></dd> |
| 675 |
|
| 676 |
<dt><code><b>--modifier-regex-trace</b></code></dt> |
| 677 |
<dd>Trace the process of applying regular expressions specified with the |
| 678 |
<code><b>--modifier-regex</b></code> option. Use this option to find out why |
| 679 |
your regular expressions don't do what you expected them to do.</dd> |
| 680 |
|
| 681 |
<dt><code><b>--include-with-brackets</b></code></dt> |
| 682 |
<dd>Use angle brackets (<>) instead of quotes ("") in the generated |
| 683 |
<code><b>#include</b></code> directives.</dd> |
| 684 |
|
| 685 |
<dt><code><b>--include-prefix</b></code> <i>prefix</i></dt> |
| 686 |
<dd>Add <i>prefix</i> to the generated <code><b>#include</b></code> directive |
| 687 |
paths.</dd> |
| 688 |
|
| 689 |
<dt><code><b>--include-regex</b></code> <i>regex</i></dt> |
| 690 |
<dd>Add <i>regex</i> to the list of regular expressions used to transform |
| 691 |
generated <code><b>#include</b></code> directive paths. The argument to this |
| 692 |
option is a Perl-like regular expression in the form |
| 693 |
<code><b>/</b><i>pattern</i><b>/</b><i>replacement</i><b>/</b></code>. Any |
| 694 |
character can be used as a delimiter instead of <code><b>/</b></code> and |
| 695 |
the delimiter can be escaped inside <code><i>pattern</i></code> and |
| 696 |
<code><i>replacement</i></code> with a backslash (<code><b>\</b></code>). |
| 697 |
You can specify multiple regular expressions by repeating this option. All |
| 698 |
the regular expressions are tried in the order specified and the first |
| 699 |
expression that matches is used. |
| 700 |
|
| 701 |
<p>As an example, the following expression transforms include paths in the |
| 702 |
form <code><b>foo/bar-odb.h</b></code> to paths in the form |
| 703 |
<code><b>foo/generated/bar-odb.h</b></code>:</p> |
| 704 |
|
| 705 |
<p><code><b>%foo/(.+)-odb.h%foo/generated/$1-odb.h%</b></code></p> |
| 706 |
|
| 707 |
<p>See also the REGEX AND SHELL QUOTING section below.</p></dd> |
| 708 |
|
| 709 |
<dt><code><b>--include-regex-trace</b></code></dt> |
| 710 |
<dd>Trace the process of applying regular expressions specified with the |
| 711 |
<code><b>--include-regex</b></code> option. Use this option to find out why |
| 712 |
your regular expressions don't do what you expected them to do.</dd> |
| 713 |
|
| 714 |
<dt><code><b>--guard-prefix</b></code> <i>prefix</i></dt> |
| 715 |
<dd>Add <i>prefix</i> to the generated header inclusion guards. The prefix is |
| 716 |
transformed to upper case and characters that are illegal in a preprocessor |
| 717 |
macro name are replaced with underscores.</dd> |
| 718 |
|
| 719 |
<dt><code><b>--show-sloc</b></code></dt> |
| 720 |
<dd>Print the number of generated physical source lines of code (SLOC).</dd> |
| 721 |
|
| 722 |
<dt><code><b>--sloc-limit</b></code> <i>num</i></dt> |
| 723 |
<dd>Check that the number of generated physical source lines of code (SLOC) does |
| 724 |
not exceed <i>num</i>.</dd> |
| 725 |
|
| 726 |
<dt><code><b>--options-file</b></code> <i>file</i></dt> |
| 727 |
<dd>Read additional options from <i>file</i> with each option appearing on a |
| 728 |
separate line optionally followed by space and an option value. Empty lines |
| 729 |
and lines starting with <code><b>#</b></code> are ignored. Option values can |
| 730 |
be enclosed in double (<code><b>"</b></code>) or single |
| 731 |
(<code><b>'</b></code>) quotes to preserve leading and trailing whitespaces |
| 732 |
as well as to specify empty values. If the value itself contains trailing or |
| 733 |
leading quotes, enclose it with an extra pair of quotes, for example |
| 734 |
<code><b>'"x"'</b></code>. Non-leading and non-trailing quotes are |
| 735 |
interpreted as being part of the option value. |
| 736 |
|
| 737 |
<p>The semantics of providing options in a file is equivalent to providing |
| 738 |
the same set of options in the same order on the command line at the point |
| 739 |
where the <code><b>--options-file</b></code> option is specified except that |
| 740 |
the shell escaping and quoting is not required. You can repeat this option |
| 741 |
to specify more than one options file.</p></dd> |
| 742 |
|
| 743 |
<dt><code><b>-x</b></code> <i>option</i></dt> |
| 744 |
<dd>Pass <i>option</i> to the underlying C++ compiler (<code><b>g++</b></code>). |
| 745 |
The <i>option</i> value that doesn't start with <code><b>-</b></code> is |
| 746 |
considered the <code><b>g++</b></code> executable name.</dd> |
| 747 |
|
| 748 |
<dt><code><b>-v</b></code></dt> |
| 749 |
<dd>Print the commands executed to run the stages of compilation.</dd> |
| 750 |
|
| 751 |
<dt><code><b>--trace</b></code></dt> |
| 752 |
<dd>Trace the compilation process.</dd> |
| 753 |
|
| 754 |
<dt><code><b>--mysql-engine</b></code> <i>engine</i></dt> |
| 755 |
<dd>Use <i>engine</i> instead of the default <code><b>InnoDB</b></code> in the |
| 756 |
generated database schema file. For more information on the storage engine |
| 757 |
options see the MySQL documentation. If you would like to use the |
| 758 |
database-default engine, pass <code><b>default</b></code> as the value for |
| 759 |
this option.</dd> |
| 760 |
|
| 761 |
<dt><code><b>--sqlite-override-null</b></code></dt> |
| 762 |
<dd>Make all columns in the generated database schema allow |
| 763 |
<code><b>NULL</b></code> values. This is primarily useful in schema |
| 764 |
migration since SQLite does not support dropping of columns. By making all |
| 765 |
columns <code><b>NULL</b></code> we can later "delete" them by setting their |
| 766 |
values to <code><b>NULL</b></code>. Note that this option overrides even the |
| 767 |
<code><b>not_null</b></code> pragma.</dd> |
| 768 |
|
| 769 |
<dt><code><b>--sqlite-lax-auto-id</b></code></dt> |
| 770 |
<dd>Do not force monotonically increasing automatically-assigned object ids. In |
| 771 |
this mode the generated database schema omits the |
| 772 |
<code><b>AUTOINCREMENT</b></code> keyword which results in faster object |
| 773 |
persistence but may lead to automatically-assigned ids not being in a |
| 774 |
strictly ascending order. Refer to the SQLite documentation for details.</dd> |
| 775 |
|
| 776 |
<dt><code><b>--pgsql-server-version</b></code> <i>ver</i></dt> |
| 777 |
<dd>Specify the minimum PostgreSQL server version with which the generated C++ |
| 778 |
code and schema will be used. This information is used to enable |
| 779 |
version-specific optimizations and workarounds in the generated C++ code and |
| 780 |
schema. The version must be in the |
| 781 |
<code><i>major</i><b>.</b><i>minor</i></code> form, for example, |
| 782 |
<code><b>9.1</b></code>. If this option is not specified, then |
| 783 |
<code><b>7.4</b></code> or later is assumed.</dd> |
| 784 |
|
| 785 |
<dt><code><b>--oracle-client-version</b></code> <i>ver</i></dt> |
| 786 |
<dd>Specify the minimum Oracle client library (OCI) version with which the |
| 787 |
generated C++ code will be linked. This information is used to enable |
| 788 |
version-specific optimizations and workarounds in the generated C++ code. |
| 789 |
The version must be in the <code><i>major</i><b>.</b><i>minor</i></code> |
| 790 |
form, for example, <code><b>11.2</b></code>. If this option is not |
| 791 |
specified, then <code><b>10.1</b></code> or later is assumed.</dd> |
| 792 |
|
| 793 |
<dt><code><b>--oracle-warn-truncation</b></code></dt> |
| 794 |
<dd>Warn about SQL names that are longer than 30 characters and are therefore |
| 795 |
truncated. Note that during database schema generation |
| 796 |
(<code><b>--generate-schema</b></code>) ODB detects when such truncations |
| 797 |
lead to name conflicts and issues diagnostics even without this option |
| 798 |
specified.</dd> |
| 799 |
|
| 800 |
<dt><code><b>--mssql-server-version</b></code> <i>ver</i></dt> |
| 801 |
<dd>Specify the minimum SQL Server server version with which the generated C++ |
| 802 |
code and schema will be used. This information is used to enable |
| 803 |
version-specific optimizations and workarounds in the generated C++ code and |
| 804 |
schema. The version must be in the |
| 805 |
<code><i>major</i><b>.</b><i>minor</i></code> form, for example, |
| 806 |
<code><b>9.0</b></code> (SQL Server 2005), <code><b>10.5</b></code> |
| 807 |
(2008R2), or <code><b>11.0</b></code> (2012). If this option is not |
| 808 |
specified, then <code><b>10.0</b></code> (SQL Server 2008) or later is |
| 809 |
assumed.</dd> |
| 810 |
|
| 811 |
<dt><code><b>--mssql-short-limit</b></code> <i>size</i></dt> |
| 812 |
<dd>Specify the short data size limit. If a character, national character, or |
| 813 |
binary data type has a maximum length (in bytes) less than or equal to this |
| 814 |
limit, then it is treated as <i>short data</i>, otherwise it is <i>long |
| 815 |
data</i>. For short data ODB pre-allocates an intermediate buffer of the |
| 816 |
maximum size and binds it directly to a parameter or result column. This way |
| 817 |
the underlying API (ODBC) can read/write directly from/to this buffer. In |
| 818 |
the case of long data, the data is read/written in chunks using the |
| 819 |
<code><b>SQLGetData()</b></code>/<code><b>SQLPutData()</b></code> ODBC |
| 820 |
functions. While the long data approach reduces the amount of memory used by |
| 821 |
the application, it may require greater CPU resources. The default short |
| 822 |
data limit is 1024 bytes. When setting a custom short data limit, make sure |
| 823 |
that it is sufficiently large so that no object id in the application is |
| 824 |
treated as long data.</dd> |
| 825 |
|
| 826 |
</dl> |
| 827 |
<h1>SQL NAME TRANSFORMATIONS</h1> |
| 828 |
|
| 829 |
<p>The ODB compiler provides a number of mechanisms for transforming |
| 830 |
automatically-derived SQL names, such as tables, columns, etc., |
| 831 |
to match a specific naming convention. At the higher level, we can |
| 832 |
add a prefix to global names (tables and, for some databases, |
| 833 |
indexes and/or foreign keys) with the <code><b>--table-prefix</b></code> |
| 834 |
option. Similarly, we can specify custom suffixes for |
| 835 |
automatically-derived |
| 836 |
index (<code><b>--index-suffix</b></code>; default is <code><b>_i</b></code>), |
| 837 |
foreign key (<code><b>--fkey-suffix</b></code>; default is <code><b>_fk</b></code>), and |
| 838 |
sequence (<code><b>--sequence-suffix</b></code>; default is <code><b>_seq</b></code>) |
| 839 |
names. Finally, we can also convert all the names to upper or lower |
| 840 |
case with the <code><b>--sql-name-case</b></code> option (valid values |
| 841 |
are <code><b>upper</b></code> and <code><b>lower</b></code>).</p> |
| 842 |
|
| 843 |
<p>At the lower level we can specify a set of regular expressions to |
| 844 |
implement arbitrary transformations of the automatically-derived SQL |
| 845 |
names. If we want a particular regular expression only to apply to |
| 846 |
a specific name, for example, table or column, then we use one of the |
| 847 |
<code><b>--</b><i>kind</i><b>-regex</b></code> options, where |
| 848 |
<code><i>kind</i></code> can be <code><b>table</b></code>, |
| 849 |
<code><b>column</b></code>, <code><b>index</b></code>, |
| 850 |
<code><b>fkey</b></code>, <code><b>sequence</b></code>, or |
| 851 |
<code><b>statement</b></code>. On the other hand, if we want our |
| 852 |
regular expressions to apply to all SQL names, then we use the |
| 853 |
<code><b>--sql-name-regex</b></code> option.</p> |
| 854 |
|
| 855 |
<p>The interaction between the higher and lower level transformations |
| 856 |
is as follows. Prefixes and suffixes are added first. Then the |
| 857 |
regular expression transformations are applied. Finally, if requested, |
| 858 |
the name is converted to upper or lower case. Note also that all of |
| 859 |
these transformations except for <code><b>--table-prefix</b></code> |
| 860 |
only apply to automatically-derived names. In other words, if a table, |
| 861 |
column, etc., name was explicitly specified with a pragma, then it |
| 862 |
is used as is, without applying any (except for the table prefix) |
| 863 |
transformations.</p> |
| 864 |
|
| 865 |
<p>The value for the <code><b>--*-regex</b></code> options is a Perl-like |
| 866 |
regular expression in the form |
| 867 |
<code><b>/</b><i>pattern</i><b>/</b><i>replacement</i><b>/</b></code>. |
| 868 |
Any character can be used as a delimiter instead of <code><b>/</b></code> |
| 869 |
and the delimiter can be escaped inside <code><i>pattern</i></code> and |
| 870 |
<code><i>replacement</i></code> with a backslash (<code><b>\</b></code>). |
| 871 |
You can also specify multiple regular expressions by repeating these |
| 872 |
options.</p> |
| 873 |
|
| 874 |
<p>All the regular expressions are tried in the order specified with the |
| 875 |
name-specific expressions (for example, <code><b>--table-regex</b></code>) |
| 876 |
tried first followed by the generic expressions |
| 877 |
(<code><b>--sql-name-regex</b></code>). The first expression that |
| 878 |
matches is used.</p> |
| 879 |
|
| 880 |
<p>As an example, consider a regular expression that transforms a class |
| 881 |
name in the form <code><b>CFoo</b></code> to a table name in the |
| 882 |
form <code><b>FOO</b></code>:</p> |
| 883 |
|
| 884 |
<p><code><b>--table-regex '/C(.+)/\U$1/'</b></code></p> |
| 885 |
|
| 886 |
<p>As a more interesting example, consider the transformation of class |
| 887 |
names that follow the upper camel case convention (for example, |
| 888 |
<code><b>FooBar</b></code>) to table names that follow the |
| 889 |
underscore-separated, all upper case convention (for example, |
| 890 |
<code><b>FOO_BAR</b></code>). For this case we have to use |
| 891 |
separate expressions to handle one-word, two-word, etc., |
| 892 |
names:</p> |
| 893 |
|
| 894 |
<p><code><b>--table-regex '/([A-z][a-z]+)/\U$1/'</b></code></p> |
| 895 |
<p><code><b>--table-regex '/([A-z][a-z]+)([A-z][a-z]+)/\U$1_$2/'</b></code></p> |
| 896 |
|
| 897 |
<p>See also the REGEX AND SHELL QUOTING section below.</p> |
| 898 |
|
| 899 |
<h1>REGEX AND SHELL QUOTING</h1> |
| 900 |
|
| 901 |
<p>When entering a regular expression argument in the shell |
| 902 |
command line it is often necessary to use quoting (enclosing |
| 903 |
the argument in <code><b>" "</b></code> or |
| 904 |
<code><b>' '</b></code>) in order to prevent the shell |
| 905 |
from interpreting certain characters, for example, spaces as |
| 906 |
argument separators and <code><b>$</b></code> as variable |
| 907 |
expansions.</p> |
| 908 |
|
| 909 |
<p>Unfortunately it is hard to achieve this in a manner that is |
| 910 |
portable across POSIX shells, such as those found on |
| 911 |
GNU/Linux and UNIX, and Windows shell. For example, if you |
| 912 |
use <code><b>" "</b></code> for quoting you will get a |
| 913 |
wrong result with POSIX shells if your expression contains |
| 914 |
<code><b>$</b></code>. The standard way of dealing with this |
| 915 |
on POSIX systems is to use <code><b>' '</b></code> instead. |
| 916 |
Unfortunately, Windows shell does not remove <code><b>' '</b></code> |
| 917 |
from arguments when they are passed to applications. As a result you |
| 918 |
may have to use <code><b>' '</b></code> for POSIX and |
| 919 |
<code><b>" "</b></code> for Windows (<code><b>$</b></code> is |
| 920 |
not treated as a special character on Windows).</p> |
| 921 |
|
| 922 |
<p>Alternatively, you can save regular expression options into |
| 923 |
a file, one option per line, and use this file with the |
| 924 |
<code><b>--options-file</b></code> option. With this approach |
| 925 |
you don't need to worry about shell quoting.</p> |
| 926 |
|
| 927 |
<h1>DIAGNOSTICS</h1> |
| 928 |
|
| 929 |
<p>If the input file is not valid C++, <code><b>odb</b></code> |
| 930 |
will issue diagnostic messages to STDERR and exit with non-zero exit |
| 931 |
code.</p> |
| 932 |
|
| 933 |
<h1>BUGS</h1> |
| 934 |
|
| 935 |
<p>Send bug reports to the |
| 936 |
<a href="mailto:[email protected]">[email protected]</a> mailing list.</p> |
| 937 |
|
| 938 |
</div> |
| 939 |
<div id="footer"> |
| 940 |
© 2009-2015 <a href="http://www.codesynthesis.com">Code Synthesis Tools CC</a> |
| 941 |
|
| 942 |
<div id="terms"> |
| 943 |
Permission is granted to copy, distribute and/or modify this |
| 944 |
document under the terms of the |
| 945 |
<a href="http://codesynthesis.com/licenses/fdl-1.3.txt">GNU Free |
| 946 |
Documentation License, version 1.3</a>; with no Invariant Sections, |
| 947 |
no Front-Cover Texts and no Back-Cover Texts. |
| 948 |
</div> |
| 949 |
</div> |
| 950 |
</div> |
| 951 |
</body> |
| 952 |
</html> |