|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __SQLDBACCESSOR_H__ |
|
17 #define __SQLDBACCESSOR_H__ |
|
18 |
|
19 #include <sqldb.h> |
|
20 #include <stringpool.h> |
|
21 #include "dbaccessor.h" |
|
22 |
|
23 const TInt KMaxDbStmtLen = 1024; |
|
24 |
|
25 _LIT8 (KUriTblName, "URITbl"); |
|
26 _LIT8 (KUriPropsTblName, "URIPropertiesTbl"); |
|
27 _LIT8 (KViewName, "URIView"); |
|
28 _LIT8 (KTriggerInsertView, "ViewInsert"); |
|
29 _LIT8 (KTriggerUpdateView, "ViewUpdate"); |
|
30 _LIT8 (KTriggerDeleteView, "ViewDelete"); |
|
31 _LIT8 (KTldTblName, "TLDTbl"); |
|
32 _LIT8 (KTldTblIndex, "TldIndex"); |
|
33 |
|
34 /** |
|
35 This class implements the operation that will be performed on the SQL storage. This class |
|
36 inherits from MDBAccessor class. It manages the SQL operations like creating tables, view and |
|
37 triggers. |
|
38 */ |
|
39 class CSqlDbAccessor : private CBase, public MDBAccessor |
|
40 { |
|
41 public: |
|
42 static MDBAccessor* NewL ( const RStringPool& aStringPool ); |
|
43 // Methods from MDBAccessor |
|
44 MDBTransaction* PrepareTransactionL ( const TDesC8& aQueryStmt ); |
|
45 TInt ExecuteScalarQueryL ( const TDesC8& aQueryStmt ); |
|
46 void ExecuteL ( const TDesC8& aStmt ); |
|
47 void BeginTransactionL (); |
|
48 void CommitTransactionL (); |
|
49 void RollbackTransaction (); |
|
50 void Release (); |
|
51 private: |
|
52 CSqlDbAccessor (); |
|
53 ~CSqlDbAccessor (); |
|
54 |
|
55 void ConstructL ( const RStringPool& aStringPool ); |
|
56 |
|
57 void InitializeL (); |
|
58 void CreateL ( const RStringPool& aStringPool ); |
|
59 void CreateSchemaL ( const RStringPool& aStringPool ); |
|
60 |
|
61 void CreateTableL ( const RStringPool& aStringPool ); |
|
62 void CreateViewL (); |
|
63 void CreateTriggerL (); |
|
64 private: |
|
65 RSqlDatabase iDatabase; |
|
66 }; |
|
67 |
|
68 #endif // __SQLDBACCESSOR_H__ |