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_
34 * @class PresentationModelBase
35 * @brief This class declares functions which will manage database
37 class PresentationModelBase
43 PresentationModelBase(void);
48 ~PresentationModelBase(void);
51 * Initialize storage service
53 static result Initialize(void);
56 * Deinitialize storage service
58 static result UnInitialize(void);
63 * This function deletes the database
65 * @return An error code
67 * @exception E_SUCCESS The database closed successfully
68 * @exception E_FAILURE The database is not closed successfully
70 static result CloseDb(void);
72 static result CommitDb(void);
75 * This function creates the table in database
77 * @return An error code
78 * @param tableType The name of the table
79 * @exception E_SUCCESS The table is created successfully in database
80 * @exception E_FAILURE The table creation in database is not successful
82 static result CreateDBTables(BrowserDbTableTypes tableType);
85 * This function drops the existing tables from database
87 * @return An error code
89 * @exception E_SUCCESS The table is dropped successfully from database
90 * @exception E_FAILURE The table drop is unsuccessful
92 static result DropDBTables(void);
94 static result DbIsNextRowPresent(bool& nextRowpresent);
97 * This function drops the existing tables from database
99 * @return An error code
100 * @param No parameter
101 * @exception E_SUCCESS The table is dropped successfully from database
102 * @exception E_FAILURE The table drop is unsuccessful
104 static result ExecuteQuery(const Tizen::Base::String& pszFormatQuery, int& nRowCount);
106 static result GetColumn(int nIndex, Tizen::Base::String& strVal);
108 static result GetColumn(int nIndex, int& nIntVal);
110 static result GetColumn(int nIndex, double& dblVal);
112 static result GetColumn(int nIndex, Tizen::Base::DateTime& dtVal);
114 static bool GetCurrentDateTime(Tizen::Base::DateTime& dt);
117 * This function gives the last inserted row id
119 * @return An error code
120 * @param tableName The name of the table
121 * @param rowId The rowId in which last inserted rowId will be saved.
122 * @exception E_SUCCESS The method is successful
123 * @exception E_FAILURE The method is not successful
124 * @remarks To work properly , the table name should be passed properly
126 static result GetLastInsertedId(Tizen::Base::String& tableName, int& rowId);
129 * This function calls the CreateDBTables function for all the tables
131 * @return An error code
132 * @param No parameter
134 static result InitializeDBTables(void);
136 static result IsNullColumn(int nIndex, bool& isColumNull);
139 * This function creates the database and constructs it.
141 * @return An error code
142 * @param No parameter
143 * @exception E_SUCCESS The database created successfully
144 * @exception E_FAILURE The database creation is failed
146 static result OpenDb(void);
148 static result RollbackDb(void);
151 static Tizen::Base::String DB_FILE_PATH;
152 static const int MAX_DB_QUERY_SIZE;
153 static const int QUERY_TYPE_LENGTH;
156 static bool __isBeginTransaction;
158 static Tizen::Io::Database* __pDataBase;
159 static Tizen::Io::DbEnumerator* __pDbEnum;
160 static Tizen::Io::DbStatement* __pDbStatement;
164 #endif //_INT_PRESENTATION_MODEL_BASE_H_