[Gambas-user] Adding results from different databases
Benoit Minisini
benoit.minisini at gambas-basic.org
Fri Dec 23 17:20:48 CET 2022
Le 23/12/2022 à 16:53, gian via User a écrit :
> Il 22/12/22 22:42, Benoit Minisini ha scritto:
>> A Result object is linked to the database driver it comes from, so the
>> answer is no. You have to create your own 'MyResult' class to simulate
>> the concatenation of several different Result objects.
>>
>> Regards,
>>
>> --
>> Benoît Minisini.
>
> Hi Benoit,
>
> I have been trying all day to create a working myResult class :-(
>
> Would you care to show me how to do it.
>
> Thanks for your attention and excuse my ignorance
>
> With sincere wishes for Happy Holidays
>
> Gianluigi
>
Something like that:
' class MyResultArray
Property Read Count as Integer
Private $aResult As New Result[]
Private $iIndex As Integer
Public Sub AddResult(rResult As Result)
$aResult.Add(rResult)
End
Private Sub Count_Read() as Integer
Dim I as Integer
For I = 0 to $aResult.Max
iCount += $aResult[I].Count
Next
Return iCount
End
Public Sub MoveTo(Index As Integer)
$iIndex = Index
End
Public Sub _get(Field As String) As Variant
Dim I as Integer
Dim iIndex As Integer = $iIndex
For I = 0 to $aResult.Max
If iIndex < $aResult[I].Count Then
$aResult[I].MoveTo(iIndex)
Return $aResult[I][Field]
Endif
iIndex -= $aResult[I].Count
Next
End
--
Benoît Minisini.
More information about the User
mailing list