2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
\r
4 // Licensed under the Apache License, Version 2.0 (the License);
\r
5 // you may not use this file except in compliance with the License.
\r
6 // You may obtain a copy of the License at
\r
8 // http://www.apache.org/licenses/LICENSE-2.0
\r
10 // Unless required by applicable law or agreed to in writing, software
\r
11 // distributed under the License is distributed on an "AS IS" BASIS,
\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 // See the License for the specific language governing permissions and
\r
14 // limitations under the License.
\r
18 * @file FIoDataSetEnumerator.h
\r
19 * @brief This is the header file for the %DataSetEnumerator class.
\r
21 * This header file contains the declarations of the %DataSetEnumerator class.
\r
24 #ifndef _FIO_DATA_SET_ENUMERATOR_H_
\r
25 #define _FIO_DATA_SET_ENUMERATOR_H_
\r
27 #include <FBaseObject.h>
\r
28 #include <FBaseString.h>
\r
29 #include <FBaseDateTime.h>
\r
30 #include <FIoIDbEnumerator.h>
\r
31 #include <FIoDbTypes.h>
\r
33 namespace Tizen { namespace Base
\r
40 namespace Tizen { namespace Io
\r
44 * @class DataSetEnumerator
\r
45 * @brief This class provides methods for navigating the set of data in in-memory table.
\r
49 * @final This class is not intended for extension.
\r
51 * The %DataSetEnumerator class provides methods for navigating the set of data in in-memory table.
\r
53 * @see Tizen::Io::DataSet
\r
55 class _OSP_EXPORT_ DataSetEnumerator
\r
56 : public Tizen::Base::Object
\r
57 , public Tizen::Io::IDbEnumerator
\r
62 * This destructor overrides Tizen::Base::Object::~Object().
\r
66 virtual ~DataSetEnumerator(void);
\r
69 * Moves the enumerator to the next position.
\r
73 * @return An error code
\r
74 * @exception E_SUCCESS The method is successful.
\r
75 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
76 * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.
\r
77 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
78 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
79 * @exception E_IO Either of the following conditions has occurred: @n
\r
80 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
81 * - %File corruption is detected.
\r
82 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
83 * @remarks After getting this %DataSetEnumerator instance,
\r
84 * if this method is called first, the cursor goes to the first position.
\r
85 * @see Tizen::Io::DataSetEnumerator::MovePrevious()
\r
86 * @see Tizen::Io::DataSetEnumerator::MoveFirst()
\r
87 * @see Tizen::Io::DataSetEnumerator::MoveLast()
\r
89 virtual result MoveNext(void);
\r
93 * Moves the enumerator to the previous position.
\r
97 * @return An error code
\r
98 * @exception E_SUCCESS The method is successful.
\r
99 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
100 * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.
\r
101 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
102 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
103 * @exception E_IO Either of the following conditions has occurred: @n
\r
104 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
105 * - %File corruption is detected.
\r
106 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
107 * @see Tizen::Io::DataSetEnumerator::MoveNext()
\r
108 * @see Tizen::Io::DataSetEnumerator::MoveFirst()
\r
109 * @see Tizen::Io::DataSetEnumerator::MoveLast()
\r
111 virtual result MovePrevious(void);
\r
114 * Moves the enumerator to the first position.
\r
118 * @return An error code
\r
119 * @exception E_SUCCESS The method is successful.
\r
120 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
121 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
122 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
123 * @exception E_IO Either of the following conditions has occurred: @n
\r
124 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
125 * - %File corruption is detected.
\r
126 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
127 * @see Tizen:Io::DataSetEnumerator::MoveNext()
\r
128 * @see Tizen:Io::DataSetEnumerator::MovePrevious()
\r
129 * @see Tizen:Io::DataSetEnumerator::MoveLast()
\r
131 virtual result MoveFirst(void);
\r
134 * Moves the enumerator to the last position.
\r
138 * @return An error code
\r
139 * @exception E_SUCCESS The method is successful.
\r
140 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
141 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
142 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
143 * @exception E_IO Either of the following conditions has occurred: @n
\r
144 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
145 * - %File corruption is detected.
\r
146 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
147 * @see Tizen:Io::DataSetEnumerator::MoveNext()
\r
148 * @see Tizen:Io::DataSetEnumerator::MovePrevious()
\r
149 * @see Tizen:Io::DataSetEnumerator::MoveFirst()
\r
151 virtual result MoveLast(void);
\r
154 * Resets the calling %DataSetEnumerator instance back to its initial state.
\r
158 * @return An error code
\r
159 * @exception E_SUCCESS The method is successful.
\r
160 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
161 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
162 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
163 * @remarks After this method is called, if MoveNext() is called the cursor goes to the first position.
\r
165 virtual result Reset(void);
\r
168 * Gets an @c int value from the column whose index is specified.
\r
172 * @return An error code
\r
173 * @param[in] columnIndex The index of the column whose value is required
\r
174 * @param[in,out] value The integer value obtained from the specified column
\r
175 * @exception E_SUCCESS The method is successful.
\r
176 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
177 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
178 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
180 virtual result GetIntAt(int columnIndex, int& value) const;
\r
183 * Gets a @c long @c long value from the column whose index is specified.
\r
187 * @return An error code
\r
188 * @param[in] columnIndex The index of the column whose value is required
\r
189 * @param[in,out] value The 64-bit integer value obtained from the specified column
\r
190 * @exception E_SUCCESS The method is successful.
\r
191 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
192 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
193 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
195 virtual result GetInt64At(int columnIndex, long long& value) const;
\r
198 * Gets a @c double value from the column whose index is specified.
\r
202 * @return An error code
\r
203 * @param[in] columnIndex The index of the column whose value is required
\r
204 * @param[in,out] value The double value obtained from the specified column
\r
205 * @exception E_SUCCESS The method is successful.
\r
206 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
207 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
208 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
210 virtual result GetDoubleAt(int columnIndex, double& value) const;
\r
213 * Gets a Tizen::Base::String value from the column whose index is specified.
\r
217 * @return An error code
\r
218 * @param[in] columnIndex The index of the column whose value is required
\r
219 * @param[in,out] value The Tizen::Base::String value obtained from the specified column
\r
220 * @exception E_SUCCESS The method is successful.
\r
221 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
222 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
223 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
224 * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.
\r
226 virtual result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
\r
229 * Gets a Tizen::Base::ByteBuffer value from the column whose index is specified.
\r
233 * @return An error code
\r
234 * @param[in] columnIndex The index of the column whose value is required
\r
235 * @param[in,out] value The Tizen::Base::ByteBuffer value obtained from the specified column @n
\r
236 * The %Tizen::Base::ByteBuffer will be filled from the current position and data copy
\r
237 * will be continued until %Tizen::Base::ByteBuffer limitation is reached or no more
\r
238 * blob data remains.
\r
239 * @exception E_SUCCESS The method is successful.
\r
240 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
241 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
242 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
243 * @exception E_OVERFLOW The specified Tizen::Base::ByteBuffer @c value is insufficient to save the data.
\r
244 * @see Tizen::Base::ByteBuffer
\r
246 virtual result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
\r
249 * Gets a blob data from the column whose index is specified.
\r
253 * @return An error code
\r
254 * @param[in] columnIndex The index of the column whose value is required
\r
255 * @param[in,out] buffer The user-provided buffer used to receive the blob data
\r
256 * @param[in] size The maximum buffer length in bytes
\r
257 * @exception E_SUCCESS The method is successful.
\r
258 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
259 * @exception E_INVALID_ARG Either the specified @c columnIndex is out of range or the specified @c size is invalid.
\r
260 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
261 * @exception E_OVERFLOW The specified @c buffer is insufficient to save the data.
\r
263 virtual result GetBlobAt(int columnIndex, void* buffer, int size) const;
\r
266 * Gets a Tizen::Base::DateTime value from the column whose index is specified.
\r
270 * @return An error code
\r
271 * @param[in] columnIndex The index of the column whose value is required
\r
272 * @param[in,out] value The Tizen::Base::DateTime value obtained from the specified column
\r
273 * @exception E_SUCCESS The method is successful.
\r
274 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
275 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
276 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
277 * @exception E_INVALID_FORMAT The date is not correctly formatted, or the method is trying to access column of type String. @n
\r
278 * The date format should be 'mm/dd/yyyy hh:mm:ss'.
\r
279 * @exception E_OUT_OF_RANGE Either the year, month, day, hour, minute, or second value is out of range,
\r
280 * or the method is trying to access a column of type String.
\r
282 virtual result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
\r
285 * Gets the number of columns for this enumerator.
\r
289 * @return The number of columns in the calling enumerator, @n
\r
290 * else @c -1 if an exception occurs
\r
291 * @exception E_SUCCESS The method is successful.
\r
292 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
293 * @remarks This method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
294 * The specific error code can be accessed using the GetLastResult() method.
\r
296 virtual int GetColumnCount(void) const;
\r
299 * Gets the type of the column indicated by a specified index.
\r
303 * @return The type of column, @n
\r
304 * else @c DB_COLUMNTYPE_UNDEFINED if an exception occurs
\r
305 * @param[in] columnIndex The index of the destination column
\r
306 * @exception E_SUCCESS The method is successful.
\r
307 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
308 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
309 * @remarks This method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
310 * Currently, @c DB_COLUMNTYPE_INT is returned for a 64-bit integer. @n
\r
311 * The specific error code can be accessed using the GetLastResult() method.
\r
313 virtual DbColumnType GetColumnType(int columnIndex) const;
\r
316 * Gets the name of the column indicated by a specified index.
\r
320 * @return The name of the column, @n
\r
321 * else an empty string if an exception occurs
\r
322 * @param[in] columnIndex The index of the destination column
\r
323 * @exception E_SUCCESS The method is successful.
\r
324 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
325 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
326 * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.
\r
327 * @remarks This method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
328 * The specific error code can be accessed using the GetLastResult() method.
\r
330 virtual Tizen::Base::String GetColumnName(int columnIndex) const;
\r
333 * Gets the size of data in bytes.
\r
337 * @return The size of the data in bytes, @n
\r
338 * else @c -1 if an exception occurs
\r
339 * @param[in] columnIndex The index of the destination column
\r
340 * @exception E_SUCCESS The method is successful.
\r
341 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
342 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
343 * @remarks This method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
344 * If the destination column is of type String, this method returns the @c byte length excluding
\r
345 * the @c null terminator character. @n
\r
346 * The specific error code can be accessed using the GetLastResult() method.
\r
348 virtual int GetColumnSize(int columnIndex) const;
\r
352 // This default constructor is intentionally declared as private so that only the platform can create an instance.
\r
356 DataSetEnumerator(void);
\r
359 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
\r
363 DataSetEnumerator(const DataSetEnumerator& rhs);
\r
366 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
\r
369 DataSetEnumerator& operator =(const DataSetEnumerator& rhs);
\r
371 class _DataSetEnumeratorImpl* __pDataSetEnumeratorImpl;
\r
372 friend class _DataSetEnumeratorImpl;
\r
374 }; // DataSetEnumerator
\r
378 #endif // _FIO_DATA_SET_ENUMERATOR_H_
\r