2 * Copyright 2012-2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (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
8 * http://floralicense.org/license/
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.
17 #ifndef MSG_SQLITE_WRAPPER_H
18 #define MSG_SQLITE_WRAPPER_H
20 /*==================================================================================================
22 ==================================================================================================*/
23 #include <tzplatform_config.h>
27 /*==================================================================================================
29 ==================================================================================================*/
30 #define MSGFW_DB_NAME tzplatform_mkpath(TZ_USER_DB,".msg_service.db")
32 #define MSGFW_MESSAGE_TABLE_NAME "MSG_MESSAGE_TABLE"
33 #define MSGFW_FOLDER_TABLE_NAME "MSG_FOLDER_TABLE"
34 #define MSGFW_ADDRESS_TABLE_NAME "MSG_ADDRESS_TABLE"
35 #define MSGFW_CONVERSATION_TABLE_NAME "MSG_CONVERSATION_TABLE"
36 #define MSGFW_SIM_MSG_TABLE_NAME "MSG_SIM_TABLE"
37 #define MSGFW_FILTER_TABLE_NAME "MSG_FILTER_TABLE"
38 #define MSGFW_PUSH_MSG_TABLE_NAME "MSG_PUSH_TABLE"
39 #define MSGFW_CB_MSG_TABLE_NAME "MSG_CBMSG_TABLE"
40 #define MMS_PLUGIN_MESSAGE_TABLE_NAME "MSG_MMS_MESSAGE_TABLE"
41 #define MSGFW_SYNCML_MSG_TABLE_NAME "MSG_SYNCML_TABLE"
42 #define MSGFW_SMS_SENDOPT_TABLE_NAME "MSG_SMS_SENDOPT_TABLE"
43 #define MSGFW_REPORT_TABLE_NAME "MSG_REPORT_TABLE"
44 #define MSGFW_PUSH_CONFIG_TABLE_NAME "MSG_PUSHCFG_TABLE"
45 #define MSGFW_MMS_PREVIEW_TABLE_NAME "MSG_MMS_PREVIEW_INFO_TABLE"
47 #define MSGFW_TMP_MSGID_TABLE_NAME "MSG_TMP_MSGID_TABLE"
49 #define MAX_QUERY_LEN 3072
50 #define MAX_FOLDER_NAME_LEN 20
51 #define MAX_ACCOUNT_NAME_LEN 51
53 #define MSGFW_DB_ESCAPE_CHAR '\\'
55 /*==================================================================================================
57 ==================================================================================================*/
58 void MsgReleaseMemoryDB();
59 msg_error_t MsgConvertStrWithEscape(const char *input, char **output);
60 int XSystem(const char *argv[]);
62 /*==================================================================================================
64 ==================================================================================================*/
71 msg_error_t connect();
72 msg_error_t disconnect();
74 bool checkTableExist(const char *pTableName);
75 msg_error_t execQuery(const char *pQuery);
76 msg_error_t getTable(const char *pQuery, int *pRowCnt);
78 msg_error_t bindText(const char *pBindStr, int index);
79 msg_error_t bindBlob(const void * pBindBlob, int size, int index);
80 msg_error_t prepareQuery(const char *pQuery);
81 msg_error_t stepQuery();
83 int columnInt(int ColumnIndex);
84 const unsigned char* columnText(int ColumnIndex);
85 const void* columnBlob(int ColumnIndex);
86 msg_error_t beginTrans();
87 msg_error_t endTrans(bool Success);
88 int getColumnToInt(int RowIndex);
89 char getColumnToChar(int RowIndex);
90 void getColumnToString(int RowIndex, int Length, char *pString);
91 msg_error_t getRowId(const char *pTableName, unsigned int *pRowId);
99 #endif // MSG_SQLITE_WRAPPER_H