sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Client observer class sl@0: // sl@0: // sl@0: sl@0: #include "UD_STD.H" sl@0: sl@0: // Class RDbNotifier sl@0: sl@0: EXPORT_C TInt RDbNotifier::Open(RDbDatabase& aDatabase) sl@0: /** Opens a DBMS change notifier on a database. sl@0: sl@0: Note that a notifier cannot be opened on a client side database. sl@0: sl@0: @param aDatabase The database to be observed. sl@0: @return KErrNone if successful, otherwise another of the system-wide error sl@0: codes. */ sl@0: { sl@0: TRAPD(r,iNotifier=aDatabase.iDatabase->NotifierL()); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C void RDbNotifier::Close() sl@0: /** Closes a DBMS change notifier. Any outstanding notification request is automatically sl@0: cancelled. sl@0: sl@0: Note that this function can be called on a DBMS change notifier that has already sl@0: been closed. */ sl@0: { sl@0: iNotifier.Close(); sl@0: } sl@0: sl@0: //LOCAL_C void Notify(RDbHandle& aNotifier,TRequestStatus& aStatus,CDbNotifier::TType aType) sl@0: // { sl@0: // aNotifier->Notify(aType,aStatus); sl@0: // } sl@0: sl@0: //EXPORT_C void RDbNotifier::NotifyUnlock(TRequestStatus& aStatus) sl@0: ///** Makes an asynchronous request for notification of a database event. All events, sl@0: //including the release of all read locks, are reported. sl@0: // sl@0: //When a database event occurs, the request completes and the TRequestStatus sl@0: //objectcontains one of the enumerators defined by the TEvent enumeration member. sl@0: // sl@0: //Alternatively, if an outstanding request is cancelled by a call to the Cancel() sl@0: //member function of this class, then the request completes with KErrCancel. sl@0: // sl@0: //Only one notification request can be outstanding on this notifier at any one sl@0: //time. sl@0: // sl@0: //Note that if further database events occur while a client is handling a request sl@0: //completion, the notifier records the most significant database event and this sl@0: //is signalled as soon as the client issues the next NotifyUnlock() or NotifyChange() sl@0: //request. sl@0: // sl@0: //@param aStatus The request status object. If the request is cancelled, this sl@0: //is set to KErrCancel. If the request completes normally, this is set to one sl@0: //of the enumerator values defined by the TEvent enumeration member. */ sl@0: // { sl@0: // ::Notify(iNotifier,aStatus,CDbNotifier::EUnlock); sl@0: // } sl@0: sl@0: //EXPORT_C void RDbNotifier::NotifyChange(TRequestStatus& aStatus) sl@0: ///** Makes an asynchronous request for notification of changes to the database. sl@0: // sl@0: //All events which indicate a change to the database are reported; in practice, sl@0: //this means all database events except RDbNotifier::EUnlock. sl@0: // sl@0: //When a change event occurs, the request completes and the TRequestStatus object sl@0: //contains one of the appropriate enumerators defined by the TEvent enumeration sl@0: //member. sl@0: // sl@0: //Alternatively, if an outstanding request is cancelled by a call to the Cancel() sl@0: //member function of this class, then the request completes with KErrCancel. sl@0: // sl@0: //Only one notification request can be outstanding on this notifier at any one sl@0: //time. sl@0: // sl@0: //Note that if further database events occur while a client is handling a request sl@0: //completion, the notifier records the most significant database event and this sl@0: //is signalled as soon as the client issues the next NotifyUnlock() or NotifyChange() sl@0: //request. sl@0: // sl@0: //@param aStatus The request status object. If the request is cancelled, this sl@0: //is set to KErrCancel. If the request completes normally, this is set to one sl@0: //of the enumerator values defined by the TEvent enumeration member. */ sl@0: // { sl@0: // ::Notify(iNotifier,aStatus,CDbNotifier::EChange); sl@0: // } sl@0: sl@0: //EXPORT_C void RDbNotifier::Cancel() sl@0: ///** Cancels any outstanding notification request to this DBMS notifier. sl@0: // sl@0: //The outstanding request completes with a KErrCancel. */ sl@0: // { sl@0: // iNotifier->Cancel(); sl@0: // }