205 { |
205 { |
206 SetEntriesInProperOrderL( aQuery->GetIds(), aResultContainer ); |
206 SetEntriesInProperOrderL( aQuery->GetIds(), aResultContainer ); |
207 } |
207 } |
208 } |
208 } |
209 |
209 |
|
210 // --------------------------------------------------------------------------- |
|
211 // |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
210 void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization ) |
214 void CCaSqLiteStorage::LocalizeEntryL( CCaLocalizationEntry& aLocalization ) |
211 { |
215 { |
212 CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb ); |
216 CCaSqlQuery* sqlLocalizeEntryQuery = CCaSqlQuery::NewLC( iSqlDb ); |
213 CaSqlQueryCreator::CreateLocalizeEntryQueryL( sqlLocalizeEntryQuery ); |
217 CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlLocalizeEntryQuery, |
|
218 KSQLLocalizeEntry); |
214 sqlLocalizeEntryQuery->PrepareL(); |
219 sqlLocalizeEntryQuery->PrepareL(); |
215 sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization ); |
220 sqlLocalizeEntryQuery->BindValuesForLocalizeL( aLocalization ); |
216 sqlLocalizeEntryQuery->ExecuteL( ); |
221 sqlLocalizeEntryQuery->ExecuteL( ); |
217 CleanupStack::PopAndDestroy( sqlLocalizeEntryQuery ); |
222 CleanupStack::PopAndDestroy( sqlLocalizeEntryQuery ); |
218 } |
223 } |
219 |
224 |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 // --------------------------------------------------------------------------- |
|
228 // |
|
229 void CCaSqLiteStorage::AddLocalizationL( |
|
230 const CCaLocalizationEntry& aLocalization) |
|
231 { |
|
232 if (LocalizationEntryPresentL(aLocalization)) |
|
233 { |
|
234 ExecuteLocalizationStatementL(aLocalization, KSQLUpdateLocalization); |
|
235 } |
|
236 else |
|
237 { |
|
238 ExecuteLocalizationStatementL(aLocalization, KSQLAddLocalization); |
|
239 } |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 TBool CCaSqLiteStorage::LocalizationEntryPresentL( |
|
247 const CCaLocalizationEntry& aLocalization) |
|
248 { |
|
249 TBool result(EFalse); |
|
250 CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb ); |
|
251 CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery, |
|
252 KSQLGetLocalization); |
|
253 sqlQuery->PrepareL(); |
|
254 sqlQuery->BindValuesForGetLocalizationEntryL( aLocalization ); |
|
255 result = sqlQuery->ExecuteEntryPresentL( ); |
|
256 CleanupStack::PopAndDestroy( sqlQuery ); |
|
257 return result; |
|
258 } |
|
259 |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 // --------------------------------------------------------------------------- |
|
263 // |
|
264 void CCaSqLiteStorage::ExecuteLocalizationStatementL( |
|
265 const CCaLocalizationEntry& aLocalization, const TDesC& aStatement) |
|
266 { |
|
267 CCaSqlQuery* sqlQuery = CCaSqlQuery::NewLC( iSqlDb ); |
|
268 CaSqlQueryCreator::CreateLocalizationTableQueryL(sqlQuery,aStatement ); |
|
269 sqlQuery->PrepareL(); |
|
270 sqlQuery->BindValuesForLocalizationEntryL( aLocalization ); |
|
271 sqlQuery->ExecuteL( ); |
|
272 CleanupStack::PopAndDestroy( sqlQuery ); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
220 void CCaSqLiteStorage::GetLocalizationsL( |
279 void CCaSqLiteStorage::GetLocalizationsL( |
221 RPointerArray<CCaLocalizationEntry>& aResultContainer ) |
280 RPointerArray<CCaLocalizationEntry>& aResultContainer ) |
222 { |
281 { |
223 CCaSqlQuery* sqlGetLocalizationsQuery = CCaSqlQuery::NewLC( iSqlDb ); |
282 CCaSqlQuery* sqlGetLocalizationsQuery = CCaSqlQuery::NewLC( iSqlDb ); |
224 CaSqlQueryCreator::CreateGetLocalizationsQueryL( |
283 CaSqlQueryCreator::CreateLocalizationTableQueryL( |
225 sqlGetLocalizationsQuery ); |
284 sqlGetLocalizationsQuery, KSQLGetLocalizations ); |
226 |
|
227 sqlGetLocalizationsQuery->PrepareL(); |
285 sqlGetLocalizationsQuery->PrepareL(); |
228 sqlGetLocalizationsQuery->ExecuteLocalizationsL( aResultContainer ); |
286 sqlGetLocalizationsQuery->ExecuteLocalizationsL( aResultContainer ); |
229 CleanupStack::PopAndDestroy( sqlGetLocalizationsQuery ); |
287 CleanupStack::PopAndDestroy( sqlGetLocalizationsQuery ); |
230 } |
288 } |
231 |
289 |
243 sqlGetEntriesIdsQuery->PrepareL(); |
301 sqlGetEntriesIdsQuery->PrepareL(); |
244 sqlGetEntriesIdsQuery->BindValuesForGetEntriesL( aQuery ); |
302 sqlGetEntriesIdsQuery->BindValuesForGetEntriesL( aQuery ); |
245 sqlGetEntriesIdsQuery->ExecuteL( aResultIdArray, |
303 sqlGetEntriesIdsQuery->ExecuteL( aResultIdArray, |
246 CCaSqlQuery::EEntryTable ); |
304 CCaSqlQuery::EEntryTable ); |
247 CleanupStack::PopAndDestroy( sqlGetEntriesIdsQuery ); |
305 CleanupStack::PopAndDestroy( sqlGetEntriesIdsQuery ); |
248 |
|
249 } |
306 } |
250 |
307 |
251 // --------------------------------------------------------------------------- |
308 // --------------------------------------------------------------------------- |
252 // CCASqLiteStorage::GetEntriesIdsL |
309 // CCASqLiteStorage::GetEntriesIdsL |
253 // |
310 // |