os/persistentdata/persistentstorage/dbms/pcdbms/udbms/UD_OBSVR.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/dbms/pcdbms/udbms/UD_OBSVR.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,109 @@
     1.4 +// Copyright (c) 1998-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 +// Client observer class
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "UD_STD.H"
    1.22 +
    1.23 +// Class RDbNotifier
    1.24 +
    1.25 +EXPORT_C TInt RDbNotifier::Open(RDbDatabase& aDatabase)
    1.26 +/** Opens a DBMS change notifier on a database.
    1.27 +
    1.28 +Note that a notifier cannot be opened on a client side database.
    1.29 +
    1.30 +@param aDatabase The database to be observed.
    1.31 +@return KErrNone if successful, otherwise another of the system-wide error 
    1.32 +codes. */
    1.33 +	{
    1.34 +	TRAPD(r,iNotifier=aDatabase.iDatabase->NotifierL());
    1.35 +	return r;
    1.36 +	}
    1.37 + 
    1.38 +EXPORT_C void RDbNotifier::Close()
    1.39 +/** Closes a DBMS change notifier. Any outstanding notification request is automatically 
    1.40 +cancelled.
    1.41 +
    1.42 +Note that this function can be called on a DBMS change notifier that has already 
    1.43 +been closed. */
    1.44 +	{
    1.45 +	iNotifier.Close();
    1.46 +	}
    1.47 +
    1.48 +//LOCAL_C void Notify(RDbHandle<CDbNotifier>& aNotifier,TRequestStatus& aStatus,CDbNotifier::TType aType)
    1.49 +//	{
    1.50 +//	aNotifier->Notify(aType,aStatus);
    1.51 +//	}
    1.52 +
    1.53 +//EXPORT_C void RDbNotifier::NotifyUnlock(TRequestStatus& aStatus)
    1.54 +///** Makes an asynchronous request for notification of a database event. All events, 
    1.55 +//including the release of all read locks, are reported.
    1.56 +//
    1.57 +//When a database event occurs, the request completes and the TRequestStatus 
    1.58 +//objectcontains one of the enumerators defined by the TEvent enumeration member.
    1.59 +//
    1.60 +//Alternatively, if an outstanding request is cancelled by a call to the Cancel() 
    1.61 +//member function of this class, then the request completes with KErrCancel.
    1.62 +//
    1.63 +//Only one notification request can be outstanding on this notifier at any one 
    1.64 +//time.
    1.65 +//
    1.66 +//Note that if further database events occur while a client is handling a request 
    1.67 +//completion, the notifier records the most significant database event and this 
    1.68 +//is signalled as soon as the client issues the next NotifyUnlock() or NotifyChange() 
    1.69 +//request.
    1.70 +//
    1.71 +//@param aStatus The request status object. If the request is cancelled, this 
    1.72 +//is set to KErrCancel. If the request completes normally, this is set to one 
    1.73 +//of the enumerator values defined by the TEvent enumeration member. */
    1.74 +//	{
    1.75 +//	::Notify(iNotifier,aStatus,CDbNotifier::EUnlock);
    1.76 +//	}
    1.77 +
    1.78 +//EXPORT_C void RDbNotifier::NotifyChange(TRequestStatus& aStatus)
    1.79 +///** Makes an asynchronous request for notification of changes to the database.
    1.80 +//
    1.81 +//All events which indicate a change to the database are reported; in practice, 
    1.82 +//this means all database events except RDbNotifier::EUnlock.
    1.83 +//
    1.84 +//When a change event occurs, the request completes and the TRequestStatus object 
    1.85 +//contains one of the appropriate enumerators defined by the TEvent enumeration 
    1.86 +//member.
    1.87 +//
    1.88 +//Alternatively, if an outstanding request is cancelled by a call to the Cancel() 
    1.89 +//member function of this class, then the request completes with KErrCancel.
    1.90 +//
    1.91 +//Only one notification request can be outstanding on this notifier at any one 
    1.92 +//time.
    1.93 +//
    1.94 +//Note that if further database events occur while a client is handling a request 
    1.95 +//completion, the notifier records the most significant database event and this 
    1.96 +//is signalled as soon as the client issues the next NotifyUnlock() or NotifyChange() 
    1.97 +//request.
    1.98 +//
    1.99 +//@param aStatus The request status object. If the request is cancelled, this 
   1.100 +//is set to KErrCancel. If the request completes normally, this is set to one 
   1.101 +//of the enumerator values defined by the TEvent enumeration member. */
   1.102 +//	{
   1.103 +//	::Notify(iNotifier,aStatus,CDbNotifier::EChange);
   1.104 +//	}
   1.105 +
   1.106 +//EXPORT_C void RDbNotifier::Cancel()
   1.107 +///** Cancels any outstanding notification request to this DBMS notifier.
   1.108 +//
   1.109 +//The outstanding request completes with a KErrCancel. */
   1.110 +//	{
   1.111 +//	iNotifier->Cancel();
   1.112 +//	}