2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FIo_DbEnumeratorImpl.h
20 * @brief This is the header file for the %_DbEnumeratorImpl class.
22 * This header file contains declarations of the %_DbEnumeratorImpl class.
25 #ifndef _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
26 #define _FIO_INTERNAL_DBENUMERATOR_IMPL_H_
28 #include <FBaseObject.h>
29 #include <FOspConfig.h>
30 #include <FIoDbTypes.h>
32 #include <FIoDbEnumerator.h>
34 namespace Tizen { namespace Base
41 namespace Tizen { namespace Io
44 class _DbEnumeratorCache;
47 * @class _DbEnumeratorImpl
48 * @brief This class implements the DbEnumerator.
51 * @see Tizen::Io::DbEnumerator
54 class _OSP_EXPORT_ _DbEnumeratorImpl
55 : public Tizen::Base::Object
60 * This is the default constructor for this class.
62 _DbEnumeratorImpl(void);
65 * This is the default destructor for this class.
67 virtual ~_DbEnumeratorImpl(void);
70 * @see DbEnumerator::MoveNext()
72 result MoveNext(void);
75 * @see DbEnumerator::MovePrevious()
77 result MovePrevious(void);
80 * @see DbEnumerator::MoveFirst()
82 result MoveFirst(void);
85 * @see DbEnumerator::MoveLast()
87 result MoveLast(void);
90 * @see DbEnumerator::Reset()
95 * @see DbEnumerator::GetIntAt()
97 result GetIntAt(int columnIndex, int& value) const;
100 * @see DbEnumerator::GetInt64At()
102 result GetInt64At(int columnIndex, long long& value) const;
105 * @see DbEnumerator::GetDoubleAt()
107 result GetDoubleAt(int columnIndex, double& value) const;
110 * @see DbEnumerator::GetStringAt()
112 result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
115 * @see DbEnumerator::GetBlobAt()
117 result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
120 * @see DbEnumerator::GetBlobAt()
122 result GetBlobAt(int columnIndex, void* buffer, int size) const;
125 * @see DbEnumerator::GetDateTimeAt()
127 result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
130 * @see DbEnumerator::GetColumnCount()
132 int GetColumnCount(void) const;
135 * @see DbEnumerator::GetColumnType()
137 DbColumnType GetColumnType(int columnIndex) const;
140 * @see DbEnumerator::GetColumnName()
142 Tizen::Base::String GetColumnName(int columnIndex) const;
145 * @see DbEnumerator::GetColumnSize()
147 int GetColumnSize(int columnIndex) const;
149 static _DbEnumeratorImpl* GetInstance(DbEnumerator& dbEnumerator);
151 static const _DbEnumeratorImpl* GetInstance(const DbEnumerator& dbEnumerator);
153 static DbEnumerator* CreateDbEnumeratorInstanceN(void);
156 _DbEnumeratorImpl(_DbEnumeratorImpl& dbEnumeratorImpl);
158 _DbEnumeratorImpl& operator =(const _DbEnumeratorImpl& dbEnumeratorImpl);
161 * Moves the cursor to the next row and caches the column data.
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.
174 result CacheRow(bool cacheColumnNamesToo = false);
177 * Moves the cursor to the position specified by @c rowIndex and caches the column data into @c dbRow.
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.
191 result CacheRow(_DbRow& dbRow, int rowIndex);
193 bool __shouldReleaseResource;
203 int __currentRowIndex;
205 _DbEnumeratorCache* __pDbEnumeratorCache;
207 friend class DbEnumerator;
208 friend class _DatabaseImpl;
210 }; // _DbEnumeratorImpl
214 #endif //_FIO_INTERNAL_DBENUMERATOR_IMPL_H_