2 // Open Service Platform
\r
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Apache License, Version 2.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.apache.org/licenses/LICENSE-2.0
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an "AS IS" BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
19 * @file FIoDataSetEnumerator.h
\r
20 * @brief This is the header file for the %DataSetEnumerator class.
\r
22 * This header file contains the declarations of the %DataSetEnumerator class.
\r
25 #ifndef _FIO_DATA_SET_ENUMERATOR_H_
\r
26 #define _FIO_DATA_SET_ENUMERATOR_H_
\r
28 #include <FBaseObject.h>
\r
29 #include <FBaseString.h>
\r
30 #include <FBaseDateTime.h>
\r
31 #include <FIoIDbEnumerator.h>
\r
32 #include <FIoDbTypes.h>
\r
34 namespace Tizen { namespace Base
\r
41 namespace Tizen { namespace Io
\r
45 * @class DataSetEnumerator
\r
46 * @brief This class provides methods for navigating the set of data in in-memory table.
\r
50 * @final This class is not intended for extension.
\r
52 * The %DataSetEnumerator class provides methods for navigating the set of data in in-memory table.
\r
54 * @see Tizen::Io::DataSet
\r
56 class _OSP_EXPORT_ DataSetEnumerator
\r
57 : public Tizen::Base::Object
\r
58 , public Tizen::Io::IDbEnumerator
\r
63 * This destructor overrides Tizen::Base::Object::~Object().
\r
67 virtual ~DataSetEnumerator(void);
\r
70 * Moves the enumerator to the next position.
\r
74 * @return An error code
\r
75 * @exception E_SUCCESS The method is successful.
\r
76 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
77 * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.
\r
78 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
79 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
80 * @exception E_IO Either of the following conditions has occurred: @n
\r
81 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
82 * - %File corruption is detected.
\r
83 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
84 * @remarks After getting this DataSetEnumerator instance,
\r
85 * if MoveNext() is called at first, the cursor goes to the first position.
\r
86 * @see Tizen::Io::DataSetEnumerator::MovePrevious()
\r
87 * @see Tizen::Io::DataSetEnumerator::MoveFirst()
\r
88 * @see Tizen::Io::DataSetEnumerator::MoveLast()
\r
90 virtual result MoveNext(void);
\r
94 * Moves the enumerator to the previous position.
\r
98 * @return An error code
\r
99 * @exception E_SUCCESS The method is successful.
\r
100 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
101 * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.
\r
102 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
103 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
104 * @exception E_IO Either of the following conditions has occurred: @n
\r
105 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
106 * - %File corruption is detected.
\r
107 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
108 * @see Tizen::Io::DataSetEnumerator::MoveNext()
\r
109 * @see Tizen::Io::DataSetEnumerator::MoveFirst()
\r
110 * @see Tizen::Io::DataSetEnumerator::MoveLast()
\r
112 virtual result MovePrevious(void);
\r
115 * Moves the enumerator to the first position.
\r
119 * @return An error code
\r
120 * @exception E_SUCCESS The method is successful.
\r
121 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
122 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
123 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
124 * @exception E_IO Either of the following conditions has occurred: @n
\r
125 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
126 * - %File corruption is detected.
\r
127 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
128 * @see Tizen:Io::DataSetEnumerator::MoveNext()
\r
129 * @see Tizen:Io::DataSetEnumerator::MovePrevious()
\r
130 * @see Tizen:Io::DataSetEnumerator::MoveLast()
\r
132 virtual result MoveFirst(void);
\r
135 * Moves the enumerator to the last position.
\r
139 * @return An error code
\r
140 * @exception E_SUCCESS The method is successful.
\r
141 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
142 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
143 * @exception E_INVALID_FORMAT The in-memory data is malformed.
\r
144 * @exception E_IO Either of the following conditions has occurred: @n
\r
145 * - An unexpected device failure has occurred as the media ejected suddenly. @n
\r
146 * - %File corruption is detected.
\r
147 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
148 * @see Tizen:Io::DataSetEnumerator::MoveNext()
\r
149 * @see Tizen:Io::DataSetEnumerator::MovePrevious()
\r
150 * @see Tizen:Io::DataSetEnumerator::MoveFirst()
\r
152 virtual result MoveLast(void);
\r
155 * Resets the calling %DataSetEnumerator instance back to its initial state.
\r
159 * @return An error code
\r
160 * @exception E_SUCCESS The method is successful.
\r
161 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
162 * @exception E_OBJECT_LOCKED The DataSet instance is locked.
\r
163 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
\r
164 * @remarks After this method is called, if MoveNext() is called the cursor goes to the first position.
\r
166 virtual result Reset(void);
\r
169 * Gets an @c int value from the column whose index is specified.
\r
173 * @return An error code
\r
174 * @param[in] columnIndex The index of the column whose value is required
\r
175 * @param[in,out] value The integer value obtained from the specified column
\r
176 * @exception E_SUCCESS The method is successful.
\r
177 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
178 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
179 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
181 virtual result GetIntAt(int columnIndex, int& value) const;
\r
184 * Gets a @c long @c long value from the column whose index is specified.
\r
188 * @return An error code
\r
189 * @param[in] columnIndex The index of the column whose value is required
\r
190 * @param[in,out] value The 64-bit integer value obtained from the specified column
\r
191 * @exception E_SUCCESS The method is successful.
\r
192 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
193 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
194 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
196 virtual result GetInt64At(int columnIndex, long long& value) const;
\r
199 * Gets a @c double value from the column whose index is specified.
\r
203 * @return An error code
\r
204 * @param[in] columnIndex The index of the column whose value is required
\r
205 * @param[in,out] value The double value obtained from the specified column
\r
206 * @exception E_SUCCESS The method is successful.
\r
207 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
208 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
209 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
211 virtual result GetDoubleAt(int columnIndex, double& value) const;
\r
214 * Gets a @c String value from the column whose index is specified.
\r
218 * @return An error code
\r
219 * @param[in] columnIndex The index of the column whose value is required
\r
220 * @param[in,out] value The String value obtained from the specified column
\r
221 * @exception E_SUCCESS The method is successful.
\r
222 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
223 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
224 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
225 * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.
\r
227 virtual result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
\r
230 * Gets a @c ByteBuffer value from the column whose index is specified.
\r
234 * @return An error code
\r
235 * @param[in] columnIndex The index of the column whose value is required
\r
236 * @param[in,out] value The ByteBuffer value obtained from the specified column @n
\r
237 * The ByteBuffer will be filled from the current position and data copy
\r
238 * will be continued until ByteBuffer limitation is reached or no more
\r
239 * blob data remains. @n
\r
240 * @exception E_SUCCESS The method is successful.
\r
241 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
243 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
244 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
245 * @exception E_OVERFLOW The specified ByteBuffer @c value is insufficient to save the data.
\r
246 * @see Tizen::Base::ByteBuffer
\r
248 virtual result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
\r
251 * Gets a blob data from the column whose index is specified.
\r
255 * @return An error code
\r
256 * @param[in] columnIndex The index of the column whose value is required
\r
257 * @param[in,out] buffer The user-provided buffer used to receive the blob data @n
\r
258 * @param[in] size The maximum buffer length in bytes
\r
259 * @exception E_SUCCESS The method is successful.
\r
260 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
261 * @exception E_INVALID_ARG The specified @c columnIndex is out of range, or the specified @c size is invalid.
\r
262 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
263 * @exception E_OVERFLOW The specified @c buffer is insufficient to save the data.
\r
265 virtual result GetBlobAt(int columnIndex, void* buffer, int size) const;
\r
268 * Gets a @c DateTime value from the column whose index is specified.
\r
272 * @return An error code
\r
273 * @param[in] columnIndex The index of the column whose value is required
\r
274 * @param[in,out] value The DateTime value obtained from the specified column
\r
275 * @exception E_SUCCESS The method is successful.
\r
276 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
277 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
278 * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.
\r
279 * @exception E_INVALID_FORMAT The date is not correctly formatted, or the method is trying to access column of type String. @n
\r
280 * The date format should be 'mm/dd/yyyy hh:mm:ss'.
\r
281 * @exception E_OUT_OF_RANGE Either the year, month, day, hour, minute, or second value is out of range,
\r
282 * or the method is trying to access a column of type String.
\r
284 virtual result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
\r
287 * Gets the number of columns for this enumerator.
\r
291 * @return The number of columns in the calling enumerator, @n
\r
292 * else @c -1 if an exception occurs
\r
293 * @exception E_SUCCESS The method is successful.
\r
294 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
295 * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
296 * The specific error code can be accessed using the GetLastResult() method.
\r
298 virtual int GetColumnCount(void) const;
\r
301 * Gets the type of the column indicated by the specified index.
\r
305 * @return The type of column, @n
\r
306 * else DB_COLUMNTYPE_UNDEFINED if an exception occurs
\r
307 * @param[in] columnIndex The index of the destination column
\r
308 * @exception E_SUCCESS The method is successful.
\r
309 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
310 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
311 * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
312 * Currently, DB_COLUMNTYPE_INT is returned for a 64-bit integer. @n
\r
313 * The specific error code can be accessed using the GetLastResult() method.
\r
315 virtual DbColumnType GetColumnType(int columnIndex) const;
\r
318 * Gets the name of the column indicated by the specified index.
\r
322 * @return The name of the column, @n
\r
323 * else an empty string if an exception occurs
\r
324 * @param[in] columnIndex The index of the destination column
\r
325 * @exception E_SUCCESS The method is successful.
\r
326 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
327 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
328 * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.
\r
329 * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
330 * The specific error code can be accessed using the GetLastResult() method.
\r
332 virtual Tizen::Base::String GetColumnName(int columnIndex) const;
\r
335 * Gets the size of data in bytes.
\r
339 * @return The size of the data in bytes, @n
\r
340 * else @c -1 if an exception occurs
\r
341 * @param[in] columnIndex The index of the destination column
\r
342 * @exception E_SUCCESS The method is successful.
\r
343 * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.
\r
344 * @exception E_INVALID_ARG The specified @c columnIndex is out of range.
\r
345 * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n
\r
346 * If the destination column is of type String, this method returns the @c byte length excluding
\r
347 * the @c null terminator character. @n
\r
348 * The specific error code can be accessed using the GetLastResult() method.
\r
350 virtual int GetColumnSize(int columnIndex) const;
\r
354 // This default constructor is intentionally declared as private so that only the platform can create an instance.
\r
358 DataSetEnumerator(void);
\r
361 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
\r
365 DataSetEnumerator(const DataSetEnumerator& rhs);
\r
368 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
\r
371 DataSetEnumerator& operator =(const DataSetEnumerator& rhs);
\r
373 class _DataSetEnumeratorImpl* __pDataSetEnumeratorImpl;
\r
374 friend class _DataSetEnumeratorImpl;
\r
376 }; // DataSetEnumerator
\r
380 #endif // _FIO_DATA_SET_ENUMERATOR_H_
\r