Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTResource::First

Retrieve the first resource stored in a table.

Declaration

CTBOOL CTResource::First(CTBOOL lock) const;

Description

Retrieves the first resource stored in a table. lock is used to indicate if the resource should be locked, if it is found.

Return

CTResource::First() returns YES if the first resource was retrieved or NO if first resource does not exist. In case of error, a CTException is thrown.

Example


void DisplayAllResources(const CTTable& hTable)

{

CTResource* hRes = new CTResource(hTable);


try

{

// get the first resource

if (hRes->First())

{

do

{

// display resource type, number and name

printf("Resource type: %u, number: %u",

hRes->GetType(), hRes->GetNumber());

}

while (hRes->Next());

}

}

catch (CTException &err)

{

printf("Error %d - %s\n", err.GetErrorCode(), err.GetErrorMsg());

}

delete hRes;

}

See Also

CTResource::Add(), CTResource::Delete(), CTResource::Update(), CTResource::Next(), CTResource::Find(), CTResource::GetType(), CTResource::SetType(), CTResource::GetNumber(), CTResource::SetNumber(), CTResource::GetName(), CTResource::SetName(), CTResource::GetDataLength(), CTResource::GetData(), CTResource::SetData(), CTResource::Unlock(), CTResource::IsLocked()

TOCIndex