Best way to find a single record with simple find
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Aug 4 11:52:35 CDT 2003
on 8/4/03 10:00, Matthew Jew at mjew at icnc.com wrote:
Hi Matthew ,
> I am wondering what the simplest way to find a single record given a
> field containing unique, indexed values to search on.
>
> It seems the simplest way in Valentina is to do something like:
>
> FBL_BitSet *articleNumberBitSet = theTable.articleNumber.Find(
> &anArticleNumber );
> FBL_ArraySet *anArraySet = new FBL_ArraySet( *articleNumberBitSet );
>
> ID_TYPE theRecordNumber = anArraySet(1);
>
> which will give you the record number in three simple steps.
>
> Of course, one could instead
>
> FBL_BitSet *articleNumberBitSet = theTable.articleNumber.Find(
> &anArticleNumber );
> FBL_BitSetIterator *anIterator = new FBL_BitSetIterator(
> *articleNumberBitSet );
>
> ID_TYPE theRecordNumber = anIterator ->FirstItem();
>
> again, three simple steps (I think I have it right).
>
> I was wondering if in these cases where one *knows* there is only one
> record to find if there is a method like
Please note VDK_Field::FindAsArraySet() method
If you compare it to your above first way, you will see that you get 2
steps. Besides this method eat less RAM when we KNOW that will be found few
records.
I also have think about method that simply returns one record.
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list