2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef TIZENAPIS_PLATFORM_SQL_DATACONTRIL_CONSUMER_H_
19 #define TIZENAPIS_PLATFORM_SQL_DATACONTRIL_CONSUMER_H_
23 #include <dpl/noncopyable.h>
25 #include "ISqlDataControlConsumer.h"
26 #include "DataControlFactory.h"
27 #include <dpl/mutex.h>
30 namespace DataControl {
32 class SQLDataControlConsumer : public ISQLDataControlConsumer
34 friend class DataControlFactory;
38 virtual void insertData(const EventInsertPtr& event);
39 virtual void deleteData(const EventDeletePtr& event);
40 virtual void selectData(const EventSelectPtr& event);
41 virtual void updateData(const EventUpdatePtr& event);
43 virtual ~SQLDataControlConsumer();
44 void setType(std::string& type);
45 void setProviderId(const std::string& id );
46 void setDataId(const std::string& id );
48 std::string getType();
49 std::string getDataId();
50 std::string getProviderId();
52 void handlePendingEvent(const EventInsertPtr& event);
53 void handlePendingEvent(const EventDeletePtr& event);
54 void handlePendingEvent(const EventSelectPtr& event);
55 void handlePendingEvent(const EventUpdatePtr& event);
56 void handleCommonErrorEvent(void* userData, unsigned int code, std::string msg);
61 std::string m_providerId;
63 std::string m_currentAppId;
64 std::string m_ProviderPkgId;
66 bool checkReqIdUniqueness(unsigned int reqId);
68 void saveArrayToFile(std::string filename, RowData* rowData);
69 void createResultDir();
70 static DPL::Mutex m_mutex;
72 SQLDataControlConsumer(std::string& provId, std::string& dataId, std::string& type);
74 virtual void OnRequestReceived(const EventInsertPtr& event);
75 virtual void OnRequestReceived(const EventDeletePtr& event);
76 virtual void OnRequestReceived(const EventSelectPtr& event);
77 virtual void OnRequestReceived(const EventUpdatePtr& event);