--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataRow.h\r
+* @brief This is the header file for the %DataRow class.\r
+*\r
+* This header file contains the declarations of the %DataRow class.\r
+*/\r
+\r
+#ifndef _FIO_DATA_ROW_H_\r
+#define _FIO_DATA_ROW_H_\r
+\r
+#include <FBaseObject.h>\r
+#include <FBaseByteBuffer.h>\r
+#include <FBaseDateTime.h>\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+\r
+/**\r
+* @class DataRow\r
+\r
+* @brief This class provides methods to create a row in in-memory table.\r
+*\r
+* @since 2.1\r
+*\r
+* @final This class is not intended for extension.\r
+*\r
+* The %DataRow class provides methods to create a row in in-memory table.\r
+*\r
+* @see Tizen::Io::DataSet\r
+*/\r
+class _OSP_EXPORT_ DataRow\r
+ : public Tizen::Base::Object\r
+{\r
+\r
+public:\r
+ /**\r
+ * This destructor overrides Tizen::Base::Object::~Object().\r
+ *\r
+ * @since 2.1\r
+ */\r
+ virtual ~DataRow(void);\r
+\r
+ /**\r
+ * Sets a @c ByteBuffer value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] pValue The value to set @n\r
+ * The specified @c pValue is pointer to user-provided @c ByteBuffer type buffer.\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG Either of the following conditions has occurred: @n\r
+ * - The specified @c columnIndex is out of range.\r
+ * - The specified @c pValue is null.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ * @remarks This method performs a shallow copy. It copies only the pointer; not the element itself. @n\r
+ * The platform will take the ownership of @c pValue after calling this method.\r
+ */\r
+ result SetBlobAt(int columnIndex, Tizen::Base::ByteBuffer* pValue);\r
+\r
+\r
+ /**\r
+ * Sets a @c DateTime value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] value The value to set\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ result SetDateTimeAt(int columnIndex, const Tizen::Base::DateTime& value);\r
+\r
+\r
+ /**\r
+ * Sets a @c double value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] value The value to set\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ result SetDoubleAt(int columnIndex, double value);\r
+\r
+ /**\r
+ * Sets an @c int value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] value The value to set\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ result SetIntAt(int columnIndex, int value);\r
+\r
+ /**\r
+ * Sets a @c long @c long value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] value The value to set\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ result SetInt64At(int columnIndex, long long value);\r
+\r
+ /**\r
+ * Sets a @c String value to the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is set @n\r
+ * The column index starts from 0.\r
+ * @param[in] value The value to set\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ result SetStringAt(int columnIndex, const Tizen::Base::String& value);\r
+\r
+private:\r
+ //\r
+ // This default constructor is intentionally declared as private so that only the platform can create an instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataRow(void);\r
+\r
+ //\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataRow(const DataRow& rhs);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataRow& operator =(const DataRow& rhs);\r
+\r
+ class _DataRowImpl* __pDataRowImpl;\r
+ friend class _DataRowImpl;\r
+\r
+}; // DataRow\r
+\r
+}} // Tizen::Io\r
+\r
+#endif // _FIO_DATA_ROW_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataSet.h\r
+* @brief This is the header file for the %DataSet class.\r
+*\r
+* This header file contains the declarations of the %DataSet class.\r
+*/\r
+\r
+#ifndef _FIO_DATA_SET_H_\r
+#define _FIO_DATA_SET_H_\r
+\r
+#include <FBaseObject.h>\r
+#include <FBaseColIList.h>\r
+#include <FIoDataRow.h>\r
+#include <FIoDataSetEnumerator.h>\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+\r
+/**\r
+* @class DataSet\r
+* @brief This class provides methods to manipulate in-memory table.\r
+*\r
+* @since 2.1\r
+*\r
+* @final This class is not intended for extension.\r
+*\r
+* The %DataSet class provides methods to manipulate in-memory table.\r
+*/\r
+class _OSP_EXPORT_ DataSet\r
+ : public Tizen::Base::Object\r
+{\r
+\r
+public:\r
+ /**\r
+ * The object is not fully constructed after this constructor is called. For full construction,\r
+ * the Construct() method must be called right after calling this constructor.\r
+ *\r
+ * @since 2.1\r
+ */\r
+ DataSet(void);\r
+\r
+ /**\r
+ * This destructor overrides Tizen::Base::Object::~Object().\r
+ *\r
+ * @since 2.1\r
+ */\r
+ virtual ~DataSet(void);\r
+\r
+ /**\r
+ * Creates in-memory table.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnNames The list of column name to create @n\r
+ * The object type in the specified list should be String.\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_ARG The specified @c columnNames has no element.\r
+ */\r
+ result Construct(const Tizen::Base::Collection::IList& columnNames);\r
+\r
+ /**\r
+ * Creates a row in the table.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return A pointer to the DataRow instance, @n\r
+ * else @c null if the memory is insufficient\r
+ * @remarks The column type is decided by the type of each element inserted in first row.\r
+ * If a specific column element on the first row is not inserted, then the column's type is DB_COLUMNTYPE_NULL\r
+ * On that case, when a new column element is added later,\r
+ * then the column's type will be changed according to the new element.\r
+ */\r
+ DataRow* CreateDataRowN(void);\r
+\r
+ /**\r
+ * Gets table enumerator.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return A pointer to the DataSetEnumerator instance, @n\r
+ * else @c null if the memory is insufficient\r
+ */\r
+ DataSetEnumerator* GetDataSetEnumeratorN(void);\r
+\r
+\r
+ /**\r
+ * Get copy of this instance.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return A pointer to the copy of the DataSet instance, @n\r
+\r
+ * else @c null if the memory is insufficient\r
+ */\r
+ DataSet* CloneN(void) const;\r
+\r
+ /**\r
+ * Checks whether the value of the specified instance of Object is equal to the value of the current instance of\r
+ * %DataSet.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return @c true if the value of the specified instance of Object is equal to the value of the current\r
+ * instance of %DataSet, @n\r
+ * else @c false\r
+ * @param[in] obj An instance of Object to compare\r
+ * @remarks The method returns @c false if the specified @c obj is not a %DataSet instance.\r
+ */\r
+ virtual bool Equals(const Tizen::Base::Object& obj) const;\r
+\r
+ /**\r
+ * Gets the hash value of the current instance.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The hash value of the current instance\r
+ */\r
+ virtual int GetHashCode(void) const;\r
+\r
+private:\r
+ //\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.1\r
+ //\r
+\r
+ DataSet(const DataSet& value);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataSet& operator =(const DataSet& rhs);\r
+\r
+ class _DataSetImpl* __pDataSetImpl;\r
+ friend class _DataSetImpl;\r
+\r
+}; // DataSet\r
+\r
+}} // Tizen::Io\r
+\r
+#endif // _FIO_DATA_SET_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataSetEnumerator.h\r
+* @brief This is the header file for the %DataSetEnumerator class.\r
+*\r
+* This header file contains the declarations of the %DataSetEnumerator class.\r
+*/\r
+\r
+#ifndef _FIO_DATA_SET_ENUMERATOR_H_\r
+#define _FIO_DATA_SET_ENUMERATOR_H_\r
+\r
+#include <FBaseObject.h>\r
+#include <FBaseString.h>\r
+#include <FBaseDateTime.h>\r
+#include <FIoIDbEnumerator.h>\r
+#include <FIoDbTypes.h>\r
+\r
+namespace Tizen { namespace Base\r
+{\r
+class String;\r
+class ByteBuffer;\r
+class DateTime;\r
+}}\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+\r
+/**\r
+* @class DataSetEnumerator\r
+* @brief This class provides methods for navigating the set of data in in-memory table.\r
+*\r
+* @since 2.1\r
+*\r
+* @final This class is not intended for extension.\r
+*\r
+* The %DataSetEnumerator class provides methods for navigating the set of data in in-memory table.\r
+*\r
+* @see Tizen::Io::DataSet\r
+*/\r
+class _OSP_EXPORT_ DataSetEnumerator\r
+ : public Tizen::Base::Object\r
+ , public Tizen::Io::IDbEnumerator\r
+{\r
+\r
+public:\r
+ /**\r
+ * This destructor overrides Tizen::Base::Object::~Object().\r
+ *\r
+ * @since 2.1\r
+ */\r
+ virtual ~DataSetEnumerator(void);\r
+\r
+ /**\r
+ * Moves the enumerator to the next position.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.\r
+ * @exception E_OBJECT_LOCKED The DataSet instance is locked.\r
+ * @exception E_INVALID_FORMAT The in-memory data is malformed.\r
+ * @exception E_IO Either of the following conditions has occurred: @n\r
+ * - An unexpected device failure has occurred as the media ejected suddenly. @n\r
+ * - %File corruption is detected.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @remarks After getting this DataSetEnumerator instance,\r
+ * if MoveNext() is called at first, the cursor goes to the first position.\r
+ * @see Tizen::Io::DataSetEnumerator::MovePrevious()\r
+ * @see Tizen::Io::DataSetEnumerator::MoveFirst()\r
+ * @see Tizen::Io::DataSetEnumerator::MoveLast()\r
+ */\r
+ virtual result MoveNext(void);\r
+\r
+\r
+ /**\r
+ * Moves the enumerator to the previous position.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_OUT_OF_RANGE The enumerator has reached out of the data set.\r
+ * @exception E_OBJECT_LOCKED The DataSet instance is locked.\r
+ * @exception E_INVALID_FORMAT The in-memory data is malformed.\r
+ * @exception E_IO Either of the following conditions has occurred: @n\r
+ * - An unexpected device failure has occurred as the media ejected suddenly. @n\r
+ * - %File corruption is detected.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @see Tizen::Io::DataSetEnumerator::MoveNext()\r
+ * @see Tizen::Io::DataSetEnumerator::MoveFirst()\r
+ * @see Tizen::Io::DataSetEnumerator::MoveLast()\r
+ */\r
+ virtual result MovePrevious(void);\r
+\r
+ /**\r
+ * Moves the enumerator to the first position.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_OBJECT_LOCKED The DataSet instance is locked.\r
+ * @exception E_INVALID_FORMAT The in-memory data is malformed.\r
+ * @exception E_IO Either of the following conditions has occurred: @n\r
+ * - An unexpected device failure has occurred as the media ejected suddenly. @n\r
+ * - %File corruption is detected.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @see Tizen:Io::DataSetEnumerator::MoveNext()\r
+ * @see Tizen:Io::DataSetEnumerator::MovePrevious()\r
+ * @see Tizen:Io::DataSetEnumerator::MoveLast()\r
+ */\r
+ virtual result MoveFirst(void);\r
+\r
+ /**\r
+ * Moves the enumerator to the last position.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_OBJECT_LOCKED The DataSet instance is locked.\r
+ * @exception E_INVALID_FORMAT The in-memory data is malformed.\r
+ * @exception E_IO Either of the following conditions has occurred: @n\r
+ * - An unexpected device failure has occurred as the media ejected suddenly. @n\r
+ * - %File corruption is detected.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @see Tizen:Io::DataSetEnumerator::MoveNext()\r
+ * @see Tizen:Io::DataSetEnumerator::MovePrevious()\r
+ * @see Tizen:Io::DataSetEnumerator::MoveFirst()\r
+ */\r
+ virtual result MoveLast(void);\r
+\r
+ /**\r
+ * Resets the calling %DataSetEnumerator instance back to its initial state.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_OBJECT_LOCKED The DataSet instance is locked.\r
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.\r
+ * @remarks After this method is called, if MoveNext() is called the cursor goes to the first position.\r
+ */\r
+ virtual result Reset(void);\r
+\r
+ /**\r
+ * Gets an @c int value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The integer value obtained from the specified column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ virtual result GetIntAt(int columnIndex, int& value) const;\r
+\r
+ /**\r
+ * Gets a @c long @c long value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The 64-bit integer value obtained from the specified column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ virtual result GetInt64At(int columnIndex, long long& value) const;\r
+\r
+ /**\r
+ * Gets a @c double value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The double value obtained from the specified column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ */\r
+ virtual result GetDoubleAt(int columnIndex, double& value) const;\r
+\r
+ /**\r
+ * Gets a @c String value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The String value obtained from the specified column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.\r
+ */\r
+ virtual result GetStringAt(int columnIndex, Tizen::Base::String& value) const;\r
+\r
+ /**\r
+ * Gets a @c ByteBuffer value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The ByteBuffer value obtained from the specified column @n\r
+ * The ByteBuffer will be filled from the current position and data copy\r
+ * will be continued until ByteBuffer limitation is reached or no more\r
+ * blob data remains. @n\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ * @exception E_OVERFLOW The specified ByteBuffer @c value is insufficient to save the data.\r
+ * @see Tizen::Base::ByteBuffer\r
+ */\r
+ virtual result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;\r
+\r
+ /**\r
+ * Gets a blob data from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] buffer The user-provided buffer used to receive the blob data @n\r
+ * @param[in] size The maximum buffer length in bytes\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range, or the specified @c size is invalid.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ * @exception E_OVERFLOW The specified @c buffer is insufficient to save the data.\r
+ */\r
+ virtual result GetBlobAt(int columnIndex, void* buffer, int size) const;\r
+\r
+ /**\r
+ * Gets a @c DateTime value from the column whose index is specified.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return An error code\r
+ * @param[in] columnIndex The index of the column whose value is required\r
+ * @param[in,out] value The DateTime value obtained from the specified column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_TYPE_MISMATCH The operation has attempted to access columns of different types.\r
+ * @exception E_INVALID_FORMAT The date is not correctly formatted, or the method is trying to access column of type String. @n\r
+ * The date format should be 'mm/dd/yyyy hh:mm:ss'.\r
+ * @exception E_OUT_OF_RANGE Either the year, month, day, hour, minute, or second value is out of range,\r
+ * or the method is trying to access a column of type String.\r
+ */\r
+ virtual result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;\r
+\r
+ /**\r
+ * Gets the number of columns for this enumerator.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The number of columns in the calling enumerator, @n\r
+ * else @c -1 if an exception occurs\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n\r
+ * The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ virtual int GetColumnCount(void) const;\r
+\r
+ /**\r
+ * Gets the type of the column indicated by the specified index.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The type of column, @n\r
+ * else DB_COLUMNTYPE_UNDEFINED if an exception occurs\r
+ * @param[in] columnIndex The index of the destination column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n\r
+ * Currently, DB_COLUMNTYPE_INT is returned for a 64-bit integer. @n\r
+ * The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ virtual DbColumnType GetColumnType(int columnIndex) const;\r
+\r
+ /**\r
+ * Gets the name of the column indicated by the specified index.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The name of the column, @n\r
+ * else an empty string if an exception occurs\r
+ * @param[in] columnIndex The index of the destination column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @exception E_INVALID_ENCODING_RANGE The string conversion has failed due to invalid encoding range.\r
+ * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n\r
+ * The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ virtual Tizen::Base::String GetColumnName(int columnIndex) const;\r
+\r
+ /**\r
+ * Gets the size of data in bytes.\r
+ *\r
+ * @since 2.1\r
+ *\r
+ * @return The size of the data in bytes, @n\r
+ * else @c -1 if an exception occurs\r
+ * @param[in] columnIndex The index of the destination column\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_INVALID_STATE The DataSet instance associated with this instance is deleted.\r
+ * @exception E_INVALID_ARG The specified @c columnIndex is out of range.\r
+ * @remarks The method must be called after MoveNext(), MoveFirst(), or MoveLast(). @n\r
+ * If the destination column is of type String, this method returns the @c byte length excluding\r
+ * the @c null terminator character. @n\r
+ * The specific error code can be accessed using the GetLastResult() method.\r
+ */\r
+ virtual int GetColumnSize(int columnIndex) const;\r
+\r
+private:\r
+ //\r
+ // This default constructor is intentionally declared as private so that only the platform can create an instance.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataSetEnumerator(void);\r
+\r
+ //\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.1\r
+ //\r
+ DataSetEnumerator(const DataSetEnumerator& rhs);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ // @since 2.1\r
+ //\r
+ DataSetEnumerator& operator =(const DataSetEnumerator& rhs);\r
+\r
+ class _DataSetEnumeratorImpl* __pDataSetEnumeratorImpl;\r
+ friend class _DataSetEnumeratorImpl;\r
+\r
+}; // DataSetEnumerator\r
+\r
+}} // Tizen::Io\r
+\r
+#endif // _FIO_DATA_SET_ENUMERATOR_H_\r
FIoRemoteMessagePort.cpp
FIo_RemoteMessagePortImpl.cpp
FIo_MessagePortProxy.cpp
+ FIoDataSet.cpp
+ FIo_DataSetImpl.cpp
+ FIoDataSetEnumerator.cpp
+ FIo_DataSetEnumeratorImpl.cpp
+ FIoDataRow.cpp
+ FIo_DataRowImpl.cpp
FIo_ZipFileArchive.cpp
FIoFileLock.cpp
FIo_FileLockImpl.cpp
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataRow.cpp\r
+* @brief This is the implementation file for the DataRow class.\r
+*/\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FIoDataRow.h>\r
+\r
+#include <FIo_DataRowImpl.h>\r
+\r
+#define FIO_DATAROW_COL_NUM_MAX 999\r
+\r
+using namespace Tizen::Base;\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+\r
+DataRow::DataRow(void)\r
+ : __pDataRowImpl(null)\r
+{\r
+ __pDataRowImpl = new (std::nothrow) _DataRowImpl;\r
+\r
+ SysTryReturnVoidResult(NID_IO, __pDataRowImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");\r
+}\r
+\r
+DataRow::~DataRow(void)\r
+{\r
+ delete __pDataRowImpl;\r
+}\r
+\r
+result\r
+DataRow::SetBlobAt(int columnIndex, Tizen::Base::ByteBuffer* pValue)\r
+{\r
+ return __pDataRowImpl->SetBlobAt(columnIndex, pValue);\r
+}\r
+\r
+result\r
+DataRow::SetDateTimeAt(int columnIndex, const Tizen::Base::DateTime& value)\r
+{\r
+ return __pDataRowImpl->SetDateTimeAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataRow::SetDoubleAt(int columnIndex, double value)\r
+{\r
+ return __pDataRowImpl->SetDoubleAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataRow::SetIntAt(int columnIndex, int value)\r
+{\r
+ return __pDataRowImpl->SetIntAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataRow::SetInt64At(int columnIndex, long long value)\r
+{\r
+ return __pDataRowImpl->SetInt64At(columnIndex, value);\r
+}\r
+\r
+result\r
+DataRow::SetStringAt(int columnIndex, const Tizen::Base::String& value)\r
+{\r
+ return __pDataRowImpl->SetStringAt(columnIndex, value);\r
+}\r
+\r
+}} // Tizen::Io\r
+\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataSet.cpp\r
+* @brief This is the implementation file for the DataSet class.\r
+*/\r
+#include <new>\r
+#include <unique_ptr.h>\r
+\r
+#include <FBaseResult.h>\r
+#include <FBaseSysLog.h>\r
+#include <FBase_NativeError.h>\r
+\r
+#include <FIoDataSet.h>\r
+#include <FIoDataRow.h>\r
+#include <FIoDataSetEnumerator.h>\r
+#include <FIo_DataSetImpl.h>\r
+\r
+\r
+using namespace std;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Runtime;\r
+using namespace Tizen::System;\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+\r
+\r
+DataSet::DataSet(void)\r
+ : __pDataSetImpl(null)\r
+{\r
+}\r
+\r
+DataSet::~DataSet(void)\r
+{\r
+ delete __pDataSetImpl;\r
+}\r
+\r
+result\r
+DataSet::Construct(const Tizen::Base::Collection::IList& columnNames)\r
+{\r
+ SysAssertf(__pDataSetImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");\r
+\r
+\r
+ unique_ptr<_DataSetImpl> pDataSetImpl(new (std::nothrow) _DataSetImpl);\r
+ SysTryReturnResult(NID_IO, pDataSetImpl != null, E_OUT_OF_MEMORY, "The memory is insufficient.");\r
+\r
+ result r = pDataSetImpl->Construct(columnNames);\r
+ SysTryReturn(NID_IO, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));\r
+\r
+ __pDataSetImpl = pDataSetImpl.release();\r
+\r
+ return E_SUCCESS;\r
+}\r
+\r
+DataRow*\r
+DataSet::CreateDataRowN(void)\r
+{\r
+ SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
+\r
+ return __pDataSetImpl->CreateDataRowN();\r
+}\r
+\r
+DataSetEnumerator*\r
+DataSet::GetDataSetEnumeratorN(void)\r
+{\r
+ SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
+\r
+ return __pDataSetImpl->GetDataSetEnumeratorN();\r
+}\r
+\r
+DataSet*\r
+DataSet::CloneN(void) const\r
+{\r
+ SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
+\r
+ return __pDataSetImpl->CloneN();\r
+}\r
+\r
+bool\r
+DataSet::Equals(const Tizen::Base::Object& obj) const\r
+{\r
+ SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
+\r
+ return __pDataSetImpl->Equals(obj);\r
+}\r
+\r
+int\r
+DataSet::GetHashCode(void) const\r
+{\r
+ SysAssertf(__pDataSetImpl != null, "Not yet constructed. Construct() should be called before use.\n");\r
+\r
+ return __pDataSetImpl->GetHashCode();\r
+}\r
+\r
+}} // Tizen::Io\r
+\r
+\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+* @file FIoDataSetEnumerator.cpp\r
+* @brief This is the implementation file for DataSetEnumerator class.\r
+*/\r
+\r
+#include <new>\r
+\r
+#include <FBaseInteger.h>\r
+#include <FBaseDouble.h>\r
+#include <FBaseString.h>\r
+#include <FBaseByteBuffer.h>\r
+#include <FBaseDateTime.h>\r
+#include <FBaseUtilStringUtil.h>\r
+#include <FBaseSysLog.h>\r
+#include <FIoDataSetEnumerator.h>\r
+\r
+#include <FBase_NativeError.h>\r
+#include <FIo_DataSetEnumeratorImpl.h>\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Utility;\r
+using namespace Tizen::Base::Runtime;\r
+\r
+namespace Tizen { namespace Io\r
+{\r
+DataSetEnumerator::DataSetEnumerator(void)\r
+ : __pDataSetEnumeratorImpl(null)\r
+{\r
+\r
+ __pDataSetEnumeratorImpl = new (std::nothrow)_DataSetEnumeratorImpl;\r
+\r
+ SysTryReturnVoidResult(NID_IO, __pDataSetEnumeratorImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");\r
+}\r
+\r
+DataSetEnumerator::~DataSetEnumerator(void)\r
+{\r
+ delete __pDataSetEnumeratorImpl;\r
+}\r
+\r
+result\r
+DataSetEnumerator::MoveNext(void)\r
+{\r
+ return __pDataSetEnumeratorImpl->MoveNext();\r
+}\r
+\r
+result\r
+DataSetEnumerator::MovePrevious(void)\r
+{\r
+ return __pDataSetEnumeratorImpl->MovePrevious();\r
+}\r
+\r
+result\r
+DataSetEnumerator::MoveFirst(void)\r
+{\r
+ return __pDataSetEnumeratorImpl->MoveFirst();\r
+}\r
+\r
+result\r
+DataSetEnumerator::MoveLast(void)\r
+{\r
+ return __pDataSetEnumeratorImpl->MoveLast();\r
+}\r
+\r
+result\r
+DataSetEnumerator::Reset(void)\r
+{\r
+ return __pDataSetEnumeratorImpl->Reset();\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetIntAt(int columnIndex, int& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetIntAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetInt64At(int columnIndex, long long& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetInt64At(columnIndex, value);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetDoubleAt(int columnIndex, double& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetDoubleAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetStringAt(int columnIndex, String& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetStringAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetBlobAt(int columnIndex, ByteBuffer& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetBlobAt(columnIndex, value);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetBlobAt(int columnIndex, void* buffer, int size) const\r
+{\r
+\r
+ SysTryReturnResult(NID_IO, buffer != null, E_INVALID_ARG, "Null pointer was passed.");\r
+ SysTryReturnResult(NID_IO, size > 0, E_INVALID_ARG, "Invalid size was passed.");\r
+\r
+ return __pDataSetEnumeratorImpl->GetBlobAt(columnIndex, buffer, size);\r
+}\r
+\r
+result\r
+DataSetEnumerator::GetDateTimeAt(int columnIndex, DateTime& value) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetDateTimeAt(columnIndex, value);\r
+}\r
+\r
+int\r
+DataSetEnumerator::GetColumnCount(void) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetColumnCount();\r
+}\r
+\r
+DbColumnType\r
+DataSetEnumerator::GetColumnType(int columnIndex) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetColumnType(columnIndex);\r
+}\r
+\r
+String\r
+DataSetEnumerator::GetColumnName(int columnIndex) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetColumnName(columnIndex);\r
+}\r
+\r
+int\r
+DataSetEnumerator::GetColumnSize(int columnIndex) const\r
+{\r
+ return __pDataSetEnumeratorImpl->GetColumnSize(columnIndex);\r
+}\r
+\r
+}} // Tizen::Io\r
+\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FIo_DataRowImpl.cpp
+ * @brief This is the implementation file for _DataRowImpl class.
+ */
+
+#include <unique_ptr.h>
+
+#include <FBaseInteger.h>
+#include <FBaseLongLong.h>
+#include <FBaseDouble.h>
+#include <FBaseString.h>
+#include <FBaseByteBuffer.h>
+#include <FBaseDateTime.h>
+#include <FBaseSysLog.h>
+#include <FBaseCol.h>
+
+#include <FBase_StringConverter.h>
+#include <FBase_NativeError.h>
+#include <FIo_DataRowImpl.h>
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
+
+namespace Tizen { namespace Io
+{
+_DataItem::_DataItem(void)
+ : type(DB_COLUMNTYPE_NULL)
+ , size(0)
+ , intValue(0)
+ , int64Value(0)
+ , doubleValue(0)
+ , pObj(null)
+{
+}
+
+_DataItem::~_DataItem(void)
+{
+ delete pObj;
+}
+
+int
+_DataItem::GetHashCode(void) const
+{
+ int hash = 0;
+
+ String str;
+
+ str.Append(static_cast<int>(type));
+ str.Append(size);
+ str.Append(intValue);
+ str.Append(int64Value);
+ str.Append(doubleValue);
+ hash += str.GetHashCode();
+
+ if (type == DB_COLUMNTYPE_TEXT )
+ hash += ((String*)pObj)->GetHashCode();
+ else if (type == DB_COLUMNTYPE_BLOB)
+ hash += ((ByteBuffer*)pObj)->GetHashCode();
+
+ return hash;
+}
+
+_DataRowImpl::_DataRowImpl(void)
+ : __pDataRow(null)
+ , __pColumnTypeList(null)
+ , __columnCount(0)
+{
+}
+
+_DataRowImpl::~_DataRowImpl(void)
+{
+}
+
+result
+_DataRowImpl::SetBlobAt(int columnIndex, Tizen::Base::ByteBuffer* pValue)
+{
+ result r = E_SUCCESS;
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+ SysTryReturnResult(NID_IO, pValue != null, E_INVALID_ARG, "pValue is null");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_BLOB || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ SysTryReturnResult(NID_IO, pItem != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_BLOB;
+ pItem->size = pValue->GetLimit();
+ pItem->pObj = pValue;
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_BLOB), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+}
+
+result
+_DataRowImpl::SetDateTimeAt(int columnIndex, const Tizen::Base::DateTime& value)
+{
+ result r = E_SUCCESS;
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_TEXT || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ unique_ptr<String> pString(new (std::nothrow) String(_StringConverter::CopyToCharArrayN(value.ToString())));
+ SysTryReturnResult(NID_IO, pItem != null && pString != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_TEXT;
+ pItem->size = pString->GetLength();
+ pItem->pObj = pString.release();
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_TEXT), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+
+}
+
+result
+_DataRowImpl::SetDoubleAt(int columnIndex, double value)
+{
+ result r = E_SUCCESS;
+ int size = sizeof(double);
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_DOUBLE || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ SysTryReturnResult(NID_IO, pItem != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_DOUBLE;
+ pItem->size = size;
+ pItem->doubleValue = value;
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_DOUBLE), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+
+}
+
+result
+_DataRowImpl::SetIntAt(int columnIndex, int value)
+{
+ result r = E_SUCCESS;
+ int size = sizeof(int);
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_INT || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ SysTryReturnResult(NID_IO, pItem != null , E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_INT;
+ pItem->size = size;
+ pItem->intValue = value;
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_INT), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+}
+
+result
+_DataRowImpl::SetInt64At(int columnIndex, long long value)
+{
+ result r = E_SUCCESS;
+ int size = sizeof(long long);
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_INT64 || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ SysTryReturnResult(NID_IO, pItem != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_INT64;
+ pItem->size = size;
+ pItem->int64Value = value;
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_INT64), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+}
+
+result
+_DataRowImpl::SetStringAt(int columnIndex, const Tizen::Base::String& value)
+{
+ result r = E_SUCCESS;
+ Integer* pColumnType = null;
+ int nColumnType = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Wrong column index.");
+
+ pColumnType = static_cast<Integer*>(__pColumnTypeList->GetAt(columnIndex));
+ nColumnType = pColumnType->ToInt();
+ SysTryReturnResult(NID_IO, nColumnType == DB_COLUMNTYPE_TEXT || nColumnType == DB_COLUMNTYPE_NULL,
+ E_TYPE_MISMATCH, "Type mismatch");
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ unique_ptr<String> pString(new (std::nothrow) String(value));
+ SysTryReturnResult(NID_IO, pItem != null && pString != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = DB_COLUMNTYPE_TEXT;
+ pItem->size = value.GetLength();
+ pItem->pObj = pString.release();
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(columnIndex));
+ r = __pDataRow->SetAt(pItem.release(), columnIndex);
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY,
+ "The memory is insufficient. Set failed");
+ delete pOldItem;
+
+ if (nColumnType == DB_COLUMNTYPE_NULL)
+ {
+ __pColumnTypeList->SetAt(new Integer(DB_COLUMNTYPE_TEXT), columnIndex);
+ delete pColumnType;
+ }
+
+ return r;
+}
+
+result
+_DataRowImpl::Clone(const ArrayList* pOthersRowArrayList) const
+{
+ result r = E_SUCCESS;
+
+ for (int i = 0; i < __columnCount; i++)
+ {
+ const _DataItem* pOthersItem = static_cast<const _DataItem*>(pOthersRowArrayList->GetAt(i));
+
+ unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
+ SysTryReturnResult(NID_IO, pItem != null, E_OUT_OF_MEMORY,
+ "The memory is insufficient.");
+
+ pItem->type = pOthersItem->type;
+ pItem->size = pOthersItem->size;
+ pItem->pObj = pOthersItem->pObj;
+ pItem->intValue = pOthersItem->intValue;
+ pItem->int64Value = pOthersItem->int64Value;
+ pItem->doubleValue = pOthersItem->doubleValue;
+
+ _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(i));
+ r = __pDataRow->SetAt(pItem.release(), i);
+ delete pOldItem;
+ if (r != E_SUCCESS)
+ break;
+ }
+
+ return r;
+}
+
+ArrayList*
+_DataRowImpl::GetRowArrayList(void) const
+{
+ return __pDataRow;
+}
+
+_DataRowImpl*
+_DataRowImpl::GetInstance(DataRow& dataRow)
+{
+ return dataRow.__pDataRowImpl;
+}
+
+const _DataRowImpl*
+_DataRowImpl::GetInstance(const DataRow& dataRow)
+{
+ return dataRow.__pDataRowImpl;
+}
+
+DataRow*
+_DataRowImpl::CreateDataRowInstanceN(int columnCount, ArrayList* pArrayListRow)
+{
+ unique_ptr<DataRow> pDataRow(new (std::nothrow) DataRow());
+ SysTryReturn(NID_IO, pDataRow != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ pDataRow->__pDataRowImpl->__pDataRow = pArrayListRow;
+ pDataRow->__pDataRowImpl->__columnCount = columnCount;
+
+ for (int i = 0 ; i < columnCount ; i++)
+ {
+ result r = pArrayListRow->Add(new (std::nothrow) _DataItem());
+ SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+
+ return pDataRow.release();
+}
+
+int
+_DataRowImpl::GetHashCode(const ArrayList* pRowArrayList)
+{
+ int hash = 0;
+
+ for (int i = 0; i < pRowArrayList->GetCount(); i++)
+ {
+ const _DataItem* pItem = static_cast<const _DataItem*>(pRowArrayList->GetAt(i));
+ hash += pItem->GetHashCode();
+ }
+
+ return hash;
+}
+
+}} // Tizen::Io
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FIo_DataSetEnumeratorImpl.cpp
+ * @brief This is the implementation file for _DataSetEnumeratorImpl class.
+ */
+
+#include <stdio.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <unique_ptr.h>
+
+#include <FBaseInteger.h>
+#include <FBaseDouble.h>
+#include <FBaseString.h>
+#include <FBaseByteBuffer.h>
+#include <FBaseDateTime.h>
+#include <FBaseUtilStringUtil.h>
+#include <FBaseColLinkedList.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColIEnumerator.h>
+#include <FBaseSysLog.h>
+
+#include <FIoDbTypes.h>
+#include <FIo_DataSetEnumeratorImpl.h>
+#include <FIo_DataRowImpl.h>
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::System;
+using namespace Tizen::App;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Io
+{
+
+_DataSetEnumeratorImpl::_DataSetEnumeratorImpl(void)
+ : __pDataSet(null),
+ __pColumnList(null),
+ __pCurrentRow(null),
+ __columnCount(0),
+ __rowCount(0),
+ __currentRowIndex(-1)
+{
+
+}
+
+_DataSetEnumeratorImpl::~_DataSetEnumeratorImpl(void)
+{
+
+}
+
+result
+_DataSetEnumeratorImpl::MoveNext(void)
+{
+ if (__currentRowIndex +1 == __rowCount)
+ return E_OUT_OF_RANGE;
+
+ ++__currentRowIndex;
+ __pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
+
+ if (__pCurrentRow == null)
+ return E_INVALID_STATE;
+
+ return E_SUCCESS;
+}
+
+result
+_DataSetEnumeratorImpl::MovePrevious(void)
+{
+ if (__currentRowIndex == 0)
+ return E_OUT_OF_RANGE;
+
+ --__currentRowIndex;
+ __pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
+
+ if (__pCurrentRow == null)
+ return E_INVALID_STATE;
+
+ return E_SUCCESS;
+}
+
+result
+_DataSetEnumeratorImpl::MoveFirst(void)
+{
+ __currentRowIndex = 0;
+ __pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
+
+ if (__pCurrentRow == null)
+ return E_INVALID_STATE;
+
+ return E_SUCCESS;
+}
+
+result
+_DataSetEnumeratorImpl::MoveLast(void)
+{
+ __currentRowIndex = __rowCount -1;
+ __pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
+
+ if (__pCurrentRow == null)
+ return E_INVALID_STATE;
+
+ return E_SUCCESS;
+}
+
+result
+_DataSetEnumeratorImpl::Reset(void)
+{
+ __currentRowIndex = -1;
+ __pCurrentRow = null;
+
+ return E_SUCCESS;
+}
+
+result
+_DataSetEnumeratorImpl::GetIntAt(int columnIndex, int& value) const
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_INT)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ value = pDataItem->intValue;
+ }
+ return E_SUCCESS;
+
+ CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetInt64At(int columnIndex, long long& value) const
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_INT64)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ value = pDataItem->int64Value;
+ }
+ return E_SUCCESS;
+
+CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetDoubleAt(int columnIndex, double& value) const
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_DOUBLE)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ value = pDataItem->doubleValue;
+ }
+ return E_SUCCESS;
+
+CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetStringAt(int columnIndex, String& value) const
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_TEXT)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ value = *((String*)pDataItem->pObj);
+ }
+
+CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetBlobAt(int columnIndex, ByteBuffer& value) const
+{
+ result r = E_SUCCESS;
+ ByteBuffer* pBuffer = null;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_BLOB)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ pBuffer = (ByteBuffer*)pDataItem->pObj;
+ pBuffer->SetPosition(0);
+ r = value.CopyFrom(*pBuffer);
+ }
+
+ // fall thru
+CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetBlobAt(int columnIndex, void* buffer, int size) const
+{
+ result r = E_SUCCESS;
+ int blobLen = 0;
+ ByteBuffer* pBuffer = null;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_BLOB)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ pBuffer = (ByteBuffer*)pDataItem->pObj;
+ pBuffer->SetPosition(0);
+ blobLen = pBuffer->GetLimit();
+ memcpy(buffer, pBuffer->GetPointer(), (blobLen < size) ? blobLen : size);
+ }
+
+ if (size < blobLen)
+ {
+ r = E_OVERFLOW;
+ }
+
+ // fall thru
+CATCH:
+ return r;
+}
+
+result
+_DataSetEnumeratorImpl::GetDateTimeAt(int columnIndex, DateTime& value) const
+{
+ result r = E_SUCCESS;
+ String* pStr = null;
+
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The instance is not constructed or the dataset is already been deleted.");
+ SysTryReturnResult(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, E_INVALID_ARG,
+ "Given column index is out of range.");
+ SysTryReturnResult(NID_IO, __pCurrentRow != null, E_INVALID_STATE,
+ "The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (pDataItem)
+ {
+ if (pDataItem->type != DB_COLUMNTYPE_TEXT)
+ {
+ r = E_TYPE_MISMATCH;
+ SysLog(NID_IO, "[E_TYPE_MISMATCH] Trying to access column of different type.");
+ goto CATCH;
+ }
+
+ pStr = (String*)pDataItem->pObj;
+ }
+
+ r = DateTime::Parse(*pStr, value);
+
+ // fall thru
+CATCH:
+ return r;
+}
+
+int
+_DataSetEnumeratorImpl::GetColumnCount(void) const
+{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
+ return __columnCount;
+}
+
+DbColumnType
+_DataSetEnumeratorImpl::GetColumnType(int columnIndex) const
+{
+ DbColumnType type = DB_COLUMNTYPE_UNDEFINED;
+
+ SysTryReturn(NID_IO, __pDataSet != null, DB_COLUMNTYPE_UNDEFINED, E_INVALID_STATE,
+ "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
+
+ SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, DB_COLUMNTYPE_UNDEFINED, E_INVALID_ARG,
+ "[E_INVALID_ARG] Given column index is out of range.");
+
+ if (__pCurrentRow)
+ {
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (!pDataItem)
+ {
+ SetLastResult(E_INVALID_STATE);
+ return DB_COLUMNTYPE_UNDEFINED;
+ }
+
+ type = pDataItem->type;
+ switch (type)
+ {
+ case DB_COLUMNTYPE_INT:
+ case DB_COLUMNTYPE_DOUBLE:
+ case DB_COLUMNTYPE_TEXT:
+ case DB_COLUMNTYPE_BLOB:
+ case DB_COLUMNTYPE_NULL:
+ type = pDataItem->type;
+ break;
+
+ default:
+ SetLastResult(E_INVALID_STATE);
+ break;
+ }
+ }
+
+ return type;
+}
+
+String
+_DataSetEnumeratorImpl::GetColumnName(int columnIndex) const
+{
+ SysTryReturn(NID_IO, __pDataSet != null, null, E_INVALID_STATE,
+ "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
+
+ SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, null, E_INVALID_ARG,
+ "[E_INVALID_ARG] Given column index is out of range.");
+
+
+ String* pString = dynamic_cast <String *> (__pColumnList->GetAt(columnIndex));
+
+ if (!pString)
+ {
+ SetLastResult(E_INVALID_STATE);
+ return String("");
+ }
+
+ return String(pString->GetPointer());
+}
+
+int
+_DataSetEnumeratorImpl::GetColumnSize(int columnIndex) const
+{
+ int bytes = 0;
+
+ SysTryReturn(NID_IO, __pDataSet != null, 0, E_INVALID_STATE,
+ "[E_INVALID_STATE] The instance is not constructed or the dataset is already been deleted.");
+
+ SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, 0, E_INVALID_ARG,
+ "[E_INVALID_ARG] Given column index is out of range.");
+
+ SysTryReturn(NID_IO, __pCurrentRow != null, 0, E_INVALID_STATE,
+ "[E_INVALID_STATE] The method has tried to fetch the column data of a result set that is not activated.");
+
+ _DataItem* pDataItem = dynamic_cast < _DataItem* >(__pCurrentRow->GetAt(columnIndex));
+ if (!pDataItem)
+ {
+ SetLastResult(E_INVALID_STATE);
+ return 0;
+ }
+
+ bytes = pDataItem->size;
+ //SysLog(NID_IO, "Size is %d", bytes);
+
+ return bytes;
+}
+
+_DataSetEnumeratorImpl*
+_DataSetEnumeratorImpl::GetInstance(DataSetEnumerator& dataSetEnumerator)
+{
+ return dataSetEnumerator.__pDataSetEnumeratorImpl;
+}
+
+const _DataSetEnumeratorImpl*
+_DataSetEnumeratorImpl::GetInstance(const DataSetEnumerator& dataSetEnumerator)
+{
+ return dataSetEnumerator.__pDataSetEnumeratorImpl;
+}
+
+DataSetEnumerator*
+_DataSetEnumeratorImpl::CreateDataSetEnumeratorInstanceN(void)
+{
+ unique_ptr<DataSetEnumerator> pDataSetEnumerator(new (std::nothrow) DataSetEnumerator());
+ SysTryReturn(NID_IO, pDataSetEnumerator != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ return pDataSetEnumerator.release();
+}
+
+}} // Tizen::Io
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+* @file FIo_DataSetImpl.cpp
+* @brief This is the implementation file for the _DataSetImpl class.
+*/
+
+#include <new>
+#include <unique_ptr.h>
+
+#include <FBaseObject.h>
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+#include <FIo_DataSetImpl.h>
+#include <FIo_DataRowImpl.h>
+#include <FIo_DataSetEnumeratorImpl.h>
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Io
+{
+_DataSetImpl::_DataSetImpl(void)
+ :__rowCount(0)
+{
+
+}
+
+_DataSetImpl::~_DataSetImpl(void)
+{
+
+}
+
+result
+_DataSetImpl::Construct(const IList& columnNames)
+{
+ result r = E_SUCCESS;
+
+ r = __columnList.Construct(columnNames);
+ SysTryReturn(NID_IO, r == E_SUCCESS, E_INVALID_ARG, r, "[E_INVALID_ARG] columnNames is invalid.");
+
+ __columnCount = __columnList.GetCount();
+ SysTryReturn(NID_IO, __columnCount > 0, E_INVALID_ARG, r, "[E_INVALID_ARG] column count is 0.");
+
+ __columnTypeList.Construct(__columnCount);
+
+ for (int i = 0 ; i < __columnCount ; i++)
+ {
+ result r = __columnTypeList.Add(new (std::nothrow) Integer(DB_COLUMNTYPE_NULL));
+ SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ }
+ //SysLog(NID_IO, "column count is %d", __columnCount);
+
+ return r;
+}
+
+DataRow*
+_DataSetImpl::CreateDataRowN(void)
+{
+ result r;
+ unique_ptr<ArrayList> pNewRowArrayList(new (std::nothrow) ArrayList);
+ SysTryReturn(NID_IO, pNewRowArrayList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ unique_ptr<DataRow> pDataRow(_DataRowImpl::CreateDataRowInstanceN(__columnCount, pNewRowArrayList.get()));
+ SysTryReturn(NID_IO, pDataRow != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ r = __dataSet.Add(pNewRowArrayList.release());
+ SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Add Row to DataSet is failed");
+
+ _DataRowImpl::GetInstance(*pDataRow)->__pColumnTypeList = &__columnTypeList;
+
+ __rowCount = __dataSet.GetCount();
+ //SysLog(NID_IO, "row count is %d", __rowCount);
+
+ return pDataRow.release();
+
+}
+
+DataSetEnumerator*
+_DataSetImpl::GetDataSetEnumeratorN(void)
+{
+ unique_ptr<DataSetEnumerator> pDataSetEnum(_DataSetEnumeratorImpl::CreateDataSetEnumeratorInstanceN());
+
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pDataSet = &__dataSet;
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pColumnList = &__columnList;
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__columnCount = __columnCount;
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__rowCount = __rowCount;
+
+ //SysLog(NID_IO, "row count is %d, column count is %d", __rowCount, __columnCount);
+
+ return pDataSetEnum.release();
+}
+
+DataSet*
+_DataSetImpl::CloneN(void) const
+{
+ result r;
+ unique_ptr< DataSet > pDataSet(new (std::nothrow) DataSet());
+ SysTryReturn(NID_IO, pDataSet != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+ pDataSet->Construct(__columnList);
+
+ for (int i = 0; i < __rowCount; i++)
+ {
+ DataRow* pNewRow = pDataSet->CreateDataRowN();
+ r = _DataRowImpl::GetInstance(*pNewRow)->Clone((const ArrayList*)(__dataSet.GetAt(i)));
+ delete pNewRow;
+
+ SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] DataRow Clone Falied");
+ }
+
+ return pDataSet.release();
+}
+
+bool
+_DataSetImpl::Equals(const Tizen::Base::Object& obj) const
+{
+ int thisHash = this->GetHashCode();
+ int othersHash = obj.GetHashCode();
+
+ if (thisHash == othersHash )
+ return true;
+ else
+ return false;
+}
+
+int
+_DataSetImpl::GetHashCode(void) const
+{
+ int hash = 0;
+
+ for (int i = 0; i < __rowCount; i++)
+ {
+ const ArrayList* pDataRowArrayList = static_cast<const ArrayList*>(__dataSet.GetAt(i));
+ hash += _DataRowImpl::GetHashCode(pDataRowArrayList);
+ }
+
+ return hash;
+}
+
+}} // Tizen::Io
+
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FIo_DataRowImpl.h
+ * @brief This is the header file for the %_DataRowImpl class.
+ *
+ * This header file contains declarations of the %_DataRowImpl class.
+ */
+
+#ifndef _FIO_INTERNAL_DATAROW_IMPL_H_
+#define _FIO_INTERNAL_DATAROW_IMPL_H_
+
+#include <unique_ptr.h>
+#include <FIoDbTypes.h>
+#include <FOspConfig.h>
+#include <FBaseCol.h>
+#include <FIoDataRow.h>
+
+namespace Tizen { namespace Base
+{
+class String;
+class ByteBuffer;
+class DateTime;
+}}
+
+namespace Tizen { namespace Io
+{
+
+class _DataItem
+ : public Tizen::Base::Object
+{
+public:
+ _DataItem(void);
+ ~_DataItem(void);
+ virtual int GetHashCode(void) const;
+
+ DbColumnType type;
+ int size;
+ int intValue;
+ long long int64Value;
+ double doubleValue;
+ Tizen::Base::Object* pObj;
+};
+
+
+/**
+ * @class _DataRowImpl
+ * @brief This class implements the DataRow.
+ * @since 2.1
+ *
+ * @see Tizen::Io::DataRow
+ */
+class _DataRowImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ _DataRowImpl(void);
+
+ virtual ~_DataRowImpl(void);
+
+ result SetBlobAt(int columnIndex, Tizen::Base::ByteBuffer* pValue);
+
+ result SetDateTimeAt(int columnIndex, const Tizen::Base::DateTime& value);
+
+ result SetDoubleAt(int columnIndex, double value);
+
+ result SetIntAt(int columnIndex, int value);
+
+ result SetInt64At(int columnIndex, long long value);
+
+ result SetStringAt(int columnIndex, const Tizen::Base::String& value);
+
+ static int GetHashCode(const Tizen::Base::Collection::ArrayList* pRowArrayList);
+
+ static _DataRowImpl* GetInstance(DataRow& dataRow);
+
+ static const _DataRowImpl* GetInstance(const DataRow& dataRow);
+
+ static DataRow* CreateDataRowInstanceN(int columnCount, Tizen::Base::Collection::ArrayList* pArrayListRow);
+
+ Tizen::Base::Collection::ArrayList* GetRowArrayList(void) const;
+
+ result Clone(const Tizen::Base::Collection::ArrayList* pOthersRowArrayList) const;
+
+private:
+ Tizen::Base::Collection::ArrayList* __pDataRow;
+ Tizen::Base::Collection::ArrayList* __pColumnTypeList;
+ int __columnCount;
+
+ friend class _DataSetImpl;
+
+}; //_DataRowImpl
+
+}} // Tizen::Io
+
+#endif //_FIO_INTERNAL_DATAROW_IMPL_H_
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FIo_DataSetEnumeratorImpl.h
+ * @brief This is the header file for the %_DataSetEnumeratorImpl class.
+ *
+ * This header file contains declarations of the %_DataSetEnumeratorImpl class.
+ */
+
+#ifndef _FIO_INTERNAL_DATASETENUMERATOR_IMPL_H_
+#define _FIO_INTERNAL_DATASETENUMERATOR_IMPL_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FBaseByteBuffer.h>
+#include <FBaseDateTime.h>
+#include <FBaseColLinkedList.h>
+#include <FIoDataSetEnumerator.h>
+
+namespace Tizen { namespace Base
+{
+class String;
+class ByteBuffer;
+class DateTime;
+}}
+
+namespace Tizen { namespace Io
+{
+
+class _DataSetRow;
+
+/**
+ * @class _DataSetEnumeratorImpl
+ * @brief This class implements the DataSetEnumerator.
+ * @since 2.1
+ *
+ * @see Tizen::Io::DataSetEnumerator
+ */
+class _DataSetEnumeratorImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ /**
+ * This is the default constructor for this class.
+ */
+ _DataSetEnumeratorImpl(void);
+
+ /**
+ * This is the default destructor for this class.
+ */
+ virtual ~_DataSetEnumeratorImpl(void);
+
+ /**
+ * @see DataSetEnumerator::MoveNext()
+ */
+ result MoveNext(void);
+
+ /**
+ * @see DataSetEnumerator::MovePrevious()
+ */
+ result MovePrevious(void);
+
+ /**
+ * @see DataSetEnumerator::MoveFirst()
+ */
+ result MoveFirst(void);
+
+ /**
+ * @see DataSetEnumerator::MoveLast()
+ */
+ result MoveLast(void);
+
+ /**
+ * @see DataSetEnumerator::Reset()
+ */
+ result Reset(void);
+
+ /**
+ * @see DataSetEnumerator::GetIntAt()
+ */
+ result GetIntAt(int columnIndex, int& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetInt64At()
+ */
+ result GetInt64At(int columnIndex, long long& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetDoubleAt()
+ */
+ result GetDoubleAt(int columnIndex, double& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetStringAt()
+ */
+ result GetStringAt(int columnIndex, Tizen::Base::String& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetBlobAt()
+ */
+ result GetBlobAt(int columnIndex, Tizen::Base::ByteBuffer& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetBlobAt()
+ */
+ result GetBlobAt(int columnIndex, void* buffer, int size) const;
+
+ /**
+ * @see DataSetEnumerator::GetDateTimeAt()
+ */
+ result GetDateTimeAt(int columnIndex, Tizen::Base::DateTime& value) const;
+
+ /**
+ * @see DataSetEnumerator::GetColumnCount()
+ */
+ int GetColumnCount(void) const;
+
+ /**
+ * @see DataSetEnumerator::GetColumnType()
+ */
+ DbColumnType GetColumnType(int columnIndex) const;
+
+ /**
+ * @see DataSetEnumerator::GetColumnName()
+ */
+ Tizen::Base::String GetColumnName(int columnIndex) const;
+
+ /**
+ * @see DataSetEnumerator::GetColumnSize()
+ */
+ int GetColumnSize(int columnIndex) const;
+
+ static _DataSetEnumeratorImpl* GetInstance(DataSetEnumerator& dataSetEnumerator);
+
+ static const _DataSetEnumeratorImpl* GetInstance(const DataSetEnumerator& dataSetEnumerator);
+
+ static DataSetEnumerator* CreateDataSetEnumeratorInstanceN(void);
+
+private:
+ _DataSetEnumeratorImpl(_DataSetEnumeratorImpl& dataSetEnumeratorImpl);
+
+ _DataSetEnumeratorImpl& operator =(const _DataSetEnumeratorImpl& dataSetEnumeratorImpl);
+
+ Tizen::Base::Collection::LinkedList* __pDataSet;
+ Tizen::Base::Collection::ArrayList* __pColumnList;
+ Tizen::Base::Collection::ArrayList* __pCurrentRow;
+
+ int __columnCount;
+
+ int __rowCount;
+
+ int __currentRowIndex;
+
+ friend class _DataSetImpl;
+
+}; // _DataSetEnumeratorImpl
+
+}} // Tizen::Io
+
+#endif //_FIO_INTERNAL_DATASETENUMERATOR_IMPL_H_
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FIoDataSet.h
+ * @brief This is the header file for the %_DataSetImpl class.
+ *
+ * This header file contains the declarations of the %_DataSetImpl class.
+ */
+
+#ifndef _FIO_INTERNAL_DATASET_IMPL_H_
+#define _FIO_INTERNAL_DATASET_IMPL_H_
+
+#include <FIoDataSet.h>
+#include <FBaseObject.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColLinkedList.h>
+#include <FOspConfig.h>
+
+namespace Tizen { namespace Io
+{
+
+class DataRow;
+class DataSetEnumerator;
+
+class _DataSetImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ _DataSetImpl(void);
+
+ virtual ~_DataSetImpl(void);
+
+ result Construct(const Tizen::Base::Collection::IList& columnNames);
+
+ DataRow* CreateDataRowN(void);
+
+ DataSetEnumerator* GetDataSetEnumeratorN(void);
+
+ DataSet* CloneN(void) const;
+
+ virtual bool Equals(const Tizen::Base::Object& obj) const;
+
+ virtual int GetHashCode(void) const;
+
+
+private:
+ _DataSetImpl(_DataSetImpl& dataSetImpl);
+
+ _DataSetImpl& operator =(const _DataSetImpl& dataSetImpl);
+
+ Tizen::Base::Collection::LinkedList __dataSet;
+ Tizen::Base::Collection::ArrayList __columnList;
+ Tizen::Base::Collection::ArrayList __columnTypeList;
+
+ int __columnCount;
+ int __rowCount;
+}; // _DataSetImpl
+
+}} // Tizen::Io
+
+#endif //_FIO_INTERNAL_DATASET_IMPL_H_
+