|
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 __DBACCESSOR_H__ |
|
17 #define __DBACCESSOR_H__ |
|
18 |
|
19 |
|
20 class MDBTransaction |
|
21 { |
|
22 public: |
|
23 /** |
|
24 Bind the parameter for the query statement |
|
25 */ |
|
26 virtual void BindTextL ( TInt aParamPos, const TDesC8& aParamValue ) = 0; |
|
27 |
|
28 virtual void BindIntL ( TInt aParamPos, TInt aParamValue ) = 0; |
|
29 /** |
|
30 Execute the query and returns the record set. |
|
31 */ |
|
32 virtual TInt ExecuteL () = 0; |
|
33 |
|
34 /** |
|
35 Get the column value by passing the column index |
|
36 */ |
|
37 virtual TPtrC8 ColumnTextL ( TInt aFieldPos ) = 0; |
|
38 virtual TInt ColumnIntL ( TInt aFieldPos ) = 0; |
|
39 |
|
40 /** |
|
41 Move to the next record. Returns EFalse in the case of end of record |
|
42 */ |
|
43 virtual TBool Next () = 0; |
|
44 |
|
45 /** |
|
46 Cleanup the object |
|
47 */ |
|
48 virtual void Release () = 0; |
|
49 }; |
|
50 |
|
51 class MDBAccessor |
|
52 { |
|
53 public: |
|
54 /** |
|
55 Prepare the transaction and returns a transaction object |
|
56 */ |
|
57 virtual MDBTransaction* PrepareTransactionL ( const TDesC8& aQueryStmt ) = 0; |
|
58 /** |
|
59 Function does a scalar query and returns the result value |
|
60 */ |
|
61 virtual TInt ExecuteScalarQueryL ( const TDesC8& aQueryStmt ) = 0; |
|
62 /** |
|
63 The following methods are used for BEGIN/COMMIT/ROLLBACK transaction |
|
64 with the database |
|
65 */ |
|
66 virtual void BeginTransactionL () = 0; |
|
67 virtual void CommitTransactionL () = 0; |
|
68 virtual void RollbackTransaction () = 0; |
|
69 |
|
70 /** |
|
71 Cleanup the object |
|
72 */ |
|
73 virtual void Release () = 0; |
|
74 }; |
|
75 |
|
76 #endif // __SQLDBACCESSOR_H__ |