ClanLib  2.3.7
db_reader.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "api_database.h"
35 
36 class CL_DBValue;
37 class CL_DateTime;
38 class CL_DataBuffer;
39 class CL_DBConnection;
41 class CL_DBReader_Impl;
42 
47 {
50 public:
52  CL_DBReader();
53 
57  CL_DBReader(const CL_SharedPtr<CL_DBReader_Impl> &impl);
58 
59  ~CL_DBReader();
61 
64 public:
66  int get_column_count() const;
67 
69  CL_String get_column_name(int index) const;
70 
72  int get_name_index(const CL_StringRef &name) const;
73 
75  CL_DBValue get_column_value(int index) const;
76 
78  CL_DBValue get_column_value(const CL_StringRef &name) const;
79 
81  CL_String get_column_string(int index) const;
82 
84  bool get_column_bool(int index) const;
85 
87  int get_column_int(int index) const;
88 
90  double get_column_double(int index) const;
91 
93  CL_DateTime get_column_datetime(int index) const;
94 
96  CL_DataBuffer get_column_binary(int index) const;
97 
99  CL_String get_column_string(const CL_StringRef &column_name) const;
100 
102  bool get_column_bool(const CL_StringRef &column_name) const;
103 
105  int get_column_int(const CL_StringRef &column_name) const;
106 
108  double get_column_double(const CL_StringRef &column_name) const;
109 
111  CL_DateTime get_column_datetime(const CL_StringRef &column_name) const;
112 
114  CL_DataBuffer get_column_binary(const CL_StringRef &column_name) const;
115 
117  CL_DBReaderProvider *get_provider();
119 
122 public:
125  bool retrieve_row();
126 
128  void close();
130 
133 private:
134  CL_SharedPtr<CL_DBReader_Impl> impl;
135 
137 };
138