First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Global sql statement related functions
18 #ifndef __SQLSRVSTATEMENTUTIL_H__
19 #define __SQLSRVSTATEMENTUTIL_H__
23 //This header file contains useful utility function declarations.
24 //These functions are used for accessging directly the SQLITE interface functions.
26 //Forward declarations
29 struct sqlite3_context;
31 typedef struct Mem sqlite3_value;
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);
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);
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);
57 #include "SqlSrvStatementUtil.inl"
59 #endif//__SQLSRVSTATEMENTUTIL_H__