Popular Posts

Showing posts with label table methods. Show all posts
Showing posts with label table methods. Show all posts

Thursday, 14 July 2011

find and exit methods in tables

Exist Method:
static boolean exist(ItemId  itemId)--->this is key which is primary
{
    return itemId && (select RecId from inventTable -->table name
                index hint ItemIdx--->index name in table
                where inventTable.ItemId == itemId
                ).RecId != 0;
}
Find Method:
static InventTable find(ItemId      itemId,
                        boolean    update = false--->to define how many primarykeys in table )
{
    InventTable  inventTable;
    ;
    inventTable.selectForUpdate(update);
    if (itemId)
    {
        select firstonly inventTable-->table name
            index hint ItemIdx-->index name
            where inventTable.ItemId == itemId;
    }
    return inventTable;
}