Merge "Remove build warning and add temporary getter of privacy name" into tizen_2.1
[platform/framework/native/appfw.git] / src / io / inc / FIo_DbEnumeratorImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FIo_DbEnumeratorImpl.h
20  * @brief       This is the header file for the %_DbEnumeratorImpl class.
21  *
22  * This header file contains declarations of the %_DbEnumeratorImpl class.
23  */
24
25 #ifndef _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
26 #define _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
27
28 #include <FBaseObject.h>
29 #include <FOspConfig.h>
30 #include <FIoDbTypes.h>
31
32 #include <FIoDbEnumerator.h>
33
34 namespace Tizen { namespace Base
35 {
36 class String;
37 class ByteBuffer;
38 class DateTime;
39 }}
40
41 namespace Tizen { namespace Io
42 {
43
44 class _DbEnumeratorCache;
45 class _DbRow;
46 /**
47  * @class   _DbEnumeratorImpl
48  * @brief       This class implements the DbEnumerator.
49  * @since 2.1
50  *
51  * @see Tizen::Io::DbEnumerator
52  */
53
54 class _OSP_EXPORT_ _DbEnumeratorImpl
55         : public Tizen::Base::Object
56 {
57
58 public:
59         /**
60         * This is the default constructor for this class.
61         */
62         _DbEnumeratorImpl(void);
63
64         /**
65         * This is the default destructor for this class.
66         */
67         virtual ~_DbEnumeratorImpl(void);
68
69         /**
70         * @see          DbEnumerator::MoveNext()
71         */
72         result MoveNext(void);
73
74         /**
75         * @see          DbEnumerator::MovePrevious()
76         */
77         result MovePrevious(void);
78
79         /**
80         * @see          DbEnumerator::MoveFirst()
81         */
82         result MoveFirst(void);
83
84         /**
85         * @see          DbEnumerator::MoveLast()
86         */
87         result MoveLast(void);
88
89         /**
90         * @see          DbEnumerator::Reset()
91         */
92         result Reset(void);
93
94         /**
95         * @see          DbEnumerator::GetIntAt()
96         */
97         result GetIntAt(int columnIndex, int& value) const;
98
99         /**
100         * @see          DbEnumerator::GetInt64At()
101         */
102         result GetInt64At(int columnIndex, long long& value) const;
103
104         /**
105         * @see          DbEnumerator::GetDoubleAt()
106         */
107         result GetDoubleAt(int columnIndex, double& value) const;
108
109         /**
110         * @see          DbEnumerator::GetStringAt()
111         */
112         result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
113
114         /**
115         * @see          DbEnumerator::GetBlobAt()
116         */
117         result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
118
119         /**
120         * @see          DbEnumerator::GetBlobAt()
121         */
122         result GetBlobAt(int columnIndex, void* buffer, int size) const;
123
124         /**
125         * @see          DbEnumerator::GetDateTimeAt()
126         */
127         result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
128
129         /**
130         * @see          DbEnumerator::GetColumnCount()
131         */
132         int GetColumnCount(void) const;
133
134         /**
135         * @see          DbEnumerator::GetColumnType()
136         */
137         DbColumnType GetColumnType(int columnIndex) const;
138
139         /**
140         * @see          DbEnumerator::GetColumnName()
141         */
142         Tizen::Base::String GetColumnName(int columnIndex) const;
143
144         /**
145         * @see          DbEnumerator::GetColumnSize()
146         */
147         int GetColumnSize(int columnIndex) const;
148
149         static _DbEnumeratorImpl* GetInstance(DbEnumerator& dbEnumerator);
150
151         static const _DbEnumeratorImpl* GetInstance(const DbEnumerator& dbEnumerator);
152
153         static DbEnumerator* CreateDbEnumeratorInstanceN(void);
154
155 private:
156         _DbEnumeratorImpl(_DbEnumeratorImpl& dbEnumeratorImpl);
157
158         _DbEnumeratorImpl& operator =(const _DbEnumeratorImpl& dbEnumeratorImpl);
159
160         /**
161         * Moves the cursor to the next row and caches the column data.
162         *
163         * @since 2.1
164         *
165         * @return               An error code
166         * @param[in]    cacheColumnNamesToo             Set to @c true to cache the column names, @n
167         *                                       else @c false to ignore caching column names.
168         * @exception    E_INVALID_STATE                 Either of the following conditions has occurred:
169         *                                                                               - This instance has not been properly constructed.
170         *                                                                               - The data cache is not initialized.*
171         * @exception    E_OUT_OF_RANGE                  The enumerator has reached out of the result set.
172         * @exception    E_OUT_OF_MEMORY                 The memory is insufficient.
173         */
174         result CacheRow(bool cacheColumnNamesToo = false);
175
176         /**
177         * Moves the cursor to the position specified by @c rowIndex and caches the column data into @c dbRow.
178         *
179         * @since 2.1
180         *
181         * @return                       An error code
182         * @param[in,out]        dbRow                           The list of values obtained from the result row.
183         * @param[in]            rowIndex                        The index of a row data to be cached.
184         * @exception            E_SUCCESS                       The method is successful.
185         * @exception            E_INVALID_STATE         Either of the following conditions has occurred:
186         *                                                                               - This instance has not been properly constructed.
187         *                                                                               - The data cache is not initialized.
188         * @exception            E_DATABASE                      The query did not yield any result.
189         * @exception            E_OUT_OF_MEMORY         The memory is insufficient.
190         */
191         result CacheRow(_DbRow& dbRow, int rowIndex);
192
193         bool __shouldReleaseResource;
194
195         void* __pEnum;
196
197         void* __pDatabase;
198
199         int __columnCount;
200
201         int __rowCount;
202
203         int __currentRowIndex;
204
205         _DbEnumeratorCache* __pDbEnumeratorCache;
206
207         friend class DbEnumerator;
208         friend class _DatabaseImpl;
209
210 }; // _DbEnumeratorImpl
211
212 }} // Tizen::Io
213
214 #endif  //_FIO_INTERNAL_DBENUMERATOR_IMPL_H_
215