3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Flora License, Version 1.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://floralicense.org/license/
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an AS IS BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
19 /*@file: IntPresentationModelBase.h
\r
20 *@brief: This is the header file for PresentationModelBase class
\r
24 #ifndef _INT_PRESENTATION_MODEL_BASE_H_
\r
25 #define _INT_PRESENTATION_MODEL_BASE_H_
\r
27 #include <FAppApp.h>
\r
31 #include "IntTypes.h"
\r
34 * @class PresentationModelBase
\r
35 * @brief This class declares functions which will manage database
\r
37 class PresentationModelBase
\r
41 * Default constructor
\r
43 PresentationModelBase(void);
\r
46 * Default destructor
\r
48 ~PresentationModelBase(void);
\r
51 * Initialize storage service
\r
53 result Initialize();
\r
56 * Deinitialize storage service
\r
58 result UnInitialize(void);
\r
63 * This function deletes the database
\r
65 * @return An error code
\r
66 * @param No parameter
\r
67 * @exception E_SUCCESS The database closed successfully
\r
68 * @exception E_FAILURE The database is not closed successfully
\r
70 result CloseDb(void);
\r
72 result CommitDb(void);
\r
75 * This function creates the table in database
\r
77 * @return An error code
\r
78 * @param tableType The name of the table
\r
79 * @exception E_SUCCESS The table is created successfully in database
\r
80 * @exception E_FAILURE The table creation in database is not successful
\r
82 result CreateDBTables(BrowserDbTableTypes tableType);
\r
85 * This function drops the existing tables from database
\r
87 * @return An error code
\r
88 * @param No parameter
\r
89 * @exception E_SUCCESS The table is dropped successfully from database
\r
90 * @exception E_FAILURE The table drop is unsuccessful
\r
92 result DropDBTables(void);
\r
94 result DbIsNextRowPresent(bool& nextRowpresent);
\r
97 * This function drops the existing tables from database
\r
99 * @return An error code
\r
100 * @param No parameter
\r
101 * @exception E_SUCCESS The table is dropped successfully from database
\r
102 * @exception E_FAILURE The table drop is unsuccessful
\r
104 result ExecuteQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount);
\r
106 result GetColumn(int nIndex, Tizen::Base::String& strVal);
\r
108 result GetColumn(int nIndex, int& nIntVal);
\r
110 result GetColumn(int nIndex, double& dblVal);
\r
112 result GetColumn(int nIndex, Tizen::Base::DateTime& dtVal);
\r
114 static bool GetCurrentDateTime(Tizen::Base::DateTime& dt);
\r
117 * This function gives the last inserted row id
\r
119 * @return An error code
\r
120 * @param tableName The name of the table
\r
121 * @param rowId The rowId in which last inserted rowId will be saved.
\r
122 * @exception E_SUCCESS The method is successful
\r
123 * @exception E_FAILURE The method is not successful
\r
124 * @remarks To work properly , the table name should be passed properly
\r
126 result GetLastInsertedId(Tizen::Base::String& tableName, int& rowId);
\r
129 * This function calls the CreateDBTables function for all the tables
\r
131 * @return An error code
\r
132 * @param No parameter
\r
134 result InitializeDBTables(void);
\r
136 result IsNullColumn(int nIndex, bool& isColumNull);
\r
139 * This function creates the database and constructs it.
\r
141 * @return An error code
\r
142 * @param No parameter
\r
143 * @exception E_SUCCESS The database created successfully
\r
144 * @exception E_FAILURE The database creation is failed
\r
146 result OpenDb(void);
\r
148 result RollbackDb(void);
\r
151 Tizen::Base::String DB_FILE_PATH;
\r
153 static const int MAX_DB_QUERY_SIZE;
\r
154 static const int QUERY_TYPE_LENGTH;
\r
157 bool __isBeginTransaction;
\r
159 Tizen::Io::Database* __pDataBase;
\r
160 Tizen::Io::DbEnumerator* __pDbEnum;
\r
161 Tizen::Io::DbStatement* __pDbStatement;
\r
165 #endif //_INT_PRESENTATION_MODEL_BASE_H_
\r