1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MySQL++ Reference Manual</title>
<meta http-equiv="Content-type" content="text/html;charset=iso-8859-1">
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="refman.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul></div>
<div class="nav">
<b>mysqlpp</b>::<a class="el" href="classmysqlpp_1_1Transaction.html">Transaction</a></div>
<h1>mysqlpp::Transaction Class Reference</h1><!-- doxytag: class="mysqlpp::Transaction" -->Helper object for creating exception-safe SQL transactions.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="transaction_8h-source.html">transaction.h</a>></code>
<p>
Collaboration diagram for mysqlpp::Transaction:<p><center><img src="classmysqlpp_1_1Transaction__coll__graph.png" border="0" usemap="#mysqlpp_1_1Transaction__coll__map" alt="Collaboration graph"></center>
<map name="mysqlpp_1_1Transaction__coll__map">
<area href="classmysqlpp_1_1Connection.html" shape="rect" coords="187,187,347,213" alt="">
<area href="classmysqlpp_1_1OptionalExceptions.html" shape="rect" coords="5,96,219,123" alt="">
<area href="classmysqlpp_1_1DBDriver.html" shape="rect" coords="395,96,541,123" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classmysqlpp_1_1Transaction-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f3932f25965a310d79e396f8f749f3d17">read_uncommitted</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">allow "dirty reads" from other transactions <a href="#91d16b4539a969fb632ee672999cdd1f3932f25965a310d79e396f8f749f3d17"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f82065aaf4094dab18b48d8e973d4ef4f">read_committed</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">only read rows committed by other transactions <a href="#91d16b4539a969fb632ee672999cdd1f82065aaf4094dab18b48d8e973d4ef4f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f6a5934315b282de9c0f4037297c6f93a">repeatable_read</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">other transactions do not affect repeated reads in this transaction <a href="#91d16b4539a969fb632ee672999cdd1f6a5934315b282de9c0f4037297c6f93a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f6479eabcb53fb2d5b2ade3b254f0fd61">serializable</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">this transaction prevents writes to any rows it accesses while it runs <a href="#91d16b4539a969fb632ee672999cdd1f6479eabcb53fb2d5b2ade3b254f0fd61"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612cf73085a07470c23fcdf8c9792cf4839d">this_transaction</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">change level for this transaction only <a href="#933f0528d41cea97732d9e70e232612cf73085a07470c23fcdf8c9792cf4839d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612caa607cae58b78192121c1e1e96111298">session</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">change level for all transactions in this session <a href="#933f0528d41cea97732d9e70e232612caa607cae58b78192121c1e1e96111298"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c707b5ddb102ba887030eb7f15acfe80e">global</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">change level for all transactions on the DB server <a href="#933f0528d41cea97732d9e70e232612c707b5ddb102ba887030eb7f15acfe80e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f">IsolationLevel</a> { <a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f3932f25965a310d79e396f8f749f3d17">read_uncommitted</a>,
<a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f82065aaf4094dab18b48d8e973d4ef4f">read_committed</a>,
<a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f6a5934315b282de9c0f4037297c6f93a">repeatable_read</a>,
<a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f6479eabcb53fb2d5b2ade3b254f0fd61">serializable</a>
}</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="classmysqlpp_1_1Transaction.html">Transaction</a> isolation levels defined in SQL. <a href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c">IsolationScope</a> { <a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612cf73085a07470c23fcdf8c9792cf4839d">this_transaction</a>,
<a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612caa607cae58b78192121c1e1e96111298">session</a>,
<a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c707b5ddb102ba887030eb7f15acfe80e">global</a>
}</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Isolation level scopes defined in SQL. <a href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#5472100c371746d23311bbd74067c5dc">Transaction</a> (<a class="el" href="classmysqlpp_1_1Connection.html">Connection</a> &conn, bool consistent=false)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Simple constructor. <a href="#5472100c371746d23311bbd74067c5dc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#a83ef7b66a4c62fbc012f7ce71e6b2a5">Transaction</a> (<a class="el" href="classmysqlpp_1_1Connection.html">Connection</a> &conn, <a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f">IsolationLevel</a> level, <a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c">IsolationScope</a> scope=this_transaction, bool consistent=false)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor allowing custom transaction isolation level and scope. <a href="#a83ef7b66a4c62fbc012f7ce71e6b2a5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#362b0d2524d0c799165190517192dca9">~Transaction</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#362b0d2524d0c799165190517192dca9"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#109bd0f1d70b6ff69cf3abccf7eea8f8">commit</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Commits the transaction. <a href="#109bd0f1d70b6ff69cf3abccf7eea8f8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classmysqlpp_1_1Transaction.html#000e4f0882139eb8470f7472ca14a24e">rollback</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Rolls back the transaction. <a href="#000e4f0882139eb8470f7472ca14a24e"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Helper object for creating exception-safe SQL transactions.
<p>
<hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="91d16b4539a969fb632ee672999cdd1f"></a><!-- doxytag: member="mysqlpp::Transaction::IsolationLevel" ref="91d16b4539a969fb632ee672999cdd1f" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f">mysqlpp::Transaction::IsolationLevel</a> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<a class="el" href="classmysqlpp_1_1Transaction.html">Transaction</a> isolation levels defined in SQL.
<p>
These values can be passed to one of the <a class="el" href="classmysqlpp_1_1Transaction.html">Transaction</a> constructors to change the way the database engine protects transactions from other DB updates. These values are in order of increasing isolation, but decreasing performance. <dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="91d16b4539a969fb632ee672999cdd1f3932f25965a310d79e396f8f749f3d17"></a><!-- doxytag: member="read_uncommitted" ref="91d16b4539a969fb632ee672999cdd1f3932f25965a310d79e396f8f749f3d17" args="" -->read_uncommitted</em> </td><td>
allow "dirty reads" from other transactions </td></tr>
<tr><td valign="top"><em><a class="anchor" name="91d16b4539a969fb632ee672999cdd1f82065aaf4094dab18b48d8e973d4ef4f"></a><!-- doxytag: member="read_committed" ref="91d16b4539a969fb632ee672999cdd1f82065aaf4094dab18b48d8e973d4ef4f" args="" -->read_committed</em> </td><td>
only read rows committed by other transactions </td></tr>
<tr><td valign="top"><em><a class="anchor" name="91d16b4539a969fb632ee672999cdd1f6a5934315b282de9c0f4037297c6f93a"></a><!-- doxytag: member="repeatable_read" ref="91d16b4539a969fb632ee672999cdd1f6a5934315b282de9c0f4037297c6f93a" args="" -->repeatable_read</em> </td><td>
other transactions do not affect repeated reads in this transaction </td></tr>
<tr><td valign="top"><em><a class="anchor" name="91d16b4539a969fb632ee672999cdd1f6479eabcb53fb2d5b2ade3b254f0fd61"></a><!-- doxytag: member="serializable" ref="91d16b4539a969fb632ee672999cdd1f6479eabcb53fb2d5b2ade3b254f0fd61" args="" -->serializable</em> </td><td>
this transaction prevents writes to any rows it accesses while it runs </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="933f0528d41cea97732d9e70e232612c"></a><!-- doxytag: member="mysqlpp::Transaction::IsolationScope" ref="933f0528d41cea97732d9e70e232612c" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c">mysqlpp::Transaction::IsolationScope</a> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Isolation level scopes defined in SQL.
<p>
These values are only used with one of the <a class="el" href="classmysqlpp_1_1Transaction.html">Transaction</a> constructors, to select which transaction(s) our change to <dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="933f0528d41cea97732d9e70e232612cf73085a07470c23fcdf8c9792cf4839d"></a><!-- doxytag: member="this_transaction" ref="933f0528d41cea97732d9e70e232612cf73085a07470c23fcdf8c9792cf4839d" args="" -->this_transaction</em> </td><td>
change level for this transaction only </td></tr>
<tr><td valign="top"><em><a class="anchor" name="933f0528d41cea97732d9e70e232612caa607cae58b78192121c1e1e96111298"></a><!-- doxytag: member="session" ref="933f0528d41cea97732d9e70e232612caa607cae58b78192121c1e1e96111298" args="" -->session</em> </td><td>
change level for all transactions in this session </td></tr>
<tr><td valign="top"><em><a class="anchor" name="933f0528d41cea97732d9e70e232612c707b5ddb102ba887030eb7f15acfe80e"></a><!-- doxytag: member="global" ref="933f0528d41cea97732d9e70e232612c707b5ddb102ba887030eb7f15acfe80e" args="" -->global</em> </td><td>
change level for all transactions on the DB server </td></tr>
</table>
</dl>
</div>
</div><p>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="5472100c371746d23311bbd74067c5dc"></a><!-- doxytag: member="mysqlpp::Transaction::Transaction" ref="5472100c371746d23311bbd74067c5dc" args="(Connection &conn, bool consistent=false)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Transaction::Transaction </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmysqlpp_1_1Connection.html">Connection</a> & </td>
<td class="paramname"> <em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>consistent</em> = <code>false</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Simple constructor.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>The connection we use to manage the transaction set </td></tr>
<tr><td valign="top"></td><td valign="top"><em>consistent</em> </td><td>Whether to use "consistent snapshots" during the transaction. See the documentation for "START TRANSACTION" in the MySQL manual for more on this. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="a83ef7b66a4c62fbc012f7ce71e6b2a5"></a><!-- doxytag: member="mysqlpp::Transaction::Transaction" ref="a83ef7b66a4c62fbc012f7ce71e6b2a5" args="(Connection &conn, IsolationLevel level, IsolationScope scope=this_transaction, bool consistent=false)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Transaction::Transaction </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classmysqlpp_1_1Connection.html">Connection</a> & </td>
<td class="paramname"> <em>conn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classmysqlpp_1_1Transaction.html#91d16b4539a969fb632ee672999cdd1f">IsolationLevel</a> </td>
<td class="paramname"> <em>level</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classmysqlpp_1_1Transaction.html#933f0528d41cea97732d9e70e232612c">IsolationScope</a> </td>
<td class="paramname"> <em>scope</em> = <code>this_transaction</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>consistent</em> = <code>false</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Constructor allowing custom transaction isolation level and scope.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>conn</em> </td><td>The connection we use to manage the transaction set </td></tr>
<tr><td valign="top"></td><td valign="top"><em>level</em> </td><td>Isolation level to use for this transaction </td></tr>
<tr><td valign="top"></td><td valign="top"><em>scope</em> </td><td>Selects the scope of the isolation level change </td></tr>
<tr><td valign="top"></td><td valign="top"><em>consistent</em> </td><td>Whether to use "consistent snapshots" during the transaction. See the documentation for "START TRANSACTION" in the MySQL manual for more on this. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="362b0d2524d0c799165190517192dca9"></a><!-- doxytag: member="mysqlpp::Transaction::~Transaction" ref="362b0d2524d0c799165190517192dca9" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Transaction::~Transaction </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Destructor.
<p>
If the transaction has not been committed or rolled back by the time the destructor is called, it is rolled back. This is the right thing because one way this can happen is if the object is being destroyed as the stack is unwound to handle an exception. In that instance, you certainly want to roll back the transaction.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="109bd0f1d70b6ff69cf3abccf7eea8f8"></a><!-- doxytag: member="mysqlpp::Transaction::commit" ref="109bd0f1d70b6ff69cf3abccf7eea8f8" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Transaction::commit </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Commits the transaction.
<p>
This commits all updates to the database using the connection we were created with since this object was created. This is a no-op if the table isn't stored using a transaction-aware storage engine. See CREATE TABLE in the MySQL manual for details.
</div>
</div><p>
<a class="anchor" name="000e4f0882139eb8470f7472ca14a24e"></a><!-- doxytag: member="mysqlpp::Transaction::rollback" ref="000e4f0882139eb8470f7472ca14a24e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Transaction::rollback </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Rolls back the transaction.
<p>
This abandons all SQL statements made on the connection since this object was created. This only works on tables stored using a transaction-aware storage engine. See CREATE TABLE in the MySQL manual for details.
</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="transaction_8h-source.html">transaction.h</a><li>transaction.cpp</ul>
<hr size="1"><address style="align: right;"><small>Generated on 10 Dec 2013 for MySQL++ by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>
|