00001 /*------------------------------------------------------------------------- 00002 * 00003 * FILE 00004 * pqxx/isolation.hxx 00005 * 00006 * DESCRIPTION 00007 * definitions of transaction isolation levels 00008 * Policies and traits describing SQL transaction isolation levels 00009 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/isolation instead. 00010 * 00011 * Copyright (c) 2003-2013, Jeroen T. Vermeulen <jtv@xs4all.nl> 00012 * 00013 * See COPYING for copyright license. If you did not receive a file called 00014 * COPYING with this source code, please notify the distributor of this mistake, 00015 * or contact the author. 00016 * 00017 *------------------------------------------------------------------------- 00018 */ 00019 #ifndef PQXX_H_ISOLATION 00020 #define PQXX_H_ISOLATION 00021 00022 #include "pqxx/compiler-public.hxx" 00023 #include "pqxx/compiler-internal-pre.hxx" 00024 00025 #include "pqxx/util" 00026 00027 namespace pqxx 00028 { 00029 00031 00060 enum isolation_level 00061 { 00062 // read_uncommitted, 00063 read_committed, 00064 repeatable_read, 00065 serializable 00066 }; 00067 00069 template<isolation_level LEVEL> struct isolation_traits 00070 { 00071 static isolation_level level() PQXX_NOEXCEPT { return LEVEL; } 00072 static const char *name() PQXX_NOEXCEPT; 00073 }; 00074 00075 00076 template<> inline const char *isolation_traits<read_committed>::name() 00077 PQXX_NOEXCEPT { return "READ COMMITTED"; } 00078 00079 template<> inline const char *isolation_traits<repeatable_read>::name() 00080 PQXX_NOEXCEPT { return "REPEATABLE READ"; } 00081 00082 template<> inline const char *isolation_traits<serializable>::name() 00083 PQXX_NOEXCEPT { return "SERIALIZABLE"; } 00084 00085 } 00086 00087 00088 #include "pqxx/compiler-internal-post.hxx" 00089 00090 #endif 00091