|
1 // Copyright (c) 2008-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 __SQLSRVBLOB_H__ |
|
17 #define __SQLSRVBLOB_H__ |
|
18 |
|
19 #include <s32buf.h> |
|
20 |
|
21 //Forward declarations |
|
22 struct sqlite3_blob; |
|
23 |
|
24 /** |
|
25 Stream buffer class with no intermediate buffering capabilities. |
|
26 |
|
27 The primary purpose of this class is: |
|
28 - to read/write from/to a blob column using sqlite3_blob_read()/sqlite3_blob_write() SQLite functions; |
|
29 - to serve as an IPC buffer for streaming the blob content from/to the client side dll; |
|
30 |
|
31 The class overrides the following virtual MStreamBuf functions: |
|
32 - DoRelease(); |
|
33 - DoSynchL(); |
|
34 - DoReadL(); |
|
35 - DoWriteL(); |
|
36 - DoSeekL(); |
|
37 |
|
38 @internalComponent |
|
39 */ |
|
40 NONSHARABLE_CLASS(HBlobBuf) : public MStreamBuf |
|
41 { |
|
42 public: |
|
43 enum TMode |
|
44 { |
|
45 EReadOnly, |
|
46 EReadWrite |
|
47 }; |
|
48 |
|
49 public: |
|
50 static HBlobBuf* NewL(sqlite3* aDb, const TDesC8& aDbName, const TDesC8& aTableName, const TDesC8& aColumnName, TInt64 aRowId, TMode aMode); |
|
51 |
|
52 private: |
|
53 HBlobBuf(); |
|
54 void ConstructL(sqlite3* aDb, const TDesC8& aDbName, const TDesC8& aTableName, const TDesC8& aColumnName, TInt64 aRowId, TMode aMode); |
|
55 |
|
56 virtual void DoRelease(); |
|
57 virtual void DoSynchL(); |
|
58 virtual TInt DoReadL(TAny* aPtr, TInt aMaxLength); |
|
59 virtual void DoWriteL(const TAny* aPtr, TInt aLength); |
|
60 virtual TStreamPos DoSeekL(MStreamBuf::TMark aMark, TStreamLocation aLocation, TInt aOffset); |
|
61 |
|
62 sqlite3_blob* BlobHandleL(); |
|
63 |
|
64 private: |
|
65 sqlite3_blob* iBlobHandle; |
|
66 TInt iBlobSize; |
|
67 TInt iWrPos; |
|
68 TInt iRdPos; |
|
69 |
|
70 }; |
|
71 |
|
72 #endif//__SQLSRVBLOB_H__ |