From 670ecc61d85bc800e75a41cfe7349de46f3acf59 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 7 Sep 2012 13:58:47 +0200 Subject: Add support for passing database name as std::wstring on Windows --- NEWS | 6 ++++-- doc/manual.xhtml | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 5dc913d..e33c5a0 100644 --- a/NEWS +++ b/NEWS @@ -53,8 +53,10 @@ Version 2.1.0 more information, refer to Section 20.1, "Basic Types" in the ODB manual as well as the 'qt' example in the odb-examples package. - * SQLite improvements: Ability to specify the virtual filesystem (vfs) module - in the database constructor (Section 14.2, "SQLite Database Class"). + * SQLite improvements: Ability to specify the virtual filesystem (vfs) + module in the database constructor (Section 14.2, "SQLite Database + Class"). Ability to pass database name as std::wstring on Windows + (Section 14.2, "SQLite Database Class"). * The id() pragma that was used to declare a persistent class without an object id has been renamed to no_id. diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 26d9d38..a9be249 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -13985,6 +13985,14 @@ namespace odb const std::string& vfs = "", std::[auto|unique]_ptr<connection_factory> = 0); +#ifdef _WIN32 + database (const std::wstring& name, + int flags = SQLITE_OPEN_READWRITE, + bool foreign_keys = true, + const std::string& vfs = "", + std::[auto|unique]_ptr<connection_factory> = 0); +#endif + database (int& argc, char* argv[], bool erase = false, @@ -14049,7 +14057,11 @@ auto_ptr<odb::database> db ( SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); -

The second constructor extracts the database parameters from the +

The second constructor is the same as the first except that the database + name is passes as std::wstring. This constructor is only + available when compiling for Windows.

+ +

The third constructor extracts the database parameters from the command line. The following options are recognized:

@@ -14081,13 +14093,13 @@ auto_ptr<odb::database> db (
      the first constructor. Flags from the command line always override
      the corresponding values specified with this argument.

-

The second constructor throws the odb::sqlite::cli_exception +

The third constructor throws the odb::sqlite::cli_exception exception if the SQLite option values are missing or invalid. See Section 14.4, "SQLite Exceptions" for more information on this exception.

The static print_usage() function prints the list of options - with short descriptions that are recognized by the second constructor.

+ with short descriptions that are recognized by the third constructor.

The last argument to all of the constructors is a pointer to the connection factory. In C++98, it is std::auto_ptr while -- cgit v1.1