a512047c8cfccf6c20a401a6887daecfa508e0a1
[platform/framework/native/appfw.git] / src / app / FAppSqlDataControl.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FAppSqlDataControl.cpp
19  * @brief       This is the implementation for the %SqlDataControl class.
20  */
21
22 #include <FAppSqlDataControl.h>
23
24 #include <FBaseSysLog.h>
25 #include <FBase_NativeError.h>
26
27 #include "FApp_SqlDataControlImpl.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31
32 namespace Tizen { namespace App
33 {
34
35 SqlDataControl::SqlDataControl(void)
36         : __pSqlDataControlImpl(null)
37 {
38         __pSqlDataControlImpl = new _SqlDataControlImpl;
39 }
40
41 SqlDataControl::~SqlDataControl(void)
42 {
43         delete __pSqlDataControlImpl;
44 }
45
46 result
47 SqlDataControl::Select(const String& dataId, const IList* pColumnList, const String* pWhere,
48                 const String *pOrder, RequestId& reqId, int pageNo, int countPerPage)
49 {
50         SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
51                         "This instance has not been properly constructed.");
52
53         return __pSqlDataControlImpl->Select(dataId, pColumnList, pWhere, pOrder, reqId, pageNo, countPerPage);
54 }
55
56 result
57 SqlDataControl::Insert(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& insertMap,
58                 RequestId& reqId)
59 {
60         SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
61                         "This instance has not been properly constructed.");
62
63         return __pSqlDataControlImpl->Insert(dataId, insertMap, reqId);
64 }
65
66 result
67 SqlDataControl::Update(const Tizen::Base::String& dataId, const Tizen::Base::Collection::IMap& updateMap,
68                         const Tizen::Base::String* pWhere, RequestId& reqId)
69 {
70         SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE, "This instance has not been properly constructed.");
71
72         return __pSqlDataControlImpl->Update(dataId, updateMap, pWhere, reqId);
73 }
74
75 result
76 SqlDataControl::Delete(const Tizen::Base::String& dataId, const Tizen::Base::String* pWhere, RequestId& reqId)
77 {
78         SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
79                         "This instance has not been properly constructed.");
80
81         return __pSqlDataControlImpl->Delete(dataId, pWhere, reqId);
82 }
83
84 result
85 SqlDataControl::SetSqlDataControlResponseListener(ISqlDataControlResponseListener* pListener)
86 {
87         SysTryReturnResult(NID_APP, __pSqlDataControlImpl, E_INVALID_STATE,
88                                          "This instance has not been properly constructed yet.");
89
90         return __pSqlDataControlImpl->SetSqlDataControlResponseListener(pListener);
91 }
92
93 }} // Tizen::App
94