From 30aa9daae73b889f3bc4e1a47a51794424cde281 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 15 Jan 2013 12:27:27 +0200 Subject: Add support for setting SQL Server transaction isolation level --- doc/manual.xhtml | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 4ffd6ab..f36ad9b 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -17929,15 +17929,28 @@ namespace odb protocol_np // Named pipes. }; + enum transaction_isolation + { + isolation_read_uncommitted, + isolation_read_committed, // SQL Server default. + isolation_repeatable_read, + isolation_snapshot, + isolation_serializable + }; + class database: public odb::database { public: + typedef protocol protocol_type; + typedef transaction_isolation transaction_isolation_type; + database (const std::string& user, const std::string& password, const std::string& db, const std::string& server, const std::string& driver = "", const std::string& extra_connect_string = "", + transaction_isolation_type = isolation_read_committed, SQLHENV environment = 0, std::[auto|unique]_ptr<connection_factory> = 0); @@ -17949,6 +17962,7 @@ namespace odb const std::string& instance = "", const std::string& driver = "", const std::string& extra_connect_string = "", + transaction_isolation_type = isolation_read_committed, SQLHENV environment = 0, std::[auto|unique]_ptr<connection_factory> = 0); @@ -17959,10 +17973,12 @@ namespace odb unsigned int port, const std::string& driver = "", const std::string& extra_connect_string = "", + transaction_isolation_type = isolation_read_committed, SQLHENV environment = 0, std::[auto|unique]_ptr<connection_factory> = 0); database (const std::string& connect_string, + transaction_isolation_type = isolation_read_committed, SQLHENV environment = 0, std::[auto|unique]_ptr<connection_factory> = 0); @@ -17970,6 +17986,7 @@ namespace odb char* argv[], bool erase = false, const std::string& extra_connect_string = "", + transaction_isolation_type = isolation_read_committed, SQLHENV environment = 0, std::[auto|unique]_ptr<connection_factory> = 0); @@ -18007,6 +18024,9 @@ namespace odb const std::string& extra_connect_string () const; + transaction_isolation_type + transaction_isolation () const; + const std::string& connect_string () const; @@ -18192,13 +18212,16 @@ odb::mssql::database dbA ("test",

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

-

Additionally, all the constructors have the environment - argument which allows us to provide a custom ODBC environment handle. - If this argument is not NULL, then the passed handle is - used in all the ODBC function calls made by this database - class instance. Note also that the database instance - does not assume ownership of the passed environment handle and this - handle should be valid for the lifetime of the database +

Additionally, all the constructors have the transaction_isolation + and environment arguments. The transaction_isolation + argument allows us to specify an alternative transaction isolation level + that should be used by all the connections created by this database instance. + The environment argument allows us to provide a custom ODBC + environment handle. If this argument is not NULL, then the + passed handle is used in all the ODBC function calls made by this + database instance. Note also that the database + instance does not assume ownership of the passed environment handle and + this handle should be valid for the lifetime of the database instance.

The last argument to all of the constructors is a pointer to the -- cgit v1.1