📄 dbview.htm
字号:
{
*write_it = *ex_it;
cout << "Writing element #" << write_it.GetCount() + 1<< endl;
}
}
</code></pre>
<h3>Public Base Classes</h3>
<p>None.</p>
<h3>Template parameters</h3>
<table border="1">
<tr>
<th>Parameter </th>
<th>Description </th>
<th>Default </th>
</tr>
<tr>
<td valign="top"><tt>DataObj</tt> </td>
<td valign="top">The type of object that will be written
to the <font size="2" face="Courier New">DBView</font>.
This object will be bound through use of the <font
size="1" face="Courier New">BCA</font><font size="2"> </font>to
the appropriate columns in the database. The set of value
types of an <tt>DBView::insert_iterator</tt> consists of
a single type, <font size="2" face="Courier New">DataObj</font>.
</td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"><tt>ParamObj</tt> </td>
<td valign="top">The type of object that will be used to
specify the postfix parameters to the <font size="2"
face="Courier New">DBView</font>.</td>
<td valign="top"><font size="2" face="Courier New">DefaultParamObj<DataObj></font>
</td>
</tr>
</table>
<p> </p>
<h3>Notation</h3>
<table border="0">
<tr>
<td valign="top"><tt>X</tt> </td>
<td valign="top">A type that is a model of DBView </td>
</tr>
<tr>
<td valign="top"><tt>a</tt> </td>
<td valign="top">Object of type <tt>X</tt> </td>
</tr>
<tr>
<td valign="top"><tt>t</tt> </td>
<td valign="top">Object of type <tt>X::value_type</tt> </td>
</tr>
<tr>
<td valign="top"><tt>p</tt>, <tt>q</tt> </td>
<td valign="top">Object of type <tt>X::iterator</tt> </td>
</tr>
</table>
<p> </p>
<h3>Associated types</h3>
<p>In addition to the types defined in a semi-<a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
, the following types are defined.:</p>
<table border="1">
<tr>
<td valign="top">Iterator type </td>
<td valign="top">X::<a href="select_iterator.htm">select_iterator</a></td>
<td valign="top">An input iterator to read records from
the view</td>
</tr>
<tr>
<td valign="top">Iterator type </td>
<td valign="top">X::<a href="insert_iterator.htm">insert_iterator</a></td>
<td valign="top">An output iterator to insert records
into the view</td>
</tr>
<tr>
<td valign="top">Iterator type </td>
<td valign="top">X::<a href="update_iterator.htm">update_iterator</a></td>
<td valign="top">An output iterator to update records in
the view</td>
</tr>
<tr>
<td valign="top">Iterator type </td>
<td valign="top">X::<a href="delete_iterator.htm">delete_iterator</a></td>
<td valign="top">An ouput iterator to delete records from
the view</td>
</tr>
</table>
<p> </p>
<h3>Expression semantics</h3>
<table border="1">
<tr>
<th>Name </th>
<th>Expression </th>
<th>Precondition </th>
<th>Semantics </th>
<th>Postcondition </th>
</tr>
<tr>
<td valign="top">Default constructor </td>
<td valign="top"><pre>X a(const string &tableList,
const <a href="BCA.htm">BCA</a> &bca_functor = DefaultBCA<DataObj>(),
const string &postfix = "",
const <a href="BPA.htm">BPA</a> &bpa_functor = DefaultBPA<ParamObj>(),
const <a href="SelVal.htm">SelVal</a> sel_val = DefaultSelVal<DataObj>(),
const <a href="InsVal.htm">InsVal</a> ins_val = DefaultInsVal<DataObj>(),
<a href="DBConnection.htm">DBConnection</a> &connection = DBConnection::GetDefaultConnection())</pre>
</td>
<td valign="top"> </td>
<td valign="top">Creates an empty container bound to a
table, using the database connection specified in the
connection object. The actual queries run againt this
table are built by the select, insert, update and delete
iterators (see these iterators for details) but
essentially follow the following format:<p><font size="2"
face="Courier New">"SELECT " + <columns
listed in bca_fn()> + " FROM " + tableList +
postfix</font></p>
<p>In the SQL clause, users may also specify dynamic
parameters through the use of SQL <font size="2"
face="Courier New">'(?)'</font> syntax. In this case <a
href="BPA.htm"><font size="2" face="Courier New">BPA</font></a>
is a class that is used to hold these runtime parameters
and <font size="2" face="Courier New">bpa_functor </font>is a
functor used to associate fields in the parameters class
with parameter fields in the query.</p>
</td>
<td valign="top">The size of the container is <font
size="3" face="Times New Roman"><tt>0. </tt></font>
<font size="3" face="Times New Roman">Rows are operated
on by obtaining the appropriate iterator from the
container.</tt></font></td>
</tr>
</table>
<p> </p>
<h3>Members</h3>
<table border="1">
<tr>
<th>Member </th>
<th>Where defined </th>
<th>Description </th>
</tr>
<tr>
<td valign="top"><tt>value_type</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">The type of object, <tt>T</tt>, stored
in the <font size="2" face="Courier New">DBView</font>.
In this case<font size="2" face="Courier New"> T =
DataObj</font></td>
</tr>
<tr>
<td valign="top"><tt>pointer</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Pointer to <tt>T</tt>. </td>
</tr>
<tr>
<td valign="top"><tt>reference</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Reference to <tt>T</tt> </td>
</tr>
<tr>
<td valign="top"><tt>const_reference</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Const reference to <tt>T</tt> </td>
</tr>
<tr>
<td valign="top"><tt>size_type</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">An unsigned integral type. </td>
</tr>
<tr>
<td valign="top"><tt>difference_type</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">A signed integral type. </td>
</tr>
<tr>
<td valign="top"><tt>iterator</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Iterator used to iterate through a <font
size="2" face="Courier New">DBView</font>. The default
iterator for<font size="2" face="Courier New"> DBView</font>
is the <font size="2" face="Courier New">select_iterator</font>.</td>
</tr>
<tr>
<td valign="top"><tt>const_iterator</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Const iterator used to iterate through a
<font size="2" face="Courier New">DBView</font>. (<tt>iterator</tt>
and <tt>const_iterator</tt> are the same type.) </td>
</tr>
<tr>
<td valign="top"><tt>reverse_iterator</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
Container</a> </td>
<td valign="top">Iterator used to iterate backwards
through a <font size="2" face="Courier New">DBView</font>.
</td>
</tr>
<tr>
<td valign="top"><tt>const_reverse_iterator</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
Container</a> </td>
<td valign="top">Const iterator used to iterate backwards
through a <font size="2" face="Courier New">DBView</font>.
(<tt>Reverse_iterator</tt> and <tt>const_reverse_iterator</tt>
are the same type.) </td>
</tr>
<tr>
<td valign="top"><tt>iterator begin()</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Returns an <tt>iterator</tt> pointing to
the beginning of the DBView. </td>
</tr>
<tr>
<td valign="top"><tt>const_iterator begin() const</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Returns a <tt>const_iterator</tt> pointing to
the beginning of the DBView. </td>
</tr>
<tr>
<td valign="top"><tt>iterator end()</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Returns a <tt>const_iterator</tt> pointing to
the end of the DBView. </td>
</tr>
<tr>
<td valign="top"><tt>const_iterator end() const</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Returns a <tt>const_iterator</tt> pointing to
the end of the DBView. </td>
</tr>
<tr>
<td valign="top"><pre><tt>X a(const string &tableList,
const </tt><a href="BCA.htm"><tt>BCA</tt></a><tt> &bca_functor = DefaultBCA<DataObj>(),
const string &postfix = "",
const </tt><a href="BPA.htm"><tt>BPA</tt></a><tt> &bpa_functor = DefaultBPA<ParamObj>(),
const </tt><a href="SelVal.htm"><tt>SelVal</tt></a><tt> sel_val = DefaultSelVal<DataObj>(),
const </tt><a href="InsVal.htm"><tt>InsVal</tt></a><tt> ins_val = DefaultInsVal<DataObj>(),
</tt><a href="DBConnection.htm"><tt>DBConnection</tt></a><tt> &connection = DBConnection::GetDefaultConnection())</tt></pre>
</td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Creates an empty <font size="2"
face="Courier New">DBView</font>. </td>
</tr>
<tr>
<td valign="top"><tt>DBView(const DBView&)</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">The copy constructor. </td>
</tr>
<tr>
<td valign="top"><tt>DBView& operator=(const
DBView&)</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">The assignment operator </td>
</tr>
<tr>
<td valign="top"><font size="2" face="Courier New">void
set_io_handler(IOHandler<DataObj, ParamObj>)</font></td>
<td valign="top"><font size="2" face="Courier New">DBView</font></td>
<td valign="top">Sets the <font size="2"
face="Courier New">IOHandler</font> for this view. Iterators created from this view
will then use this handler by default until set by the iterator's version of this
method. The <font size="2" face="Courier New">IOHandler </font>will
try to handle exceptions thrown by such iterators and tell
the code which caught the exception whether to suppress
the error or still throw.</td>
</tr>
<tr>
<td valign="top"><font size="2" face="Courier New">template<class
UserHandler> const UserHandler & get_io_handler(UserHandler
*dummy) const</font></td>
<td valign="top"><font size="2" face="Courier New">DBView</font></td>
<td valign="top">Returns the current<font size="2"
face="Courier New"> IOHandler</font> for this object cast
to the actual type of the handler based on the dummy
pointer passed in. If the dynamic cast of the <font
size="2" face="Courier New">IOHandler</font> object
fails, an exception will be thrown.</td>
</tr>
<tr>
<td valign="top"><font size="2" face="Courier New">IOHandler<DataObj,
ParamObj> &get_io_handler() const</font></td>
<td valign="top"><font size="2" face="Courier New">DBView</font></td>
<td valign="top">Returns the current<font size="2"
face="Courier New"> IOHandler</font> for this object as a
raw <font size="2" face="Courier New">IOHandler</font>
object. You must cast to the actual type of the handler
to be able to access any of your handler's public members.</td>
</tr>
<tr>
<td valign="top"><tt>void swap(DBView&)</tt> </td>
<td valign="top"><a
href="http://www.sgi.com/tech/stl/Container.html">Container</a>
</td>
<td valign="top">Swaps the contents of two <font size="2"
face="Courier New">DBView's</font>. </td>
</tr>
</table>
<h3>See also</h3>
<p><a
href="http://www.sgi.com/tech/stl/MultipleAssociativeContainer.html">Multiple
Associative Container</a>, <a href="BCA.htm"><font size="2"
face="Courier New">BCA</font></a><font size="2"
face="Courier New">, </font><a href="BPA.htm"><font size="2"
face="Courier New">BPA</font></a><font size="2"
face="Courier New">, </font><a href="InsVal.htm"><font size="2"
face="Courier New">InsVal</font></a><font size="2"
face="Courier New">, </font><a href="SelVal.htm"><font size="2"
face="Courier New">SelVal</font></a><font size="2"
face="Courier New">, </font><a href="db_iterator.htm"><font
size="2" face="Courier New">DB_iterator</font></a><a
href="db_iterator.htm"><font size="2"><!--start footer--></font></a> </p>
<hr>
<p><a href="index.htm"><img src="dtl_home.gif" alt="[DTL Home]"
width="54" height="54"></a> <br>
</p>
<p>Copyright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -