/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* 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.
*/
using System;
namespace Tizen.Applications.DataControl
{
///
/// This class is for containing insert operation result.
///
public class InsertResult
{
///
/// Gets the insert data's row id.
///
public long RowID
{
get;
private set;
}
///
/// Gets the insert operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes InsertResult class with columnNames and columnTypes.
///
/// Inserted row ID
/// Insert request result
public InsertResult(long rowID, bool result)
{
RowID = rowID;
Result = result;
}
}
///
/// This class is for containing bulk insert operation result.
///
public class BulkInsertResult
{
///
/// Gets the bulk insert operation result data.
///
public BulkResultData BulkResultData
{
get;
private set;
}
///
/// Gets the bulk insert operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes InsertResult class with bulkResultData and result.
///
/// Bulk insert request result data
/// Bulk insert request result
/// Thrown in case of Invalid parmaeter.
public BulkInsertResult(BulkResultData bulkResultData, bool result)
{
if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid))
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "bulkResultData");
}
BulkResultData = bulkResultData;
Result = result;
}
}
///
/// This class is for containing update operation result.
///
public class UpdateResult
{
///
/// Gets the update operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes UpdateResult class with result.
///
/// Update request result
public UpdateResult(bool result)
{
Result = result;
}
}
///
/// This class is for containing delete operation result.
///
public class DeleteResult
{
///
/// Gets the delete operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes DeleteResult class with result.
///
/// Delete request result
public DeleteResult(bool result)
{
Result = result;
}
}
///
/// This class is for containing select operation result.
///
public class SelectResult
{
///
/// Gets the select operation result cursor.
///
public ICursor ResultCursor
{
get;
private set;
}
///
/// Gets the select operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes SelectResult class with cursor and result.
///
/// Cursor with selected data
/// Select request result
/// Thrown in case of Invalid parmaeter.
public SelectResult(ICursor cursor, bool result)
{
int i;
if (result == true && cursor == null)
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "cursor");
}
if (result == true && (cursor is MatrixCursor) == false)
{
if (cursor.GetColumnCount() <= 0)
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column count");
}
for (i = 0; i < cursor.GetColumnCount(); i++)
{
if (string.IsNullOrEmpty(cursor.GetColumnName(i)))
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column name index " + i.ToString());
}
if (cursor.GetColumnType(i) < ColumnType.ColumnTypeInt || cursor.GetColumnType(i) > ColumnType.ColumnTypeBlob)
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column type index" + i.ToString());
}
}
}
ResultCursor = cursor;
Result = result;
}
}
///
/// This class is for containing MapAdd operation result.
///
public class MapAddResult
{
///
/// Gets the MapAdd operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes MapAddResult class with result.
///
/// MapAdd request result
public MapAddResult(bool result)
{
Result = result;
}
}
///
/// This class is for containing MapBulkAdd operation result.
///
public class MapBulkAddResult
{
///
/// Gets the MapBulkAdd operation result data.
///
public BulkResultData BulkResultData
{
get;
private set;
}
///
/// Gets the MapBulkAdd operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes MapBulkAddResult class with bulkResultData and result.
///
/// MapBulkAdd request result data
/// MapBulkAdd request result
/// Thrown in case of Invalid parmaeter.
public MapBulkAddResult(BulkResultData bulkResultData, bool result)
{
if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid))
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "bulkResultData");
}
BulkResultData = bulkResultData;
Result = result;
}
}
///
/// This class is for containing MapSet operation result.
///
public class MapSetResult
{
///
/// Gets the MapSet operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes MapSetResult class with result.
///
/// MapSet request result
public MapSetResult(bool result)
{
Result = result;
}
}
///
/// This class is for containing MapRemove operation result.
///
public class MapRemoveResult
{
///
/// Gets the MapRemove operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes MapRemoveResult class with result.
///
/// MapRemove request result
public MapRemoveResult(bool result)
{
Result = result;
}
}
///
/// This class is for containing MapGet operation result.
///
public class MapGetResult
{
///
/// Gets the result value list of the MapGet operation.
///
public string[] ValueList
{
get;
private set;
}
///
/// Gets the MapGet operation result.
///
public bool Result
{
get;
private set;
}
///
/// Initializes MapGetResult class with data and result.
///
/// MapGet request result data
/// MapGet request result
/// Thrown in case of Invalid parmaeter.
public MapGetResult(string[] valueLIst, bool result)
{
if (result == true && valueLIst == null)
{
ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "valueLIst");
}
ValueList = valueLIst;
Result = result;
}
}
///
/// This class is for containing DataChangeListen operation result.
///
public class DataChangeListenResult
{
///
/// Gets the DataChangeListen operation result.
///
public ResultType Result
{
get;
private set;
}
///
/// Initializes DataChangeListenResult class with result.
///
/// DataChangeListen request result
public DataChangeListenResult(ResultType result)
{
Result = result;
}
}
}