A C++ DAL / ORM code generation framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1170 lines
82 KiB

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>WORM: WSql::WSqlDatabase Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
}
function toggleVisibility(linkObj) {
var base = linkObj.getAttribute('id');
var summary = document.getElementById(base + '-summary');
var content = document.getElementById(base + '-content');
var trigger = document.getElementById(base + '-trigger');
if ( hasClass(linkObj,'closed') ) {
summary.style.display = 'none';
content.style.display = 'block';
trigger.src = 'open.png';
removeClass(linkObj,'closed');
addClass(linkObj,'opened');
} else if ( hasClass(linkObj,'opened') ) {
summary.style.display = 'block';
content.style.display = 'none';
trigger.src = 'closed.png';
removeClass(linkObj,'opened');
addClass(linkObj,'closed');
}
return false;
}
</script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="worm_sm.png"></td>
<td style="padding-left: 0.5em;">
<div id="projectname">WORM&#160;<span id="projectnumber">0.2</span></div>
<div id="projectbrief">A C++ DAL/ORM code generation framework</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_w_sql.html">WSql</a> </li>
<li class="navelem"><a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<h1>WSql::WSqlDatabase Class Reference</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="WSql::WSqlDatabase" -->
<p>The <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> class represents a single database.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>&gt;</code></p>
<p><a href="class_w_sql_1_1_w_sql_database-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a6ef4f3c3d9c28a9f6aa171261c79b66e">WSqlDatabase</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates an empty, invalid <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> object. <a href="#a6ef4f3c3d9c28a9f6aa171261c79b66e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a093d3810c76b1be2d155c3fd03c0a549">WSqlDatabase</a> (const <a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> &amp;type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> object with a driver. <a href="#a093d3810c76b1be2d155c3fd03c0a549"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#af69197a0eba8ef5f623971ab69c04b14">WSqlDatabase</a> (const <a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;other)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a copy of <em>other</em>. <a href="#af69197a0eba8ef5f623971ab69c04b14"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7adeec6b1bf4b1f55fd63cc4a8fe5316">~WSqlDatabase</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys the object and frees any allocated resources. <a href="#a7adeec6b1bf4b1f55fd63cc4a8fe5316"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#aff088c6a45f151d872386a930a1ff7a3">operator=</a> (const <a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;other)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copies the values of <em>other</em> to this object. <a href="#aff088c6a45f151d872386a930a1ff7a3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba">open</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a connection. <a href="#ac40fb73f4b8c5fd26f7cfb959679f1ba"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a8108c44524ad9722c84548f3b7b73d6f">open</a> (const std::string &amp;username, const std::string &amp;password)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a connection using <em>username</em> and <em>password</em>. <a href="#a8108c44524ad9722c84548f3b7b73d6f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7c8b8c430fcfaa7d9ef5145c74f7dd48">isOpen</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a1c943c000ea384846c7d4d77c3513afb">hasError</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_error.html">WSqlError</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::string &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#aa71bf380cd429a1da326a341e1f8195c">errors</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a4a4d53b3ff1c197b16495087496f8660">isValid</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a83d2116612628889d41c13a9bb67ce0c">databaseName</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a8523467f1ed4ba30b800d6cf6224a9b1">userName</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a330a670990fc65f07e48366f05093200">password</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#aaded889a5674813f10c4eff81c90d65d">hostName</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9d22fff18962918f7301df4c85548ec6">port</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the connection's port number. <a href="#a9d22fff18962918f7301df4c85548ec6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a09f2c6b29cf7eac1b65ee9615aaf9e1c">connectionOptions</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#ada6addb3c7875e03a34871f2baf3595f">driverType</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9511cd5c63a4375e815ad9dafb5ae7e4">setDatabaseName</a> (const std::string &amp;name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the the database name. <a href="#a9511cd5c63a4375e815ad9dafb5ae7e4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a764e33f918dced0411724a3f4781343a">setUserName</a> (const std::string &amp;name)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the the user name. <a href="#a764e33f918dced0411724a3f4781343a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a098810c8f81bd4a8f1ea61dc0a3f25ad">setPassword</a> (const std::string &amp;password)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the the password. <a href="#a098810c8f81bd4a8f1ea61dc0a3f25ad"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#ac59ad9647f4c37e1fd11723d8f0d2933">setHostName</a> (const std::string &amp;host)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the connection's host name. <a href="#ac59ad9647f4c37e1fd11723d8f0d2933"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7b4a7177c16a84bbfd7ae0ca5da0c72c">setPort</a> (int p)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the port number for the connection. <a href="#a7b4a7177c16a84bbfd7ae0ca5da0c72c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a41407aba46af14d6e5d513fbcaac9516">setConnectOptions</a> (const std::string &amp;options=std::string())</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the connection options for this database server. <a href="#a41407aba46af14d6e5d513fbcaac9516"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a30f7bdbae04478250a4b7cef66edfc16">setDriverType</a> (<a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> t)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7770c27b068eb51aa856c0ae37d726de">addError</a> (const <a class="el" href="class_w_sql_1_1_w_sql_error.html">WSqlError</a> &amp;e)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#af7475caa3bfbf3115c1ddf612e6bc402">setDriver</a> (<a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a> *d)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a1fc5a8e3e677b74c98c0e9d0cd39b6dc">driver</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a pointer to the database driver - expert only. <a href="#a1fc5a8e3e677b74c98c0e9d0cd39b6dc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a64ec6d10ab64f9408a82e464eefdb275">handle</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const std::vector&lt; std::string &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a86df7db5900c3a2d1483375195c7b025">tableNames</a> (<a class="el" href="namespace_w_sql.html#a2860958b4a0664bf26cd4959a7aaace8">WSql::TableType</a> type=WSql::Tables)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a vector of the database's table names. <a href="#a86df7db5900c3a2d1483375195c7b025"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_table.html">WSqlTable</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a2f068c8103068f0b4cab897b824144b9">tableMetaData</a> (const std::string &amp;tableName) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch metadata for table <em>tableName</em>. <a href="#a2f068c8103068f0b4cab897b824144b9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9bd1765f14443afbb875981321d4c529">initMetaData</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the metadata for all tables in the database. <a href="#a9bd1765f14443afbb875981321d4c529"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c">query</a> (const std::string &amp;sql)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes the query in <em>sql</em> returning true on sucess. <a href="#a9a368d8a1e0ab21a2ab4b5082acc6a1c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_w_sql_1_1_w_sql_result.html">WSqlResult</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7">result</a> (bool iscached=true)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the result set from the most recent query. <a href="#a7f485f7a20f577f5f398c7b5fec07ab7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_w_sql_database.html#a1f865041c95b0962b614c219a918808e">initDriver</a> ()</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> class represents a single database. </p>
<p>The <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> class provides an interface for accessing a specific database through a connection. An instance of <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> represents the information relevant to connecting to the database, including the name of the database, the host, the username, etc.</p>
<p><a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> should be instantiated with a driver type (or another valid database object) - when constructed it will try to obtain the requested driver from <a class="el" href="class_w_sql_1_1_w_sql_driver_factory.html">WSqlDriverFactory</a>(todo - currently just creates one ..). If this fails <a class="el" href="class_w_sql_1_1_w_sql_database.html#a4a4d53b3ff1c197b16495087496f8660">isValid()</a> will return false.</p>
<p>Drivers are derived from <a class="el" href="class_w_sql_1_1_w_sql_driver.html" title="The WSqlDriver class is an abstract base class for database drivers.">WSqlDriver</a>, see <a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> for supported database drivers.</p>
<p>Example: </p>
<div class="fragment"><pre class="fragment"><a class="code" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSql::WSqlDatabase</a> db( <a class="code" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3caee837ff3fecf3701ba3c275c3bc38190">WSql::WMYSQL</a> );
db.setDatabaseName( std::string( <span class="stringliteral">&quot;sakila&quot;</span> ) );
db.setUserName( <span class="stringliteral">&quot;root&quot;</span> );
<span class="keywordflow">if</span> ( !db.open() ) {
std::cerr &lt;&lt; <span class="stringliteral">&quot;Failed to open: &quot;</span> &lt;&lt; db.error().text() &lt;&lt; std::endl;
<span class="keywordflow">return</span> 1;
}
std::string sql = <span class="stringliteral">&quot;select * from &quot;</span> + sometable + <span class="stringliteral">&quot; limit 2;&quot;</span>;
<span class="keywordflow">if</span>(!db.query(sql))
std::cout &lt;&lt; <span class="stringliteral">&quot;Query Failed: &quot;</span> &lt;&lt; db.error().text() &lt;&lt; std::endl;
}<span class="keywordflow">else</span>{
<a class="code" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSql::WSqlResult</a> *result = db.getResult();
std::cout &lt;&lt; <span class="stringliteral">&quot;Number of rows: &quot;</span> &lt;&lt; result-&gt;<a class="code" href="class_w_sql_1_1_w_sql_result.html#a2f34ccad684262a1860022a2d07cc024">size</a>() &lt;&lt; std::endl;
<a class="code" href="class_w_sql_1_1_w_sql_record.html" title="The WSqlRecord class represents a database record.">WSql::WSqlRecord</a> record = result-&gt;<a class="code" href="class_w_sql_1_1_w_sql_result.html#a85cc6e2cb40f959c2ff2f725356ef5c6">fetchFirst</a>();
<span class="keywordflow">while</span>(!record.<a class="code" href="class_w_sql_1_1_w_sql_record.html#a2953bb26d9c259a284353aba9cbd33da">empty</a>())
{
<span class="keywordtype">int</span> numcols = record.<a class="code" href="class_w_sql_1_1_w_sql_record.html#aa807dec1b294186d17a550498b5aaf7f">count</a>(); <span class="comment">// or record.size();</span>
std::cout &lt;&lt; <span class="stringliteral">&quot;Number of columns: &quot;</span> &lt;&lt; record.<a class="code" href="class_w_sql_1_1_w_sql_record.html#ab8901f9dda027740e651084084d9e617">size</a>() &lt;&lt; std::endl;
<a class="code" href="class_w_sql_1_1_w_sql_field.html" title="The WSqlField class represents a field in a record.">WSql::WSqlField</a> fld;
<span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0;i &lt; record.<a class="code" href="class_w_sql_1_1_w_sql_record.html#ab8901f9dda027740e651084084d9e617">size</a>();i++)
{
<span class="comment">//no danger - if there is nothing there we still get an empty field object </span>
fld = record.<a class="code" href="class_w_sql_1_1_w_sql_record.html#a6b4afb8edabdf5643a56e293f87db609">field</a>(i);
std::cout &lt;&lt; <span class="stringliteral">&quot;Field &quot;</span> &lt;&lt; fld.<a class="code" href="class_w_sql_1_1_w_sql_field.html#a953649f01aad00a111f5879295aa07b8" title="Returns the name of the field in the record.">name</a>()
&lt;&lt; <span class="stringliteral">&quot;, Origin Column &quot;</span>&lt;&lt; fld.<a class="code" href="class_w_sql_1_1_w_sql_field.html#a9d7961be812bf9aedd031abbd0126a62" title="Returns the name of the column as defined in the database..">columnName</a>()
&lt;&lt; <span class="stringliteral">&quot;Value: &quot;</span> &lt;&lt; fld.<a class="code" href="class_w_sql_1_1_w_sql_field.html#a3f48248a0281a2beb96cecde18185bd1">data</a>&lt;std::string&gt;() &lt;&lt; std::endl;
}
record = result-&gt;<a class="code" href="class_w_sql_1_1_w_sql_result.html#a0c775e8f12c31e876d30d77aeeeeb898">fetchNext</a>();
}
}
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSqlResult</a> <a class="el" href="class_w_sql_1_1_w_sql_record.html" title="The WSqlRecord class represents a database record.">WSqlRecord</a> <a class="el" href="class_w_sql_1_1_w_sql_field.html" title="The WSqlField class represents a field in a record.">WSqlField</a> <a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> <a class="el" href="class_w_sql_1_1_w_sql_driver.html" title="The WSqlDriver class is an abstract base class for database drivers.">WSqlDriver</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00034">34</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a6ef4f3c3d9c28a9f6aa171261c79b66e"></a><!-- doxytag: member="WSql::WSqlDatabase::WSqlDatabase" ref="a6ef4f3c3d9c28a9f6aa171261c79b66e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WSql::WSqlDatabase::WSqlDatabase </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates an empty, invalid <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> object. </p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00104">104</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a093d3810c76b1be2d155c3fd03c0a549"></a><!-- doxytag: member="WSql::WSqlDatabase::WSqlDatabase" ref="a093d3810c76b1be2d155c3fd03c0a549" args="(const WSql::DriverType &amp;type)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WSql::WSqlDatabase::WSqlDatabase </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> &amp;&#160;</td>
<td class="paramname"><em>type</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> object with a driver. </p>
<p>This constructs a database object with a driver of <em>type</em> - the object will attempt to create a driver - if successful <a class="el" href="class_w_sql_1_1_w_sql_database.html#a4a4d53b3ff1c197b16495087496f8660">isValid()</a> will return true. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname"><a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a></td><td>type - the type of driver to use </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00093">93</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="af69197a0eba8ef5f623971ab69c04b14"></a><!-- doxytag: member="WSql::WSqlDatabase::WSqlDatabase" ref="af69197a0eba8ef5f623971ab69c04b14" args="(const WSqlDatabase &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WSql::WSqlDatabase::WSqlDatabase </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a copy of <em>other</em>. </p>
<p>This constructs a new database object initialized with the values of <em>other</em> WARNING: This also creates a new driver! If <em>other</em> is destroyed <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> is invalid until the next <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a> is called!</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname"><a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a></td><td>other - database to copy </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00118">118</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7adeec6b1bf4b1f55fd63cc4a8fe5316"></a><!-- doxytag: member="WSql::WSqlDatabase::~WSqlDatabase" ref="a7adeec6b1bf4b1f55fd63cc4a8fe5316" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WSql::WSqlDatabase::~WSqlDatabase </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Destroys the object and frees any allocated resources. </p>
<p>Note that the driver is also destroyed at this time - any WSqlResults obtained from <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> will be invalid after this. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00137">137</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a7770c27b068eb51aa856c0ae37d726de"></a><!-- doxytag: member="WSql::WSqlDatabase::addError" ref="a7770c27b068eb51aa856c0ae37d726de" args="(const WSqlError &amp;e)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::addError </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_w_sql_1_1_w_sql_error.html">WSqlError</a> &amp;&#160;</td>
<td class="paramname"><em>e</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00074">74</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div>
</div>
<a class="anchor" id="a7d1ff5ea5063fd2a0642584972f9dada"></a><!-- doxytag: member="WSql::WSqlDatabase::close" ref="a7d1ff5ea5063fd2a0642584972f9dada" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::close </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Closes the database connection. </p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00256">256</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a09f2c6b29cf7eac1b65ee9615aaf9e1c"></a><!-- doxytag: member="WSql::WSqlDatabase::connectionOptions" ref="a09f2c6b29cf7eac1b65ee9615aaf9e1c" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string WSql::WSqlDatabase::connectionOptions </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection options string used for this connection. The string may be empty.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a41407aba46af14d6e5d513fbcaac9516" title="Sets the connection options for this database server.">setConnectOptions()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00582">582</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a83d2116612628889d41c13a9bb67ce0c"></a><!-- doxytag: member="WSql::WSqlDatabase::databaseName" ref="a83d2116612628889d41c13a9bb67ce0c" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string WSql::WSqlDatabase::databaseName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection's database name, which may be empty. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9511cd5c63a4375e815ad9dafb5ae7e4" title="Set the the database name.">setDatabaseName()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00368">368</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a1fc5a8e3e677b74c98c0e9d0cd39b6dc"></a><!-- doxytag: member="WSql::WSqlDatabase::driver" ref="a1fc5a8e3e677b74c98c0e9d0cd39b6dc" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a> * WSql::WSqlDatabase::driver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return a pointer to the database driver - expert only. </p>
<p>This returns a pointer to the database driver used to access the database connection. <em>Caution!</em> This is not meant to be used directly - use <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a>. <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a>, <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a> and <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> for interaction with the driver instead.</p>
<p>!This may be removed in future.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00420">420</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ada6addb3c7875e03a34871f2baf3595f"></a><!-- doxytag: member="WSql::WSqlDatabase::driverType" ref="ada6addb3c7875e03a34871f2baf3595f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a> WSql::WSqlDatabase::driverType </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00064">64</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div>
</div>
<a class="anchor" id="abc33cf10cd451155204056812e685db8"></a><!-- doxytag: member="WSql::WSqlDatabase::error" ref="abc33cf10cd451155204056812e685db8" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_error.html">WSqlError</a> WSql::WSqlDatabase::error </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the last error that occurred on the database or in the driver. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_error.html" title="The WSqlError class provides SQL database and driver error information.">WSqlError</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00430">430</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aa71bf380cd429a1da326a341e1f8195c"></a><!-- doxytag: member="WSql::WSqlDatabase::errors" ref="aa71bf380cd429a1da326a341e1f8195c" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::vector&lt;std::string&gt; WSql::WSqlDatabase::errors </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a64ec6d10ab64f9408a82e464eefdb275"></a><!-- doxytag: member="WSql::WSqlDatabase::handle" ref="a64ec6d10ab64f9408a82e464eefdb275" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a>* WSql::WSqlDatabase::handle </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00080">80</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div>
</div>
<a class="anchor" id="a1c943c000ea384846c7d4d77c3513afb"></a><!-- doxytag: member="WSql::WSqlDatabase::hasError" ref="a1c943c000ea384846c7d4d77c3513afb" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::hasError </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns true if there is an error available. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error()</a> </dd></dl>
<p><dl class="todo"><dt><b><a class="el" href="todo.html#_todo000024">Todo:</a></b></dt><dd>resolve this - there is also the local errorStack .. </dd></dl>
</p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00275">275</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aaded889a5674813f10c4eff81c90d65d"></a><!-- doxytag: member="WSql::WSqlDatabase::hostName" ref="aaded889a5674813f10c4eff81c90d65d" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string WSql::WSqlDatabase::hostName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection's host name; it may be empty.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#ac59ad9647f4c37e1fd11723d8f0d2933" title="Sets the connection&#39;s host name.">setHostName()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00397">397</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a1f865041c95b0962b614c219a918808e"></a><!-- doxytag: member="WSql::WSqlDatabase::initDriver" ref="a1f865041c95b0962b614c219a918808e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::initDriver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00185">185</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a9bd1765f14443afbb875981321d4c529"></a><!-- doxytag: member="WSql::WSqlDatabase::initMetaData" ref="a9bd1765f14443afbb875981321d4c529" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::initMetaData </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initializes the metadata for all tables in the database. </p>
<p>This method can be used to initialize all the metadata for the the database at once - this is convenient if one wishes to then use table metadata while also conducting queries. If this is called before <a class="el" href="class_w_sql_1_1_w_sql_database.html#a2f068c8103068f0b4cab897b824144b9" title="Fetch metadata for table tableName.">tableMetaData()</a> the metadata for all tables is cached in the driver and will be returned for a given table from the cache.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>This also initializes the referenced tables WSqlReferencedKeys - used by the ORM generation. If you need access to this kind of metadata you must use this method to initialize the referenced key lists - if you initialize table metadata individually the reference keys will be omitted.</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a2f068c8103068f0b4cab897b824144b9" title="Fetch metadata for table tableName.">tableMetaData()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a86df7db5900c3a2d1483375195c7b025" title="Returns a vector of the database&#39;s table names.">tableNames()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00532">532</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7c8b8c430fcfaa7d9ef5145c74f7dd48"></a><!-- doxytag: member="WSql::WSqlDatabase::isOpen" ref="a7c8b8c430fcfaa7d9ef5145c74f7dd48" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::isOpen </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns true if the database connection is currently open </p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00265">265</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a4a4d53b3ff1c197b16495087496f8660"></a><!-- doxytag: member="WSql::WSqlDatabase::isValid" ref="a4a4d53b3ff1c197b16495087496f8660" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::isValid </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns true if the <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> has a valid driver. </p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00590">590</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ac40fb73f4b8c5fd26f7cfb959679f1ba"></a><!-- doxytag: member="WSql::WSqlDatabase::open" ref="ac40fb73f4b8c5fd26f7cfb959679f1ba" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::open </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open a connection. </p>
<p>Opens the database connection using the current connection values. Returns true on success; otherwise returns false. Error information can be retrieved using <a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error()</a>.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9511cd5c63a4375e815ad9dafb5ae7e4" title="Set the the database name.">setDatabaseName()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a764e33f918dced0411724a3f4781343a" title="Set the the user name.">setUserName()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a098810c8f81bd4a8f1ea61dc0a3f25ad" title="Set the the password.">setPassword()</a> </dd>
<dd>
<a class="el" href="class_w_sql_1_1_w_sql_database.html#ac59ad9647f4c37e1fd11723d8f0d2933" title="Sets the connection&#39;s host name.">setHostName()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7b4a7177c16a84bbfd7ae0ca5da0c72c" title="Sets the port number for the connection.">setPort()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a41407aba46af14d6e5d513fbcaac9516" title="Sets the connection options for this database server.">setConnectOptions()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00230">230</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a8108c44524ad9722c84548f3b7b73d6f"></a><!-- doxytag: member="WSql::WSqlDatabase::open" ref="a8108c44524ad9722c84548f3b7b73d6f" args="(const std::string &amp;username, const std::string &amp;password)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::open </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>username</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>password</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open a connection using <em>username</em> and <em>password</em>. </p>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Opens the database connection using the given <em>user</em> name and <em>password</em>. Returns true on success; otherwise returns false. Error information can be retrieved using the <a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error()</a> function. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#abc33cf10cd451155204056812e685db8">error()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00245">245</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="aff088c6a45f151d872386a930a1ff7a3"></a><!-- doxytag: member="WSql::WSqlDatabase::operator=" ref="aff088c6a45f151d872386a930a1ff7a3" args="(const WSqlDatabase &amp;other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp; WSql::WSqlDatabase::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;&#160;</td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Copies the values of <em>other</em> to this object. </p>
<p>WARNING: This also creates a new driver! If <em>other</em> is destroyed <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> is invalid until the next <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a>!</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname"><a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a></td><td>other - database to copy </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00152">152</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a330a670990fc65f07e48366f05093200"></a><!-- doxytag: member="WSql::WSqlDatabase::password" ref="a330a670990fc65f07e48366f05093200" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string WSql::WSqlDatabase::password </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection's password. If the password was not set an empty string is returned. </p>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00387">387</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a9d22fff18962918f7301df4c85548ec6"></a><!-- doxytag: member="WSql::WSqlDatabase::port" ref="a9d22fff18962918f7301df4c85548ec6" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WSql::WSqlDatabase::port </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection's port number. </p>
<p>The value is -1 if the port number has not been set. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7b4a7177c16a84bbfd7ae0ca5da0c72c" title="Sets the port number for the connection.">setPort()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00062">62</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div>
</div>
<a class="anchor" id="a9a368d8a1e0ab21a2ab4b5082acc6a1c"></a><!-- doxytag: member="WSql::WSqlDatabase::query" ref="a9a368d8a1e0ab21a2ab4b5082acc6a1c" args="(const std::string &amp;sql)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WSqlDatabase::query </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>sql</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Executes the query in <em>sql</em> returning true on sucess. </p>
<p>This method sends the query SQL in string <em>sql</em> to the database server, the results of which will be available by calling <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a>. Use this method when you expect a result set, for non-result execution use execute() </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> execute() </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
<table class="retval">
<tr><td class="paramname">bool</td><td>true on success. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00602">602</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7f485f7a20f577f5f398c7b5fec07ab7"></a><!-- doxytag: member="WSql::WSqlDatabase::result" ref="a7f485f7a20f577f5f398c7b5fec07ab7" args="(bool iscached=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_result.html">WSqlResult</a> * WSql::WSqlDatabase::result </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>iscached</em> = <code>true</code></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns a pointer to the result set from the most recent query. </p>
<p>This method returns a pointer to a <a class="el" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSqlResult</a> object containing the most recent result set from a query - it may be empty if no results were returned. You must not delete this pointer yourself - it is owned by the driver.</p>
<p>The parameter <em>iscached</em> may be set to true to indicate a non-cached result set that will be fetched row by row - the default is true and results are cached. Note that uncached queries may or may not be implemented in a particular driver - see the documentation for the specific driver to find out.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>Only use this <em>after</em> an execute() query! Do not use twice in a row as it will delete the previous result and return a newly created object. Example:</dd></dl>
<div class="fragment"><pre class="fragment"> <a class="code" href="class_w_sql_1_1_w_sql_database.html#a6ef4f3c3d9c28a9f6aa171261c79b66e" title="Creates an empty, invalid WSqlDatabase object.">WSqlDatabase</a> db;
<span class="keywordflow">if</span> (!db.open())
dosomeerror();
<span class="keywordflow">if</span> (!db.query(std::string(<span class="stringliteral">&quot;select foo from bar&quot;</span>)))
dosomeerror();
WSqlResult *result = db.getResult();
<span class="comment">//WSqlResult *result2 = db.getResult(); &lt;- wrong </span>
<span class="comment">//...iterate over results ..._then repeat:</span>
<span class="keywordflow">if</span> (!db.query(std::string(<span class="stringliteral">&quot;select baz from bar&quot;</span>)))
dosomeerror();
WSqlResult *result = db.getResult();
..etc.
</pre></div> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSqlResult</a> <a class="el" href="class_w_sql_1_1_w_sql_record.html" title="The WSqlRecord class represents a database record.">WSqlRecord</a> <a class="el" href="class_w_sql_1_1_w_mysql_driver.html" title="A driver for MySQL databases.">WMysqlDriver</a> <a class="el" href="class_w_sql_1_1_w_sqlite_driver.html">WSqliteDriver</a></dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">bool</td><td>iscached - if true (the default) fetches entire result set at once. </td></tr>
</table>
</dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
<table class="retval">
<tr><td class="paramname">WSqlResult*</td><td>- the result set </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00640">640</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a41407aba46af14d6e5d513fbcaac9516"></a><!-- doxytag: member="WSql::WSqlDatabase::setConnectOptions" ref="a41407aba46af14d6e5d513fbcaac9516" args="(const std::string &amp;options=std::string())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setConnectOptions </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>options</em> = <code>std::string()</code></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the connection options for this database server. </p>
<p>Sets database-specific <em>options</em>. This must be done before the connection is opened or it has no effect (or you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, call this function and <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> the connection again).</p>
<p>Note that the options are specific to a database server - drivers should handle this string appropriately.</p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string&amp;</td><td>options - connection options to pass to the driver. </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd>getConnectionOptions() </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00571">571</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a9511cd5c63a4375e815ad9dafb5ae7e4"></a><!-- doxytag: member="WSql::WSqlDatabase::setDatabaseName" ref="a9511cd5c63a4375e815ad9dafb5ae7e4" args="(const std::string &amp;name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setDatabaseName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set the the database name. </p>
<p>Sets the connection's database name to <em>name</em>. To have effect, the database name must be set <em>before</em> opening the connection with <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> Alternately, you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, set the database name, and call <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> again There is no default value. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>name - the name of the database </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a83d2116612628889d41c13a9bb67ce0c">databaseName()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00292">292</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="af7475caa3bfbf3115c1ddf612e6bc402"></a><!-- doxytag: member="WSql::WSqlDatabase::setDriver" ref="af7475caa3bfbf3115c1ddf612e6bc402" args="(WSqlDriver *d)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setDriver </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_w_sql_1_1_w_sql_driver.html">WSqlDriver</a> *&#160;</td>
<td class="paramname"><em>d</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wsqldatabase_8h_source.html#l00076">76</a> of file <a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a>.</p>
</div>
</div>
<a class="anchor" id="a30f7bdbae04478250a4b7cef66edfc16"></a><!-- doxytag: member="WSql::WSqlDatabase::setDriverType" ref="a30f7bdbae04478250a4b7cef66edfc16" args="(WSql::DriverType t)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setDriverType </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespace_w_sql.html#ad184e6e363bbd3ea2b768ac8a013bf3c">WSql::DriverType</a>&#160;</td>
<td class="paramname"><em>t</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="ac59ad9647f4c37e1fd11723d8f0d2933"></a><!-- doxytag: member="WSql::WSqlDatabase::setHostName" ref="ac59ad9647f4c37e1fd11723d8f0d2933" args="(const std::string &amp;host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setHostName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>hostname</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the connection's host name. </p>
<p>This method sets the connection's host name to <em>hostname</em>. To have effect, the host name must be set <em>before</em> opening the connection with <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> Alternately, you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, set the host name, and call <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> again.</p>
<p>There is no default value. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>hostname - the hostname to use </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#aaded889a5674813f10c4eff81c90d65d">hostName()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00342">342</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a098810c8f81bd4a8f1ea61dc0a3f25ad"></a><!-- doxytag: member="WSql::WSqlDatabase::setPassword" ref="a098810c8f81bd4a8f1ea61dc0a3f25ad" args="(const std::string &amp;password)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setPassword </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>password</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set the the password. </p>
<p>Sets the connection's password to <em>password</em>. To have effect, the password must be set <em></em>{before} the connection is {<a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a>} {opened}. Alternatively, you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, set the password, and call <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> again.</p>
<p>There is no default value. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>password - the password to use </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a330a670990fc65f07e48366f05093200">password()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00326">326</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a7b4a7177c16a84bbfd7ae0ca5da0c72c"></a><!-- doxytag: member="WSql::WSqlDatabase::setPort" ref="a7b4a7177c16a84bbfd7ae0ca5da0c72c" args="(int p)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setPort </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>port</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the port number for the connection. </p>
<p>This method sets the connection's port number to <em>port</em>. To have effect, the port number must be set <em>before</em> opening the connection with <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> Alternately, you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, set the port number, and call <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> again</p>
<p>The default value is -1.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a9d22fff18962918f7301df4c85548ec6" title="Returns the connection&#39;s port number.">port()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">int</td><td>port number to use </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00359">359</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a764e33f918dced0411724a3f4781343a"></a><!-- doxytag: member="WSql::WSqlDatabase::setUserName" ref="a764e33f918dced0411724a3f4781343a" args="(const std::string &amp;name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WSqlDatabase::setUserName </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Set the the user name. </p>
<p>Sets the connection's user name to <em>name</em>. To have effect, the user name must be set <em>before</em> opening the connection with <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> Alternately, you can <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> the connection, set the user name, and call <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> again.</p>
<p>There is no default value. </p>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>name - the name of the user </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a8523467f1ed4ba30b800d6cf6224a9b1">userName()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#ac40fb73f4b8c5fd26f7cfb959679f1ba" title="Open a connection.">open()</a> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7d1ff5ea5063fd2a0642584972f9dada">close()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00309">309</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a2f068c8103068f0b4cab897b824144b9"></a><!-- doxytag: member="WSql::WSqlDatabase::tableMetaData" ref="a2f068c8103068f0b4cab897b824144b9" args="(const std::string &amp;tableName) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_w_sql_1_1_w_sql_table.html">WSqlTable</a> WSql::WSqlDatabase::tableMetaData </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>tablename</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Fetch metadata for table <em>tableName</em>. </p>
<p>This method returns a <a class="el" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a> object populated with WSqlColumns that contain metadata for the columns in the given table <em>tableName</em>. Example:</p>
<div class="fragment"><pre class="fragment"> meta_table = db.tableMetaData(*it);
numflds = meta_table.count();
<span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i &lt; numflds; ++i)
{
<a class="code" href="class_w_sql_1_1_w_sql_column.html" title="The WSqlColumn class represents a column in SQL database tables.">WSql::WSqlColumn</a> column = meta_table.column(i);
std::cout &lt;&lt; <span class="stringliteral">&quot;Column &quot;</span> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; = &quot;</span> &lt;&lt; column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a44843e71b5805c2287e00df46185eb71">columnName</a>() &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Data type: &quot;</span> &lt;&lt; <a class="code" href="namespace_w_sql_1_1_w_sql_data_type.html#a35fc6aeb59a9a430f53eb16069742573" title="Covenience function - returns a string for the type.">WSql::WSqlDataType::toString</a>(column.dataType()) &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Max Length: &quot;</span> &lt;&lt; column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a46eac3f4c5a14bf24bbac67a02787b8b">maxLength</a>() &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Unsigned: &quot;</span> &lt;&lt; (column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a77fd5a82727a48f5449b62804260d5c3">isUnsigned</a>() ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>) &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Can be null: &quot;</span> &lt;&lt; (column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a8d6cb49198c3215c1b8542ba9ea0f16b">canBeNull</a>() ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>) &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Primary key: &quot;</span> &lt;&lt; (column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a550d941195f306da2e2df25bbd08dee6">isPrimaryKey</a>() ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>) &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * Autoincrement: &quot;</span> &lt;&lt; (column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#aa1554dddff2918b50300794905f3edbc">isAutoIncremented</a>()?<span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>) &lt;&lt; std::endl;
std::cout &lt;&lt; <span class="stringliteral">&quot; * default value: &quot;</span> &lt;&lt; column.<a class="code" href="class_w_sql_1_1_w_sql_column.html#a55feefa5aa00a43a8c8e09a517414047">defaultValue</a>&lt;std::string&gt;() &lt;&lt; std::endl;
}
</pre></div><dl class="warning"><dt><b>Warning:</b></dt><dd>If the table metadata has not been initialized yet this method will invalidate any previous <a class="el" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSqlResult</a> pointer returned - in this case nesting calls to this method inside of a loop iterating over WSqlResults WILL NOT WORK. Obtain the <a class="el" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a> <em>first</em> and <em>then</em> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a> a query and fetch the result set using <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> or use <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9bd1765f14443afbb875981321d4c529" title="Initializes the metadata for all tables in the database.">initMetaData()</a> to initialize the metadata for all tables at once.</dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">string</td><td>the name of the table to use </td></tr>
</table>
</dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
<table class="retval">
<tr><td class="paramname"><a class="el" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a></td><td>an object containing metadata </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a> <a class="el" href="class_w_sql_1_1_w_sql_column.html" title="The WSqlColumn class represents a column in SQL database tables.">WSqlColumn</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00509">509</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a86df7db5900c3a2d1483375195c7b025"></a><!-- doxytag: member="WSql::WSqlDatabase::tableNames" ref="a86df7db5900c3a2d1483375195c7b025" args="(WSql::TableType type=WSql::Tables)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::vector&lt; std::string &gt; &amp; WSql::WSqlDatabase::tableNames </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespace_w_sql.html#a2860958b4a0664bf26cd4959a7aaace8">WSql::TableType</a>&#160;</td>
<td class="paramname"><em>type</em> = <code>WSql::Tables</code></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns a vector of the database's table names. </p>
<p>Returns all the errors that have occurred on the database or in the driver as a vector of strings. </p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000025">Todo:</a></b></dt><dd>.. decide if we use this .. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_error.html" title="The WSqlError class provides SQL database and driver error information.">WSqlError</a></dd></dl>
<p>This function returns a vector of strings containing the names tables and views as specified by the parameter <em>type</em>. The vector is cached for quick reference - if empty it is initialized by a request to the driver for the names. If the names are not available an empty vector is returned.</p>
<dl class="warning"><dt><b>Warning:</b></dt><dd>If the table metadata has not been initialized yet this method will invalidate any previous <a class="el" href="class_w_sql_1_1_w_sql_result.html" title="The WSqlResult class provides a representation of the result set from a query.">WSqlResult</a> pointer returned - in this case nesting calls to this method inside of a loop iterating over WSqlResults WILL NOT WORK. Obtain the <a class="el" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a> <em>first</em> and <em>then</em> <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9a368d8a1e0ab21a2ab4b5082acc6a1c" title="Executes the query in sql returning true on sucess.">query()</a> a query and fetch the result set using <a class="el" href="class_w_sql_1_1_w_sql_database.html#a7f485f7a20f577f5f398c7b5fec07ab7" title="Returns a pointer to the result set from the most recent query.">getResult()</a> or use <a class="el" href="class_w_sql_1_1_w_sql_database.html#a9bd1765f14443afbb875981321d4c529" title="Initializes the metadata for all tables in the database.">initMetaData()</a> to initialize the metadata for all tables at once.</dd></dl>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000026">Todo:</a></b></dt><dd>Use the table type - currently does nothing.</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="namespace_w_sql.html#a2860958b4a0664bf26cd4959a7aaace8">WSql::TableType</a> </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname"><a class="el" href="namespace_w_sql.html#a2860958b4a0664bf26cd4959a7aaace8">WSql::TableType</a></td><td></td></tr>
</table>
</dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
<table class="retval">
<tr><td class="paramname">std::vector&lt;std::string&gt;&amp;</td><td>- the table names in this database </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00467">467</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a8523467f1ed4ba30b800d6cf6224a9b1"></a><!-- doxytag: member="WSql::WSqlDatabase::userName" ref="a8523467f1ed4ba30b800d6cf6224a9b1" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string WSql::WSqlDatabase::userName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the connection's user name; it may be empty.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_w_sql_database.html#a764e33f918dced0411724a3f4781343a" title="Set the the user name.">setUserName()</a> </dd></dl>
<p>Definition at line <a class="el" href="wsqldatabase_8cpp_source.html#l00378">378</a> of file <a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/sql/<a class="el" href="wsqldatabase_8h_source.html">wsqldatabase.h</a></li>
<li>src/sql/<a class="el" href="wsqldatabase_8cpp_source.html">wsqldatabase.cpp</a></li>
</ul>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Fri Nov 18 2011 21:01:46 for WORM by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>