os/persistentdata/persistentstorage/sql/SRC/Server/SqlSrvBlob.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sql/SRC/Server/SqlSrvBlob.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,72 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __SQLSRVBLOB_H__
    1.20 +#define __SQLSRVBLOB_H__
    1.21 +
    1.22 +#include <s32buf.h>
    1.23 +
    1.24 +//Forward declarations
    1.25 +struct sqlite3_blob;
    1.26 +
    1.27 +/**
    1.28 +Stream buffer class with no intermediate buffering capabilities.
    1.29 +
    1.30 +The primary purpose of this class is:
    1.31 + - to read/write from/to a blob column using sqlite3_blob_read()/sqlite3_blob_write() SQLite functions;
    1.32 + - to serve as an IPC buffer for streaming the blob content from/to the client side dll;
    1.33 + 
    1.34 +The class overrides the following virtual MStreamBuf functions:
    1.35 + - DoRelease();
    1.36 + - DoSynchL();
    1.37 + - DoReadL();
    1.38 + - DoWriteL();
    1.39 + - DoSeekL();
    1.40 +
    1.41 +@internalComponent
    1.42 +*/
    1.43 +NONSHARABLE_CLASS(HBlobBuf) : public MStreamBuf
    1.44 +	{
    1.45 +public: 
    1.46 +	enum TMode 
    1.47 +		{
    1.48 +		EReadOnly,
    1.49 +		EReadWrite
    1.50 +		};
    1.51 +
    1.52 +public: 
    1.53 +	static HBlobBuf* NewL(sqlite3* aDb, const TDesC8& aDbName, const TDesC8&  aTableName, const TDesC8&  aColumnName, TInt64 aRowId, TMode aMode);
    1.54 +		
    1.55 +private:
    1.56 +	HBlobBuf();
    1.57 +	void ConstructL(sqlite3* aDb, const TDesC8& aDbName, const TDesC8& aTableName, const TDesC8& aColumnName, TInt64 aRowId, TMode aMode);
    1.58 +	
    1.59 +	virtual void DoRelease();
    1.60 +	virtual void DoSynchL();
    1.61 +	virtual TInt DoReadL(TAny* aPtr, TInt aMaxLength);
    1.62 +	virtual void DoWriteL(const TAny* aPtr, TInt aLength);
    1.63 +	virtual TStreamPos DoSeekL(MStreamBuf::TMark aMark, TStreamLocation aLocation, TInt aOffset);
    1.64 +
    1.65 +	sqlite3_blob* BlobHandleL();
    1.66 +
    1.67 +private:
    1.68 +	sqlite3_blob*	iBlobHandle;
    1.69 +	TInt 			iBlobSize;
    1.70 +	TInt			iWrPos;
    1.71 +	TInt			iRdPos;
    1.72 +	
    1.73 +	};
    1.74 +
    1.75 +#endif//__SQLSRVBLOB_H__