presetserver/clientsrc/Pstransaction.cpp
changeset 0 09774dfdd46b
child 12 608f67c22514
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Transaction implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <pstransaction.h>
       
    20 
       
    21 // ---------------------------------------------------------------------------
       
    22 // Two-phased constructor.
       
    23 // ---------------------------------------------------------------------------
       
    24 //
       
    25 CPSTransaction* CPSTransaction::NewL( MPSTransactionEntity& aEntity )
       
    26     {
       
    27     CPSTransaction* self = new ( ELeave ) CPSTransaction( aEntity );
       
    28     CleanupStack::PushL( self );
       
    29     self->ConstructL();
       
    30     CleanupStack::Pop( self );
       
    31     return self;
       
    32     }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // Constructor.
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CPSTransaction::CPSTransaction( MPSTransactionEntity& aEntity )
       
    39     : iEntity( aEntity )
       
    40     {
       
    41     }
       
    42     
       
    43 // ---------------------------------------------------------------------------
       
    44 // Second-phase constructor.
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CPSTransaction::ConstructL()
       
    48     {
       
    49     iEntity.BeginTransactionL();
       
    50     }
       
    51     
       
    52 // ---------------------------------------------------------------------------
       
    53 // Destructor.
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CPSTransaction::~CPSTransaction()
       
    57     {
       
    58     iEntity.Rollback();
       
    59     }
       
    60     
       
    61 // ---------------------------------------------------------------------------
       
    62 // Commits all changes done during the transaction.
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C void CPSTransaction::CommitL()
       
    66     {
       
    67     iEntity.CommitL();
       
    68     }
       
    69     
       
    70 // ---------------------------------------------------------------------------
       
    71 // Reverts all changes done during the transaction.
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C void CPSTransaction::Rollback()
       
    75     {
       
    76     iEntity.Rollback();
       
    77     }