|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Description: Manipulate Interface of Internet Radio Database |
|
13 * |
|
14 */ |
|
15 |
|
16 #ifndef _IRDB_WRAPPER_H_ |
|
17 #define _IRDB_WRAPPER_H_ |
|
18 |
|
19 #include <QList> |
|
20 #include "irdbexport.h" |
|
21 #include "irdbviewstruct.h" |
|
22 |
|
23 class QVariant; |
|
24 class QSqlQuery; |
|
25 class IRDB; |
|
26 |
|
27 |
|
28 class IRDB_DLL_EXPORT IRDBWrapper |
|
29 { |
|
30 public: |
|
31 |
|
32 IRDBWrapper(); |
|
33 |
|
34 virtual ~IRDBWrapper(); |
|
35 |
|
36 public: |
|
37 /* |
|
38 * If all parameters are default, all cid rows in IRDB will return; |
|
39 * condAND: condition for search IRDB, it is AND relationship in every pair; |
|
40 * condOR: condition for search IRDB, it is OR relationship in every pair; |
|
41 */ |
|
42 QList<uint>* getChannelId(const columnMap* const condAND = NULL, |
|
43 const columnMap* const condOR = NULL); |
|
44 |
|
45 friend class IRDB; |
|
46 |
|
47 protected: |
|
48 /* |
|
49 * If all parameters are default, all rows in IRDB will return; |
|
50 * condAND: condition for search IRDB, it is AND relationship in every pair; |
|
51 * condOR: condition for search IRDB, it is OR relationship in every pair; |
|
52 */ |
|
53 QList<QVariant*>* getIRDB(const columnMap* const condAND = NULL, |
|
54 const columnMap* const condOR = NULL); |
|
55 |
|
56 protected: |
|
57 /* |
|
58 * create sql condition(where) string according to the input condAND and condAND; |
|
59 * condAND: [direction:in] it is AND relationship in every pair; |
|
60 * condOR: [direction:in] it is OR relationship in every pair; |
|
61 * pArrayColName:[direction:in] array pointer to colName<table>[]; |
|
62 * for example:colNameView[],colNameChannelHistory[]; |
|
63 * condSqlStr: [direction:out] return the sqlString; |
|
64 */ |
|
65 void combineCondStr(const columnMap* const condAND, |
|
66 const columnMap* const condOR, |
|
67 const QString* pArryColName, |
|
68 QString& condSqlStr); |
|
69 |
|
70 /* |
|
71 * create sql insert/update string according to RowData; |
|
72 * RowData: [direction:in] row value of table; |
|
73 * pArrayColName:[direction:in] array pointer to colName<table>[]; |
|
74 * for example:colNameView[],colNameChannelHistory[]; |
|
75 * insSqlStr: [direction:out] return the sqlString; |
|
76 * updSqlStr: [direction:out] return the sqlString; |
|
77 */ |
|
78 void combinePutStr(const columnMap* const RowData, |
|
79 const QString* pArryColName, |
|
80 QString& insSqlStr, |
|
81 QString& updSqlStr, |
|
82 const logoMap* const logoData = NULL, |
|
83 QList<QByteArray>* logoArrayList = NULL); |
|
84 |
|
85 /* |
|
86 * create sql select string according to the input condAND and condOR; |
|
87 * condAND: [direction:in] it is AND relationship in every pair; |
|
88 * condOR: [direction:in] it is OR relationship in every pair; |
|
89 * pArrayColName:[direction:in] array pointer to colName<table>[]; |
|
90 * for example:colNameView[],colNameChannelHistory[]; |
|
91 * sltSqlStr: [direction:out] return the sqlString; |
|
92 */ |
|
93 void combineGetStr(const columnMap* const condAND, |
|
94 const columnMap* const condOR, |
|
95 const QString* pArryColName, |
|
96 QString& sltSqlStr); |
|
97 |
|
98 /* |
|
99 * create sql delete string according to the input condAND and condOR; |
|
100 * condAND: [direction:in] it is AND relationship in every pair; |
|
101 * condOR: [direction:in] it is OR relationship in every pair; |
|
102 * pArrayColName:[direction:in] array pointer to colName<table>[]; |
|
103 * for example:colNameView[],colNameChannelHistory[]; |
|
104 * dltSqlStr: [direction:out] return the sqlString; |
|
105 */ |
|
106 void combineDeleteStr(const columnMap* const condAND, |
|
107 const columnMap* const condOR, |
|
108 const QString* pArryColName, |
|
109 QString& dltSqlStr); |
|
110 |
|
111 private: |
|
112 |
|
113 /* |
|
114 * It is called by IRDB instance; |
|
115 * IRDB instance delivers rows set(channelId) to IRDBWrapper via this function; |
|
116 * the rows set is storaged in m_IRCIDSet; |
|
117 */ |
|
118 bool loadDataOfChannelIdCB(QSqlQuery& aIRDataSet, QList<uint>* pCIDDataSet); |
|
119 |
|
120 /* |
|
121 * It is called by IRDB instance; |
|
122 * IRDB instance delivers rows set to IRDBWrapper via this function; |
|
123 * the rows set is storaged in m_IRDataSet; |
|
124 */ |
|
125 bool loadDataOfIRDBCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pViewDataSet); |
|
126 |
|
127 /* |
|
128 * it is for the single table; |
|
129 */ |
|
130 virtual bool getIRTableCB(QSqlQuery& aIRDataSet, QList<QVariant*>* pTableDataSet); |
|
131 |
|
132 protected: |
|
133 //pointer for IRDB; |
|
134 IRDB* m_pIRDB; |
|
135 }; |
|
136 |
|
137 |
|
138 #endif |
|
139 |
|
140 |
|
141 |