[odb-announcements] ODB 2.5.0 released
Boris Kolpackov
boris at codesynthesis.com
Tue Jan 14 01:26:10 EST 2025
We have released ODB version 2.5.0.
The complete list of the NEWS file entries for this release is included
below. A big thank you to everyone who helped test (or used) the pre-
release snapshots. It took a long time to get this release out and we
appreciate your patience. Note also that this is the last release to
support C++98/03 (bugfix releases notwithstanding).
Source code and binary distribution packages for this release are
available from:
http://www.codesynthesis.com/products/odb/download.xhtml
Note that due to the large gap between this and the previous release
(2.4.0) there is some discontinuity in the supported binary packages.
As a result, the download page for version 2.4.0 is preserved to
provide a transition period:
https://codesynthesis.com/products/odb/download-2.4.xhtml
For the list of supported platforms and compilers see:
https://codesynthesis.com/products/odb/platforms.xhtml
Note that prior to this release, ODB was spread over multiple Git
repositories, one per component (odb, libodb, etc). From this release
and going forward, all these components are now part of a single Git
repository:
https://git.codesynthesis.com/cgit/odb/odb/tree/
There is also a GitHub mirror of this repository:
https://github.com/codesynthesis-com/odb
And you are welcome to file bugs there in addition to reporting them
on the mailing list:
https://github.com/codesynthesis-com/odb/issues
NEWS file entries for ODB version 2.5.0:
* Database classes are now move-constructible. This means they can be
returned by value from functions in C++11 and later.
* Support for mapping C++ types as other C++ types. For example:
#pragma db map type(bool) \
as(std::string) \
to((?) ? "true" : "false") \
from((?) == "true")
See Section 14.8.1, "C++ Type Mapping Pragmas" in the ODB manual for
details.
* Support for custom table definition options in addition to column
definition options. For details, refer to Section 14.1.16, "options" in
the ODB manual.
* New helper header, <odb/nested-container.hxx>, provides manual nested
container support. For details, see the container-nested example in
odb-examples.
* New helper header, <odb/c-array-traits.hxx>, provides optional
mapping of C arrays as containers. Note that this mapping is not
enabled by default. See instructions inside the header for details.
* Support for nested object ids. Now the `id` pragma specifier can optionally
include the data member path to the id inside a composite value. For
example:
#pragma db id(first)
std::pair<int, int> p;
Note that one somewhat counter-intuitive aspect of this new feature is
that the whole member marked with id (`p` in the above example) and not
just the actual id member (p.first in the above example) is treated as
read-only.
Such nested id also cannot be automatically assigned (that is, use the
`auto` specifier).
To match this support the `inverse` pragma specifier now also allows
nested data members.
* Support for defining views as instantiations of C++ class templates,
similar to objects and composite value types.
* Support for using object pointers as map keys. Also the restriction for map
keys and set values to be NOT NULL was removed.
* New `points_to` pragma allows the establishment of relationships without
using object pointers. See Section 14.4.37, "points_to" in the ODB manual
for details.
* A statement in a view that is prefixed with the /*SELECT*/ comment is
recognized and handled as a SELECT statement. This can be used to work
around unrecognized SELECT query prefixes.
* Support for ordering virtual data members. For details, see Section
14.4.13, "virtual" in the ODB manual.
* The special (!) placeholder denotes the database instance in the modifier
expressions. For details, see Section 14.4.5, "get/set/access" in the
ODB manual.
* Support for bulk operations in PostgreSQL 14 using the new pipeline mode.
For details on bulk operations see Section 15.3, "Bulk Database Operations"
in the ODB manual. Note that while this functionality requires libpq
version 14 or later, it should be usable with PostgreSQL servers version
7.4 or later. The development of this support was sponsored by Qube
Research & Technologies Limited.
* Support for calling PostgreSQL stored procedures and functions. For
details and limitations refer to Section 19.7, "PostgreSQL Stored
Procedures and Functions" in the ODB manual.
* New serial_connection_factory in the SQLite runtime.
This factory can be used when the database access is guaranteed to be
serial. See Section 18.3, "SQLite Connection and Connection Factory"
in the ODB manual for details.
* Support for attaching additional SQLite databases to the main database
connections (ATTACH DATABASE statement). See Section 18.4, "Attached
SQLite Databases" in the ODB manual for details.
* Support for SQLite incremental BLOB/TEXT I/O (the sqlite3_blob_open()
functionality). For details, refer to Section 18.1.3, "Incremental
BLOB/TEXT I/O" in the ODB manual.
* Support for mixed auto/manual id assignment in SQLite.
Now one can do:
#pragma db id auto
odb::nullable<int64_t> id;
And then set the id to NULL to get auto-assignment or to the actual value
to use a manual id.
* Support for mixed auto/0 id assignment in MySQL.
Now one can do:
#pragma db id auto
odb::nullable<int64_t> id;
And then, when used with NO_AUTO_VALUE_ON_ZERO, set the id to NULL to get
auto-assignment or to 0 to use 0 as the id.
* Map string object ids to MySQL VARCHAR(128) instead of 255 to support
4-byte UTF-8.
This is a backwards-incompatible change in that it may change your schema.
To obtain the old behavior you will have to explicitly re-map std::string
with the id_type pragma or explicitly specify the database type for each
affected id member with the type pragma.
* Due to warnings issued by some compiler, std::auto_ptr is no longer mapped
as an object pointer or wrapper in the C++11 and later modes. Use
std::unique_ptr instead.
More information about the odb-announcements
mailing list