Skip to content

Commit

Permalink
Split basics.html into two separate pages
Browse files Browse the repository at this point in the history
Rename basics.html to connections.html
Add queries.html with simple queries copied from connections.html

[ci skip]
  • Loading branch information
mloskot committed Mar 4, 2013
1 parent 1c1fbaa commit 25d3e74
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 35 deletions.
38 changes: 4 additions & 34 deletions doc/basics.html → doc/connections.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>SOCI - basics</title>
<title>SOCI - connections</title>
</head>

<body>
Expand Down Expand Up @@ -112,49 +112,19 @@ <h3>Connecting to the database</h3>
</ul>
</div>

<h3>Simple SQL statements</h3>

<p>In many cases, the SQL query is intended to be executed only once,
which means that statement parsing and execution can go together.
The <code>session</code> class provides a special <code>once</code>
member, which triggers parsing and execution of such one-time
statements:</p>

<pre class="example">
sql.once &lt;&lt; "drop table persons";
</pre>

<p>For shorter syntax, the following form is also allowed:</p>

<pre class="example">
sql &lt;&lt; "drop table persons";
</pre>

<p>The IOStream-like interface is exactly what it looks like, so that
the
statement text can be composed of many parts, involving anything that
is <i>streamable</i> (including custom classes, if they have
appropriate <code>operator&lt;&lt;</code>):</p>

<pre class="example">
string tableName = "persons";
sql &lt;&lt; "drop table " &lt;&lt; tableName;

int id = 123;
sql &lt;&lt; "delete from companies where id = " &lt;&lt; id;
</pre>

<table class="foot-links" border="0" cellpadding="2" cellspacing="2">
<tr>
<td class="foot-link-left">
<a href="errors.html">Previous (Errors)</a>
</td>
<td class="foot-link-right">
<a href="exchange.html">Next (Exchanging data)</a>
<a href="queries.html">Next (Queries)</a>
</td>
</tr>
</table>

<p class="copyright">Copyright &copy; 2013 Mateusz Loskot</p>
<p class="copyright">Copyright &copy; 2004-2008 Maciej Sobczak, Stephen Hutton</p>

</body>
</html>
3 changes: 2 additions & 1 deletion doc/index.html
Expand Up @@ -15,7 +15,8 @@ <h1>Documentation and tutorial</h1>
<a href="structure.html">Structure</a><br />
<a href="installation.html">Installation</a><br />
<a href="errors.html">Errors</a><br />
<a href="basics.html">Connections and simple queries</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 />
Expand Down
60 changes: 60 additions & 0 deletions doc/queries.html
@@ -0,0 +1,60 @@
<!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 - queries</title>
</head>

<body>
<p class="banner">SOCI - The C++ Database Access Library</p>

<h2>Queries</h2>

<h3>Simple SQL statements</h3>

<p>In many cases, the SQL query is intended to be executed only once,
which means that statement parsing and execution can go together.
The <code>session</code> class provides a special <code>once</code>
member, which triggers parsing and execution of such one-time
statements:</p>

<pre class="example">
sql.once &lt;&lt; "drop table persons";
</pre>

<p>For shorter syntax, the following form is also allowed:</p>

<pre class="example">
sql &lt;&lt; "drop table persons";
</pre>

<p>The IOStream-like interface is exactly what it looks like, so that
the
statement text can be composed of many parts, involving anything that
is <i>streamable</i> (including custom classes, if they have
appropriate <code>operator&lt;&lt;</code>):</p>

<pre class="example">
string tableName = "persons";
sql &lt;&lt; "drop table " &lt;&lt; tableName;

int id = 123;
sql &lt;&lt; "delete from companies where id = " &lt;&lt; id;
</pre>

<table class="foot-links" border="0" cellpadding="2" cellspacing="2">
<tr>
<td class="foot-link-left">
<a href="connections.html">Previous (Connections)</a>
</td>
<td class="foot-link-right">
<a href="exchange.html">Next (Exchanging data)</a>
</td>
</tr>
</table>

<p class="copyright">Copyright &copy; 2013 Mateusz Loskot</p>
<p class="copyright">Copyright &copy; 2004-2008 Maciej Sobczak, Stephen Hutton</p>
</body>
</html>

0 comments on commit 25d3e74

Please sign in to comment.