233 lines
26 KiB
HTML
233 lines
26 KiB
HTML
<!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"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>remwharead: remwharead::Database Class Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">remwharead
|
|
 <span id="projectnumber">0.6.3</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>remwharead</b></li><li class="navelem"><a class="el" href="classremwharead_1_1Database.html">Database</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#nested-classes">Classes</a> |
|
|
<a href="#pub-types">Public Types</a> |
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classremwharead_1_1Database-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">remwharead::Database Class Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Store and retrieve files from/to SQLite.
|
|
<a href="classremwharead_1_1Database.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="sqlite_8hpp_source.html">sqlite.hpp</a>></code></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
|
|
Classes</h2></td></tr>
|
|
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structremwharead_1_1Database_1_1entry.html">entry</a></td></tr>
|
|
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Describes a database entry. <a href="structremwharead_1_1Database_1_1entry.html#details">More...</a><br /></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
|
|
Public Types</h2></td></tr>
|
|
<tr class="memitem:a5ef85b43b21a900046b9233ee259ae7d"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structremwharead_1_1Database_1_1entry.html">remwharead::Database::entry</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Database.html#a5ef85b43b21a900046b9233ee259ae7d">entry</a></td></tr>
|
|
<tr class="memdesc:a5ef85b43b21a900046b9233ee259ae7d"><td class="mdescLeft"> </td><td class="mdescRight">Describes a database entry. <a href="#a5ef85b43b21a900046b9233ee259ae7d">More...</a><br /></td></tr>
|
|
<tr class="separator:a5ef85b43b21a900046b9233ee259ae7d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
|
|
Public Member Functions</h2></td></tr>
|
|
<tr class="memitem:a8576436b2cc1e3d8ecfdeabfc0ff88ca"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Database.html#a8576436b2cc1e3d8ecfdeabfc0ff88ca">Database</a> ()</td></tr>
|
|
<tr class="memdesc:a8576436b2cc1e3d8ecfdeabfc0ff88ca"><td class="mdescLeft"> </td><td class="mdescRight">Connects to the database and creates it if necessary. <a href="#a8576436b2cc1e3d8ecfdeabfc0ff88ca">More...</a><br /></td></tr>
|
|
<tr class="separator:a8576436b2cc1e3d8ecfdeabfc0ff88ca"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:adf363243852b2a5fec1911139d4936c1"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Database.html#adf363243852b2a5fec1911139d4936c1">operator bool</a> () const</td></tr>
|
|
<tr class="memdesc:adf363243852b2a5fec1911139d4936c1"><td class="mdescLeft"> </td><td class="mdescRight">Returns true if connected to the database. <a href="#adf363243852b2a5fec1911139d4936c1">More...</a><br /></td></tr>
|
|
<tr class="separator:adf363243852b2a5fec1911139d4936c1"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Database.html#ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd">store</a> (const <a class="el" href="structremwharead_1_1Database_1_1entry.html">entry</a> &data) const</td></tr>
|
|
<tr class="memdesc:ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd"><td class="mdescLeft"> </td><td class="mdescRight">Store a <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a> in the database. <a href="#ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd">More...</a><br /></td></tr>
|
|
<tr class="separator:ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:abc9c9adf58b786342b0492baeef8f4ec"><td class="memItemLeft" align="right" valign="top">const vector< <a class="el" href="structremwharead_1_1Database_1_1entry.html">entry</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="classremwharead_1_1Database.html#abc9c9adf58b786342b0492baeef8f4ec">retrieve</a> (const time_point &start=time_point(), const time_point &end=system_clock::now()) const</td></tr>
|
|
<tr class="memdesc:abc9c9adf58b786342b0492baeef8f4ec"><td class="mdescLeft"> </td><td class="mdescRight">Retrieve a vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a> from the database. <a href="#abc9c9adf58b786342b0492baeef8f4ec">More...</a><br /></td></tr>
|
|
<tr class="separator:abc9c9adf58b786342b0492baeef8f4ec"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Store and retrieve files from/to SQLite. </p>
|
|
</div><h2 class="groupheader">Member Typedef Documentation</h2>
|
|
<a id="a5ef85b43b21a900046b9233ee259ae7d"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a5ef85b43b21a900046b9233ee259ae7d">◆ </a></span>entry</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">typedef struct <a class="el" href="structremwharead_1_1Database_1_1entry.html">remwharead::Database::entry</a> <a class="el" href="structremwharead_1_1Database_1_1entry.html">remwharead::Database::entry</a></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Describes a database entry. </p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a id="a8576436b2cc1e3d8ecfdeabfc0ff88ca"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a8576436b2cc1e3d8ecfdeabfc0ff88ca">◆ </a></span>Database()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">remwharead::Database::Database </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Connects to the database and creates it if necessary. </p>
|
|
<div class="fragment"><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  : _connected(<span class="keyword">false</span>)</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  {</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  xdgHandle xdg;</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  xdgInitHandle(&xdg);</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  _dbpath = xdgDataHome(&xdg) / fs::path(<span class="stringliteral">"remwharead"</span>);</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  xdgWipeHandle(&xdg);</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">if</span> (!fs::exists(_dbpath))</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  {</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  fs::create_directories(_dbpath);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  _dbpath /= <span class="stringliteral">"database.sqlite"</span>;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  _con = std::make_unique<sqlite::connection>(_dbpath);</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  sqlite::execute(*_con, <span class="stringliteral">"CREATE TABLE IF NOT EXISTS remwharead("</span></div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="stringliteral">"uri TEXT, archive_uri TEXT, datetime TEXT, "</span></div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="stringliteral">"tags TEXT, title TEXT, description TEXT, "</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="stringliteral">"fulltext TEXT);"</span>, <span class="keyword">true</span>);</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  _connected = <span class="keyword">true</span>;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  }</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keywordflow">catch</span> (std::exception &e)</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  {</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  cerr << <span class="stringliteral">"Error in "</span> << __func__ << <span class="stringliteral">": "</span> << e.what() << endl;</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  }</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  }</div></div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a id="adf363243852b2a5fec1911139d4936c1"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#adf363243852b2a5fec1911139d4936c1">◆ </a></span>operator bool()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">remwharead::Database::operator bool </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns true if connected to the database. </p>
|
|
<div class="fragment"><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  {</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">return</span> _connected;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  }</div></div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<a id="abc9c9adf58b786342b0492baeef8f4ec"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#abc9c9adf58b786342b0492baeef8f4ec">◆ </a></span>retrieve()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">const vector< <a class="el" href="structremwharead_1_1Database_1_1entry.html">Database::entry</a> > remwharead::Database::retrieve </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const time_point & </td>
|
|
<td class="paramname"><em>start</em> = <code>time_point()</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const time_point & </td>
|
|
<td class="paramname"><em>end</em> = <code>system_clock::now()</code> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Retrieve a vector of <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a> from the database. </p>
|
|
<div class="fragment"><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  {</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  {</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keyword">const</span> <span class="keywordtype">string</span> query = <span class="stringliteral">"SELECT * FROM remwharead WHERE datetime "</span></div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="stringliteral">"BETWEEN '"</span> + timepoint_to_string(start, <span class="keyword">true</span>)</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  + <span class="stringliteral">"' AND '"</span> + timepoint_to_string(end, <span class="keyword">true</span>)</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  + <span class="stringliteral">"' ORDER BY datetime DESC;"</span>;</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  sqlite::query q(*_con, query);</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  sqlite::result_type res = q.get_result();</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  vector<entry> entries;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">while</span>(res->next_row())</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  {</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  vector<string> tags;</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keyword">const</span> <span class="keywordtype">string</span> strtags = res->get_string(3);</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">size_t</span> pos = 0;</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">while</span> (pos != std::string::npos)</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  {</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keyword">const</span> <span class="keywordtype">size_t</span> newpos = strtags.find(<span class="charliteral">','</span>, pos);</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  tags.push_back(strtags.substr(pos, newpos - pos));</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  pos = newpos;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">if</span> (pos != std::string::npos)</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  ++pos;</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  }</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  }</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  entries.push_back</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  ({</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  res->get_string(0),</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  res->get_string(1),</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  string_to_timepoint(res->get_string(2), <span class="keyword">true</span>),</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  tags,</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  res->get_string(4),</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  res->get_string(5),</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  res->get_string(6)</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  });</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  }</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span> </div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordflow">return</span> entries;</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  }</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">catch</span> (std::exception &e)</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  {</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  cerr << <span class="stringliteral">"Error in "</span> << __func__ << <span class="stringliteral">": "</span> << e.what() << endl;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  }</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> </div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">return</span> {};</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  }</div></div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<a id="ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#ab3ea9062c5c0ef5d9f2b7eea6f0fd1bd">◆ </a></span>store()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void remwharead::Database::store </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const <a class="el" href="structremwharead_1_1Database_1_1entry.html">entry</a> & </td>
|
|
<td class="paramname"><em>data</em></td><td>)</td>
|
|
<td> const</td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Store a <a class="el" href="structremwharead_1_1Database_1_1entry.html" title="Describes a database entry. ">Database::entry</a> in the database. </p>
|
|
<div class="fragment"><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  {</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">try</span></div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="keyword">const</span> <span class="keywordtype">string</span> strdatetime = timepoint_to_string(data.datetime, <span class="keyword">true</span>);</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordtype">string</span> strtags;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">for</span> (<span class="keyword">const</span> <span class="keywordtype">string</span> &tag : data.tags)</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  {</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  strtags += tag;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">if</span> (tag != *(data.tags.rbegin()))</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  {</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  strtags += <span class="stringliteral">","</span>;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  }</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  }</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  sqlite::execute ins(*_con, <span class="stringliteral">"INSERT INTO remwharead "</span></div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="stringliteral">"VALUES(?, ?, ?, ?, ?, ?, ?);"</span>);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  ins % data.uri % data.archive_uri % strdatetime % strtags</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  % data.title % data.description % data.fulltext;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  ins();</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  }</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordflow">catch</span> (std::exception &e)</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  {</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  cerr << <span class="stringliteral">"Error in "</span> << __func__ << <span class="stringliteral">": "</span> << e.what() << endl;</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  }</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  }</div></div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li>include/<a class="el" href="sqlite_8hpp_source.html">sqlite.hpp</a></li>
|
|
<li>src/lib/sqlite.cpp</li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.14
|
|
</small></address>
|
|
</body>
|
|
</html>
|