File: Database_8h-source.html

package info (click to toggle)
simpledb 1.5-1.4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze
  • size: 888 kB
  • ctags: 238
  • sloc: cpp: 529; makefile: 127; perl: 23; sh: 9
file content (100 lines) | stat: -rw-r--r-- 8,475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Simple&amp;nbsp;C++&amp;nbsp;ODBC&amp;nbsp;Database&amp;nbsp;API: Database.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <a class="qindex" href="examples.html">Examples</a></div>
<h1>Database.h</h1><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- c++ -*-</span>
00002 <span class="comment"> * __BEGIN_COPYRIGHT</span>
00003 <span class="comment"> * SimpleDB API</span>
00004 <span class="comment"> * </span>
00005 <span class="comment"> * Copyright (C) 2005 Eminence Technology Pty Ltd</span>
00006 <span class="comment"> * </span>
00007 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
00008 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
00009 <span class="comment"> * License as published by the Free Software Foundation; either</span>
00010 <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span>
00011 <span class="comment"> * </span>
00012 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
00015 <span class="comment"> * Lesser General Public License for more details.</span>
00016 <span class="comment"> * </span>
00017 <span class="comment"> * You can view the GNU Lesser General Public Licence at</span>
00018 <span class="comment"> * http://www.gnu.org/licenses/lgpl.html or you can write to the Free Software</span>
00019 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
00020 <span class="comment"> * </span>
00021 <span class="comment"> * Eminence Technology Pty Ltd can be contacted by writing to</span>
00022 <span class="comment"> * Eminence Technology, PO Box 118, Moorooka QLD 4105, Australia.</span>
00023 <span class="comment"> * Alternatively, you may email opensource [at] eminence [dot] com [dot] au</span>
00024 <span class="comment"> * __END_COPYRIGHT</span>
00025 <span class="comment"> */</span>
00026 
00027 <span class="preprocessor">#ifndef __SIMPLEDB_DATABASE_H_</span>
00028 <span class="preprocessor"></span><span class="preprocessor">#define __SIMPLEDB_DATABASE_H_ 1</span>
00029 <span class="preprocessor"></span>
00030 <span class="preprocessor">#include &lt;string&gt;</span>
00031 <span class="preprocessor">#include &lt;sql.h&gt;</span>
00032 <span class="preprocessor">#include &lt;sqlext.h&gt;</span>
00033 <span class="preprocessor">#include &lt;iostream&gt;</span>
00034 <span class="preprocessor">#include "Query.h"</span>
00035 <span class="preprocessor">#include "Exception.h"</span>
00036 
00037 <span class="keyword">namespace </span>SimpleDB {
00038 
<a name="l00045"></a><a class="code" href="classSimpleDB_1_1Database.html">00045</a>   <span class="keyword">class </span><a class="code" href="classSimpleDB_1_1Database.html">Database</a> {
00046 
00047   <span class="keyword">public</span>:
00048 
<a name="l00052"></a><a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">00052</a>     <span class="keyword">class </span><a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">Exception</a> : <span class="keyword">public</span> SimpleDB::<a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">Exception</a> {
00053     <span class="keyword">public</span>:
<a name="l00054"></a><a class="code" href="classSimpleDB_1_1Database_1_1Exception.html#a0">00054</a>       <a class="code" href="classSimpleDB_1_1Database_1_1Exception.html#a0">Exception</a>(<span class="keyword">const</span> std::string&amp; <a class="code" href="classSimpleDB_1_1Exception.html#o0">message</a>) : SimpleDB::<a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">Exception</a>(message) {};
00055     };
00056 
<a name="l00060"></a><a class="code" href="classSimpleDB_1_1Database_1_1NoDataException.html">00060</a>     <span class="keyword">class </span><a class="code" href="classSimpleDB_1_1Database_1_1NoDataException.html">NoDataException</a> : <span class="keyword">public</span> <a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">Exception</a> {
00061     <span class="keyword">public</span>:
00062       
<a name="l00066"></a><a class="code" href="classSimpleDB_1_1Database_1_1NoDataException.html#a0">00066</a>       <a class="code" href="classSimpleDB_1_1Database_1_1NoDataException.html#a0">NoDataException</a>() : <a class="code" href="classSimpleDB_1_1Database_1_1Exception.html">Exception</a>(<span class="stringliteral">"No data returned."</span>) {
00067       }
00068     };
00069   
00074     <a class="code" href="classSimpleDB_1_1Database.html#a0">Database</a>(std::string dsn);
00075   
00080     <a class="code" href="classSimpleDB_1_1Query.html">Query</a> <a class="code" href="classSimpleDB_1_1Database.html#a1">newQuery</a>() <span class="keyword">const</span>;
00081 
00086     <span class="keywordtype">void</span> <a class="code" href="classSimpleDB_1_1Database.html#a2">voidQuery</a> (<span class="keyword">const</span> std::string&amp; query) <span class="keyword">const</span>;
00087     
00098     <span class="keywordtype">long</span> <a class="code" href="classSimpleDB_1_1Database.html#a3">intQuery</a> (<span class="keyword">const</span> std::string&amp; query) <span class="keyword">const</span>;
00099     
00105     std::string <a class="code" href="classSimpleDB_1_1Database.html#a4">strQuery</a> (<span class="keyword">const</span> std::string&amp; query, <span class="keywordtype">long</span> bufSize = 1000) <span class="keyword">const</span>;
00106     
00113     <span class="keyword">static</span> <span class="keyword">const</span> std::string <a class="code" href="classSimpleDB_1_1Database.html#e0">escapeString</a>(<span class="keyword">const</span> std::string&amp; input);
00114     
00119     <span class="keyword">static</span> <span class="keyword">const</span> std::string  <a class="code" href="classSimpleDB_1_1Database.html#e1">boolToStr</a> (<span class="keyword">const</span> <span class="keywordtype">bool</span> in);
00120     
00125     <span class="keyword">const</span> SQLHDBC <a class="code" href="classSimpleDB_1_1Database.html#a5">getConnectionHandle</a>() <span class="keyword">const</span>;
00126     
00130     <span class="keyword">virtual</span> <a class="code" href="classSimpleDB_1_1Database.html#a6">~Database</a>() ;
00131   <span class="keyword">protected</span>:
00132   
<a name="l00135"></a><a class="code" href="classSimpleDB_1_1Database.html#p0">00135</a>     SQLHDBC <a class="code" href="classSimpleDB_1_1Database.html#p0">connectionHandle</a>;
00136 
<a name="l00141"></a><a class="code" href="classSimpleDB_1_1Database.html#p1">00141</a>     SQLHENV <a class="code" href="classSimpleDB_1_1Database.html#p1">odbc_environment_handle</a>;
00142   };
00143 
00144 }
00145 
00146 <span class="keyword">inline</span>
00147 std::ostream&amp; operator&lt;&lt;(std::ostream&amp; strm, <span class="keyword">const</span> std::exception &amp;e) {
00148   strm &lt;&lt; <span class="stringliteral">"Database::Exception: "</span> &lt;&lt; e.what();
00149   <span class="keywordflow">return</span> strm;
00150 }
00151 
00152 <span class="preprocessor">#endif</span>
</pre></div><hr>
<div align="right"><small>
Copyright (C) 2005 <a target="top" href="http://www.eminence.com.au">Eminence Technology Pty Ltd</a>.<br>
Documentation pages generated by doxygen.</small><br>
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=129109&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
</div>