2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FIo_DbEnumeratorImpl.h
19 * @brief This is the header file for the %_DbEnumeratorImpl class.
21 * This header file contains declarations of the %_DbEnumeratorImpl class.
24 #ifndef _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
25 #define _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
27 #include <FBaseObject.h>
28 #include <FOspConfig.h>
29 #include <FIoDbTypes.h>
31 #include <FIoDbEnumerator.h>
33 namespace Tizen { namespace Base
40 namespace Tizen { namespace Io
43 class _DbEnumeratorCache;
46 * @class _DbEnumeratorImpl
47 * @brief This class implements the DbEnumerator.
50 * @see Tizen::Io::DbEnumerator
53 class _OSP_EXPORT_ _DbEnumeratorImpl
54 : public Tizen::Base::Object
59 * This is the default constructor for this class.
61 _DbEnumeratorImpl(void);
64 * This is the default destructor for this class.
66 virtual ~_DbEnumeratorImpl(void);
69 * @see DbEnumerator::MoveNext()
71 result MoveNext(void);
74 * @see DbEnumerator::MovePrevious()
76 result MovePrevious(void);
79 * @see DbEnumerator::MoveFirst()
81 result MoveFirst(void);
84 * @see DbEnumerator::MoveLast()
86 result MoveLast(void);
89 * @see DbEnumerator::Reset()
94 * @see DbEnumerator::GetIntAt()
96 result GetIntAt(int columnIndex, int& value) const;
99 * @see DbEnumerator::GetInt64At()
101 result GetInt64At(int columnIndex, long long& value) const;
104 * @see DbEnumerator::GetDoubleAt()
106 result GetDoubleAt(int columnIndex, double& value) const;
109 * @see DbEnumerator::GetStringAt()
111 result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
114 * @see DbEnumerator::GetBlobAt()
116 result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
119 * @see DbEnumerator::GetBlobAt()
121 result GetBlobAt(int columnIndex, void* buffer, int size) const;
124 * @see DbEnumerator::GetDateTimeAt()
126 result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
129 * @see DbEnumerator::GetColumnCount()
131 int GetColumnCount(void) const;
134 * @see DbEnumerator::GetColumnType()
136 DbColumnType GetColumnType(int columnIndex) const;
139 * @see DbEnumerator::GetColumnName()
141 Tizen::Base::String GetColumnName(int columnIndex) const;
144 * @see DbEnumerator::GetColumnSize()
146 int GetColumnSize(int columnIndex) const;
148 static _DbEnumeratorImpl* GetInstance(DbEnumerator& dbEnumerator);
150 static const _DbEnumeratorImpl* GetInstance(const DbEnumerator& dbEnumerator);
152 static DbEnumerator* CreateDbEnumeratorInstanceN(void);
155 _DbEnumeratorImpl(_DbEnumeratorImpl& dbEnumeratorImpl);
157 _DbEnumeratorImpl& operator =(const _DbEnumeratorImpl& dbEnumeratorImpl);
160 * Moves the cursor to the next row and caches the column data.
164 * @return An error code
165 * @param[in] cacheColumnNamesToo Set to @c true to cache the column names, @n
166 * else @c false to ignore caching column names.
167 * @exception E_INVALID_STATE Either of the following conditions has occurred:
168 * - This instance has not been properly constructed.
169 * - The data cache is not initialized.*
170 * @exception E_OUT_OF_RANGE The enumerator has reached out of the result set.
171 * @exception E_OUT_OF_MEMORY The memory is insufficient.
173 result CacheRow(bool cacheColumnNamesToo = false);
176 * Moves the cursor to the position specified by @c rowIndex and caches the column data into @c dbRow.
180 * @return An error code
181 * @param[in,out] dbRow The list of values obtained from the result row.
182 * @param[in] rowIndex The index of a row data to be cached.
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_INVALID_STATE Either of the following conditions has occurred:
185 * - This instance has not been properly constructed.
186 * - The data cache is not initialized.
187 * @exception E_DATABASE The query did not yield any result.
188 * @exception E_OUT_OF_MEMORY The memory is insufficient.
190 result CacheRow(_DbRow& dbRow, int rowIndex);
192 bool __shouldReleaseResource;
202 int __currentRowIndex;
204 _DbEnumeratorCache* __pDbEnumeratorCache;
206 friend class DbEnumerator;
207 friend class _DatabaseImpl;
209 }; // _DbEnumeratorImpl
213 #endif //_FIO_INTERNAL_DBENUMERATOR_IMPL_H_