|
1 // Copyright (c) 2006-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 // Global sql statement related functions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __SQLSRVSTATEMENTUTIL_H__ |
|
19 #define __SQLSRVSTATEMENTUTIL_H__ |
|
20 |
|
21 #include <e32std.h> |
|
22 |
|
23 //This header file contains useful utility function declarations. |
|
24 //These functions are used for accessging directly the SQLITE interface functions. |
|
25 |
|
26 //Forward declarations |
|
27 struct sqlite3; |
|
28 struct sqlite3_stmt; |
|
29 struct sqlite3_context; |
|
30 struct Mem; |
|
31 typedef struct Mem sqlite3_value; |
|
32 |
|
33 TInt CreateDbHandle16(const TDesC& aFileNameZ, sqlite3*& aDbHandle); |
|
34 TInt CreateDbHandle8(const TDesC8& aFileNameZ, sqlite3*& aDbHandle); |
|
35 inline void CloseDbHandle(sqlite3* aDbHandle); |
|
36 inline void CloseDbCleanup(void* aDbHandle); |
|
37 TPtrC GetFirstSqlStmt(TPtr& aString); |
|
38 TInt DbExecStmt16(sqlite3 *aDbHandle, TDes16& aSqlStmt); |
|
39 TInt DbExecStmt8(sqlite3 *aDbHandle, const TDesC8& aSqlStmt); |
|
40 |
|
41 sqlite3_stmt* StmtPrepare16L(sqlite3* aDbHandle, const TDesC16& aSqlStmt); |
|
42 TInt StmtPrepare8(sqlite3* aDbHandle, const TDesC8& aSqlStmt, sqlite3_stmt*& aStmtHandle); |
|
43 sqlite3_stmt* StmtPrepare8L(sqlite3* aDbHandle, const TDesC8& aSqlStmt); |
|
44 TInt FinalizeStmtHandle(sqlite3_stmt* aStmtHandle); |
|
45 TInt StmtExec(sqlite3_stmt* aStmtHandle); |
|
46 TInt StmtNext(sqlite3_stmt* aStmtHandle); |
|
47 TInt StmtReset(sqlite3_stmt* aStmtHandle); |
|
48 |
|
49 TInt DbPageCount(sqlite3* aDbHandle, const TDesC& aDbName, TInt& aPageCount); |
|
50 TInt DbPageSize(sqlite3* aDbHandle, const TDesC& aDbName, TInt& aPageSize); |
|
51 TInt DbCacheSize(sqlite3* aDbHandle, const TDesC& aDbName, TInt& aCacheSize); |
|
52 TInt DbEncoding(sqlite3* aDbHandle, const TDesC& aDbName, TDes8& aEncoding); |
|
53 TInt DbFreePageCount(sqlite3* aDbHandle, const TDesC& aDbName, TInt& aPageCount); |
|
54 TInt DbVacuumMode(sqlite3* aDbHandle, const TDesC& aDbName, TInt& aVacuumMode); |
|
55 TInt DbCompact(sqlite3* aDbHandle, const TDesC& aDbName, TInt aPageCount, TInt& aProcessedPageCount, TInt aMaxTime = 0); |
|
56 |
|
57 #include "SqlSrvStatementUtil.inl" |
|
58 |
|
59 #endif//__SQLSRVSTATEMENTUTIL_H__ |