os/persistentdata/persistentstorage/dbms/utable/UT_ROW.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "UT_STD.H"
sl@0
    17
sl@0
    18
// Class RDbTableRow
sl@0
    19
sl@0
    20
void RDbTableRow::Open(CDbTable* aTable)
sl@0
    21
//
sl@0
    22
// Initialise the row buffer for using the table
sl@0
    23
//
sl@0
    24
	{
sl@0
    25
	__ASSERT(!iTable);
sl@0
    26
	__ASSERT(aTable);
sl@0
    27
	iTable=aTable;
sl@0
    28
	iMark.Construct(aTable->Generation());
sl@0
    29
	}
sl@0
    30
sl@0
    31
void RDbTableRow::Close()
sl@0
    32
	{
sl@0
    33
	if (iTable)
sl@0
    34
		iTable->Close();
sl@0
    35
	RDbRow::Close();
sl@0
    36
	}
sl@0
    37
sl@0
    38
EXPORT_C void RDbTableRow::ReadL(TDbRecordId aRecordId)
sl@0
    39
	{
sl@0
    40
	if (aRecordId==KDbNullRecordId)
sl@0
    41
		{
sl@0
    42
		Reset();
sl@0
    43
		iRecord=aRecordId;
sl@0
    44
		iMark.Mark();
sl@0
    45
		}
sl@0
    46
	else if (aRecordId!=iRecord || iMark.Changed())
sl@0
    47
		{
sl@0
    48
		Reset();
sl@0
    49
		iRecord=KDbNullRecordId;
sl@0
    50
		iTable->ReadRowL(*this,aRecordId);
sl@0
    51
		iRecord=aRecordId;
sl@0
    52
		iMark.Mark();
sl@0
    53
		}
sl@0
    54
	}
sl@0
    55
sl@0
    56
void RDbTableRow::NewL(TDbRecordId aCopyRecord)
sl@0
    57
//
sl@0
    58
// Set the row buffer for a new row
sl@0
    59
//
sl@0
    60
	{
sl@0
    61
	ReadL(aCopyRecord);			// copy or empty the row
sl@0
    62
	if (aCopyRecord!=KDbNullRecordId)
sl@0
    63
		{
sl@0
    64
		iRecord=KDbNullRecordId;
sl@0
    65
		iTable->DuplicateBlobsL(*this);		// duplicate any Blobs
sl@0
    66
		}
sl@0
    67
	iTable->NewRowL(*this);
sl@0
    68
	}
sl@0
    69
sl@0
    70
void RDbTableRow::PrepareAppendL()
sl@0
    71
	{
sl@0
    72
	iTable->PrepareAppendL(*this);
sl@0
    73
	}
sl@0
    74
sl@0
    75
TDbRecordId RDbTableRow::AppendL()
sl@0
    76
	{
sl@0
    77
	iRecord=iTable->AppendRowL(*this);
sl@0
    78
	iMark.Mark();
sl@0
    79
	return iRecord;
sl@0
    80
	}
sl@0
    81
sl@0
    82
void RDbTableRow::PrepareReplaceL()
sl@0
    83
	{
sl@0
    84
	if (iMark.Changed())
sl@0
    85
		__LEAVE(KErrAccessDenied);
sl@0
    86
	iTable->PrepareReplaceL(*this,iRecord);
sl@0
    87
	}
sl@0
    88
sl@0
    89
TDbRecordId RDbTableRow::ReplaceL()
sl@0
    90
	{
sl@0
    91
	iTable->ReplaceRowL(*this,iRecord);
sl@0
    92
	iMark.Mark();
sl@0
    93
	return iRecord;
sl@0
    94
	}
sl@0
    95
sl@0
    96
void RDbTableRow::DeleteL(TDbRecordId aRecordId)
sl@0
    97
	{
sl@0
    98
	iTable->DeleteRowL(*this,aRecordId);
sl@0
    99
	}