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;
}
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;
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;
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;
}
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;
}
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;
}
pItem->pObj = pBuffer;
}
- _DataItem* pOldItem = static_cast<_DataItem*>(__pDataRow->GetAt(i));
r = __pDataRow->SetAt(pItem.release(), i);
- delete pOldItem;
if (r != E_SUCCESS)
break;
}
result
_DataSetEnumeratorImpl::MoveNext(void)
{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
if (__currentRowIndex +1 == __rowCount)
return E_OUT_OF_RANGE;
result
_DataSetEnumeratorImpl::MovePrevious(void)
{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
if (__currentRowIndex == 0)
return E_OUT_OF_RANGE;
result
_DataSetEnumeratorImpl::MoveFirst(void)
{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
__currentRowIndex = 0;
__pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
result
_DataSetEnumeratorImpl::MoveLast(void)
{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
__currentRowIndex = __rowCount -1;
__pCurrentRow = static_cast<ArrayList*>(__pDataSet->GetAt(__currentRowIndex));
result
_DataSetEnumeratorImpl::Reset(void)
{
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_INVALID_STATE,
+ "The Object is not constructed or the dataset is already been deleted.");
+
__currentRowIndex = -1;
__pCurrentRow = null;
return DB_COLUMNTYPE_UNDEFINED;
}
- type = pDataItem->type;
- switch (type)
+ switch (pDataItem->type)
{
case DB_COLUMNTYPE_INT:
+ case DB_COLUMNTYPE_INT64:
case DB_COLUMNTYPE_DOUBLE:
case DB_COLUMNTYPE_TEXT:
case DB_COLUMNTYPE_BLOB:
{
int bytes = 0;
- SysTryReturn(NID_IO, __pDataSet != null, 0, E_INVALID_STATE,
+ SysTryReturn(NID_IO, __pDataSet != null, -1, 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,
+ SysTryReturn(NID_IO, columnIndex >= 0 && columnIndex < __columnCount, -1, E_INVALID_ARG,
"[E_INVALID_ARG] Given column index is out of range.");
- SysTryReturn(NID_IO, __pCurrentRow != null, 0, E_INVALID_STATE,
+ SysTryReturn(NID_IO, __pCurrentRow != null, -1, 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));
namespace Tizen { namespace Io
{
_DataSetImpl::_DataSetImpl(void)
- :__rowCount(0)
+ :__rowCount(0),
+ __pDataSet(null),
+ __pColumnList(null),
+ __pColumnTypeList(null)
{
-
}
_DataSetImpl::~_DataSetImpl(void)
{
-
+ delete __pDataSet;
+ delete __pColumnList;
+ delete __pColumnTypeList;
}
result
{
result r = E_SUCCESS;
+ __pDataSet = new (std::nothrow) LinkedList(SingleObjectDeleter);
+ SysTryReturnResult(NID_IO, __pDataSet != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ __pColumnList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+ SysTryReturnResult(NID_IO, __pColumnList != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ __pColumnTypeList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+ SysTryReturnResult(NID_IO, __pColumnTypeList != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
__columnCount = columnNames.GetCount();
- SysTryReturn(NID_IO, __columnCount > 0, E_INVALID_ARG, r, "[E_INVALID_ARG] column count is 0.");
+ SysTryReturnResult(NID_IO, __columnCount > 0, E_INVALID_ARG, "column count is 0.");
- r = __columnList.Construct(__columnCount);
+ r = __pColumnList->Construct(__columnCount);
SysTryReturn(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY, r, "[E_OUT_OF_MEMORY] column list construct failed");
- r = __columnTypeList.Construct(__columnCount);
+ r = __pColumnTypeList->Construct(__columnCount);
SysTryReturn(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY, r, "[E_OUT_OF_MEMORY] column type list construct failed");
for (int i = 0 ; i < __columnCount ; i++)
{
- r = __columnList.Add(new (std::nothrow) String(*(String*)(columnNames.GetAt(i))));
- SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+ r = __pColumnList->Add(new (std::nothrow) String(*(String*)(columnNames.GetAt(i))));
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY, "The memory is insufficient.");
- 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.");
+ r = __pColumnTypeList->Add(new (std::nothrow) Integer(DB_COLUMNTYPE_NULL));
+ SysTryReturnResult(NID_IO, r == E_SUCCESS, E_OUT_OF_MEMORY, "The memory is insufficient.");
}
//SysLog(NID_IO, "column count is %d", __columnCount);
_DataSetImpl::CreateDataRowN(void)
{
result r;
- unique_ptr<ArrayList> pNewRowArrayList(new (std::nothrow) ArrayList);
+ unique_ptr<ArrayList> pNewRowArrayList(new (std::nothrow) ArrayList(SingleObjectDeleter));
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());
+ r = __pDataSet->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;
+ _DataRowImpl::GetInstance(*pDataRow)->__pColumnTypeList = __pColumnTypeList;
- __rowCount = __dataSet.GetCount();
+ __rowCount = __pDataSet->GetCount();
//SysLog(NID_IO, "row count is %d", __rowCount);
return pDataRow.release();
{
unique_ptr<DataSetEnumerator> pDataSetEnum(_DataSetEnumeratorImpl::CreateDataSetEnumeratorInstanceN());
- _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pDataSet = &__dataSet;
- _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pColumnList = &__columnList;
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pDataSet = __pDataSet;
+ _DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__pColumnList = __pColumnList;
_DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__columnCount = __columnCount;
_DataSetEnumeratorImpl::GetInstance(*pDataSetEnum)->__rowCount = __rowCount;
_DataSetImpl::CloneN(void) const
{
result r;
- Integer* pColumnType = null;
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);
+ pDataSet->Construct(*__pColumnList);
for (int i = 0; i < __columnCount; i++)
{
- pColumnType = static_cast<Integer*>(_DataSetImpl::GetInstance(*pDataSet)->__columnTypeList.GetAt(i));
- r = _DataSetImpl::GetInstance(*pDataSet)->__columnTypeList.SetAt(new Integer(*(Integer*)__columnTypeList.GetAt(i)), i);
- delete pColumnType;
-
+ r = _DataSetImpl::GetInstance(*pDataSet)->__pColumnTypeList->SetAt(new Integer(*(Integer*)__pColumnTypeList->GetAt(i)), i);
SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] ColumnTypeList Copy Falied");
}
for (int i = 0; i < __rowCount; i++)
{
DataRow* pNewRow = pDataSet->CreateDataRowN();
- r = _DataRowImpl::GetInstance(*pNewRow)->Clone((const ArrayList*)(__dataSet.GetAt(i)));
+ r = _DataRowImpl::GetInstance(*pNewRow)->Clone((const ArrayList*)(__pDataSet->GetAt(i)));
delete pNewRow;
SysTryReturn(NID_IO, r == E_SUCCESS, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] DataRow Clone Falied");
for (int i = 0; i < __rowCount; i++)
{
- const ArrayList* pDataRowArrayList = static_cast<const ArrayList*>(__dataSet.GetAt(i));
+ const ArrayList* pDataRowArrayList = static_cast<const ArrayList*>(__pDataSet->GetAt(i));
hash += _DataRowImpl::GetHashCode(pDataRowArrayList);
}
_DataSetImpl& operator =(const _DataSetImpl& dataSetImpl);
- Tizen::Base::Collection::LinkedList __dataSet;
- Tizen::Base::Collection::ArrayList __columnList;
- Tizen::Base::Collection::ArrayList __columnTypeList;
+ Tizen::Base::Collection::LinkedList* __pDataSet;
+ Tizen::Base::Collection::ArrayList* __pColumnList;
+ Tizen::Base::Collection::ArrayList* __pColumnTypeList;
int __columnCount;
int __rowCount;