3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
19 /*@file: IntPresentationModelBase.h
20 *@brief: This is the header file for PresentationModelBase class
24 #ifndef _INT_PRESENTATION_MODEL_BASE_H_
25 #define _INT_PRESENTATION_MODEL_BASE_H_
32 #include "IntBookmarkData.h"
33 #include "IntHistoryData.h"
36 * @class PresentationModelBase
37 * @brief This class declares functions which will manage database
39 class PresentationModelBase
45 PresentationModelBase(void);
50 ~PresentationModelBase(void);
53 * Initialize storage service
58 * Deinitialize storage service
60 result UnInitialize(void);
65 * This function deletes the database
67 * @return An error code
69 * @exception E_SUCCESS The database closed successfully
70 * @exception E_FAILURE The database is not closed successfully
74 result CommitDb(void);
77 * This function creates the table in database
79 * @return An error code
80 * @param tableType The name of the table
81 * @exception E_SUCCESS The table is created successfully in database
82 * @exception E_FAILURE The table creation in database is not successful
84 result CreateDBTables(BrowserDbTableTypes tableType);
87 * This function drops the existing tables from database
89 * @return An error code
91 * @exception E_SUCCESS The table is dropped successfully from database
92 * @exception E_FAILURE The table drop is unsuccessful
94 result DropDBTables(void);
96 result DbIsNextRowPresent(bool& nextRowpresent);
99 * This function drops the existing tables from database
101 * @return An error code
102 * @param No parameter
103 * @exception E_SUCCESS The table is dropped successfully from database
104 * @exception E_FAILURE The table drop is unsuccessful
106 result ExecuteQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount);
109 * This function drops the existing tables from database
111 * @return An error code
112 * @param No parameter
113 * @exception E_SUCCESS The table is dropped successfully from database
114 * @exception E_FAILURE The table drop is unsuccessful
116 result ExecuteBookmarkQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount, BookmarkData& bookmark);
118 result ExecuteHistoryQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount, History& history);
120 result GetColumn(int nIndex, Tizen::Base::String& strVal);
122 result GetColumn(int nIndex, int& nIntVal);
124 result GetColumn(int nIndex, double& dblVal);
126 result GetColumn(int nIndex, Tizen::Base::DateTime& dtVal);
128 result GetColumn(int nIndex,Tizen::Base::ByteBuffer& favIconBuffer);
130 static bool GetCurrentDateTime(Tizen::Base::DateTime& dt);
133 * This function gives the last inserted row id
135 * @return An error code
136 * @param tableName The name of the table
137 * @param rowId The rowId in which last inserted rowId will be saved.
138 * @exception E_SUCCESS The method is successful
139 * @exception E_FAILURE The method is not successful
140 * @remarks To work properly , the table name should be passed properly
142 result GetLastInsertedId(Tizen::Base::String& tableName, int& rowId);
145 * This function calls the CreateDBTables function for all the tables
147 * @return An error code
148 * @param No parameter
150 result InitializeDBTables(void);
152 result IsNullColumn(int nIndex, bool& isColumNull);
155 * This function creates the database and constructs it.
157 * @return An error code
158 * @param No parameter
159 * @exception E_SUCCESS The database created successfully
160 * @exception E_FAILURE The database creation is failed
164 result RollbackDb(void);
167 Tizen::Base::String DB_FILE_PATH;
169 static const int MAX_DB_QUERY_SIZE;
170 static const int QUERY_TYPE_LENGTH;
173 bool __isBeginTransaction;
175 Tizen::Io::Database* __pDataBase;
176 Tizen::Io::DbEnumerator* __pDbEnum;
177 Tizen::Io::DbStatement* __pDbStatement;
181 #endif //_INT_PRESENTATION_MODEL_BASE_H_