2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FAppSqlDataControl.cpp
19 * @brief This is the implementation for the %SqlDataControl class.
22 #include <FAppSqlDataControl.h>
24 #include <FBaseSysLog.h>
25 #include <FBase_NativeError.h>
27 #include "FApp_SqlDataControlImpl.h"
28 #include <FSec_AccessController.h>
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Security;
34 namespace Tizen { namespace App
37 SqlDataControl::SqlDataControl(void)
38 : __pSqlDataControlImpl(null)
40 __pSqlDataControlImpl = new _SqlDataControlImpl;
43 SqlDataControl::~SqlDataControl(void)
45 delete __pSqlDataControlImpl;
49 SqlDataControl::Select(const String& dataId, const IList* pColumnList, const String* pWhere,
50 const String *pOrder, RequestId& reqId, int pageNo, int countPerPage)
52 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
53 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
55 SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
56 "This instance has not been properly constructed.");
58 return __pSqlDataControlImpl->Select(dataId, pColumnList, pWhere, pOrder, reqId, pageNo, countPerPage);
62 SqlDataControl::Insert(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& insertMap,
65 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
66 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
68 SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
69 "This instance has not been properly constructed.");
71 return __pSqlDataControlImpl->Insert(dataId, insertMap, reqId);
75 SqlDataControl::Update(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& updateMap,
76 const Tizen::Base::String* pWhere, RequestId& reqId)
78 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
79 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
81 SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE, "This instance has not been properly constructed.");
83 return __pSqlDataControlImpl->Update(dataId, updateMap, pWhere, reqId);
87 SqlDataControl::Delete(const Tizen::Base::String& dataId, const Tizen::Base::String* pWhere, RequestId& reqId)
89 result r = _AccessController::CheckUserPrivilege(_PRV_DATACONTROL_CONSUMER);
90 SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
92 SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
93 "This instance has not been properly constructed.");
95 return __pSqlDataControlImpl->Delete(dataId, pWhere, reqId);
99 SqlDataControl::SetSqlDataControlResponseListener(ISqlDataControlResponseListener* pListener)
101 SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
102 "This instance has not been properly constructed yet.");
104 return __pSqlDataControlImpl->SetSqlDataControlResponseListener(pListener);