[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What happened to gb.db2?


Thanks Benoit.
In my controls behaviourIn I need to access the field directly by its
position. I used to do it the way I described (miResult.Fields[n]... etc.).
With DB2. That didn't work, so I passed the names to a String[] and then I
could find the number via .Find("FieldName"). The method you're suggesting
is certainly more flexible and faster than mine.
Thank you very much.

El dom, 27 abr 2025 a las 20:41, Benoît Minisini (<
benoit.minisini@xxxxxxxxxxxxxxxx>) escribió:

> Le 27/04/2025 à 16:58, Jorge Carrión a écrit :
> > In gb.db, resultFields is an Array[] of resultFields objects. You can
> > obtain the name of a field with MyResult.Fields[n].Name.
> > In gb.db2 resultFields is a collection with the Field.Name as key and
> > the resultfield object as value. You can obtain the name of a field with
> > MyResult.fields["name"], for example.
> >
>
> Result.Fields is not an array, it's a collection-like object, but it has
> a trick I forgotten that can use number as key, so that it acts like an
> array too.
>
> In 'gb.db2', Result.Fields returns a true collection, because it was
> faster to do that so, and so that you can use all the Collection methods
> and properties for free.
>
> To be 100% backward-compatible, I have to implement a special object
> that mimics both collection and array.
>
> Anyway, note that the following code:
>
>    Dim hField As ResultField
>    For Each hkey In r.Fields
>      $cFields.Add(hKey.Name)
>    Next
>
> works both with 'gb.db' and 'gb.db2'.
>
> Regards,
>
> --
> Benoît Minisini.
>
>
>

References:
What happened to gb.db2?Jorge Carrión <shordi@xxxxxxxxx>
Re: What happened to gb.db2?Christof Thalhofer <chrisml@xxxxxxxxxxx>
Re: What happened to gb.db2?Jorge Carrión <shordi@xxxxxxxxx>
Re: What happened to gb.db2?Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>