mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Squashed 'src/soci/' content from commit 6e9312c
git-subtree-dir: src/soci git-subtree-split: 6e9312c4bb3748907bd28d62c40feca42878cfef
This commit is contained in:
102
doc/index.html
Normal file
102
doc/index.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
|
||||
<head>
|
||||
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<title>SOCI</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p class="banner">SOCI - The C++ Database Access Library</p>
|
||||
|
||||
<h1>Documentation and tutorial</h1>
|
||||
|
||||
<div class="navigation">
|
||||
<a href="structure.html">Structure</a><br />
|
||||
<a href="installation.html">Installation</a><br />
|
||||
<a href="errors.html">Errors</a><br />
|
||||
<a href="connections.html">Connections</a><br />
|
||||
<a href="queries.html">Queries</a><br />
|
||||
<a href="exchange.html">Exchanging data</a><br />
|
||||
<a href="statements.html">Statements, procedures and transactions</a><br />
|
||||
<a href="multithreading.html">Multithreading and SOCI</a><br />
|
||||
<a href="boost.html">Integration with Boost</a><br />
|
||||
<a href="interfaces.html">Interfaces</a><br />
|
||||
<a href="beyond.html">Beyond standard SQL</a><br />
|
||||
<a href="reference.html">Client interface reference</a><br />
|
||||
<a href="backends.html">Backends reference</a><br />
|
||||
<a href="rationale.html">Rationale FAQ</a><br /><br />
|
||||
<a href="languages/ada/index.html">Ada language binding</a><br /><br />
|
||||
<a href="backends/index.html">Existing backends and supported platforms</a>
|
||||
</div>
|
||||
|
||||
<p>The following (complete!) example is purposedly provided without any explanation.</p>
|
||||
|
||||
<pre class="example">
|
||||
#include "soci.h"
|
||||
#include "soci-oracle.h"
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
using namespace soci;
|
||||
using namespace std;
|
||||
|
||||
bool get_name(string &name)
|
||||
{
|
||||
cout << "Enter name: ";
|
||||
return cin >> name;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
session sql(oracle, "service=mydb user=john password=secret");
|
||||
|
||||
int count;
|
||||
sql << "select count(*) from phonebook", into(count);
|
||||
|
||||
cout << "We have " << count << " entries in the phonebook.\n";
|
||||
|
||||
string name;
|
||||
while (get_name(name))
|
||||
{
|
||||
string phone;
|
||||
indicator ind;
|
||||
sql << "select phone from phonebook where name = :name",
|
||||
into(phone, ind), use(name);
|
||||
|
||||
if (ind == i_ok)
|
||||
{
|
||||
cout << "The phone number is " << phone << '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "There is no phone for " << name << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (exception const &e)
|
||||
{
|
||||
cerr << "Error: " << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<table class="foot-links" border="0" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td class="foot-link-left"></td>
|
||||
<td class="foot-link-right">
|
||||
<a href="structure.html">Next (Library structure, files and compilation)</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="copyright">Copyright © 2010-2013 Mateusz Loskot</p>
|
||||
<p class="copyright">Copyright © 2012 Vadim Zeitlin</p>
|
||||
<p class="copyright">Copyright © 2004-2008 Maciej Sobczak, Stephen Hutton</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user