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: // sl@0: sl@0: #include "UT_STD.H" sl@0: sl@0: // Class RDbTableRow sl@0: sl@0: void RDbTableRow::Open(CDbTable* aTable) sl@0: // sl@0: // Initialise the row buffer for using the table sl@0: // sl@0: { sl@0: __ASSERT(!iTable); sl@0: __ASSERT(aTable); sl@0: iTable=aTable; sl@0: iMark.Construct(aTable->Generation()); sl@0: } sl@0: sl@0: void RDbTableRow::Close() sl@0: { sl@0: if (iTable) sl@0: iTable->Close(); sl@0: RDbRow::Close(); sl@0: } sl@0: sl@0: EXPORT_C void RDbTableRow::ReadL(TDbRecordId aRecordId) sl@0: { sl@0: if (aRecordId==KDbNullRecordId) sl@0: { sl@0: Reset(); sl@0: iRecord=aRecordId; sl@0: iMark.Mark(); sl@0: } sl@0: else if (aRecordId!=iRecord || iMark.Changed()) sl@0: { sl@0: Reset(); sl@0: iRecord=KDbNullRecordId; sl@0: iTable->ReadRowL(*this,aRecordId); sl@0: iRecord=aRecordId; sl@0: iMark.Mark(); sl@0: } sl@0: } sl@0: sl@0: void RDbTableRow::NewL(TDbRecordId aCopyRecord) sl@0: // sl@0: // Set the row buffer for a new row sl@0: // sl@0: { sl@0: ReadL(aCopyRecord); // copy or empty the row sl@0: if (aCopyRecord!=KDbNullRecordId) sl@0: { sl@0: iRecord=KDbNullRecordId; sl@0: iTable->DuplicateBlobsL(*this); // duplicate any Blobs sl@0: } sl@0: iTable->NewRowL(*this); sl@0: } sl@0: sl@0: void RDbTableRow::PrepareAppendL() sl@0: { sl@0: iTable->PrepareAppendL(*this); sl@0: } sl@0: sl@0: TDbRecordId RDbTableRow::AppendL() sl@0: { sl@0: iRecord=iTable->AppendRowL(*this); sl@0: iMark.Mark(); sl@0: return iRecord; sl@0: } sl@0: sl@0: void RDbTableRow::PrepareReplaceL() sl@0: { sl@0: if (iMark.Changed()) sl@0: __LEAVE(KErrAccessDenied); sl@0: iTable->PrepareReplaceL(*this,iRecord); sl@0: } sl@0: sl@0: TDbRecordId RDbTableRow::ReplaceL() sl@0: { sl@0: iTable->ReplaceRowL(*this,iRecord); sl@0: iMark.Mark(); sl@0: return iRecord; sl@0: } sl@0: sl@0: void RDbTableRow::DeleteL(TDbRecordId aRecordId) sl@0: { sl@0: iTable->DeleteRowL(*this,aRecordId); sl@0: }