FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC ARRAY or DATABASE with oLbx?
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
ARRAY or DATABASE with oLbx?
Posted: Mon May 04, 2009 09:48 AM
Hello Antonio,
I found out that a kind of „recordset” approach - oLbx with ARRAY - works much faster than using the database.
Are you aware of advantages / disadvantages of using ARRAYS.
Thanks in advance
Otto

With ARRAY (much faster)
Code (fw): Select all Collapse
do while .not. eof()
aadd(arr1,{ str(RECHNUNG->menge),str(RECHNUNG->vmenge), RECHNUNG->bezeichnun,str(RECHNUNG->Wert )})
skip
enddo

   @ 0, 0 LISTBOX oBrwRG ;
    FIELDS "", "" ,"","";
    HEADERS "ME", "VMe", "Bezeichnung","Preis" ;
    SIZE 240, 195 PIXEL OF oWndRG
   oBrwRG:bLine = { || { arr1[oBrwRG:nAt,1], arr1[oBrwRG:nAt,2], arr1[oBrwRG:nAt,3], arr1[oBrwRG:nAt,4] } }
   oBrwRG:SetArray( arr1 )



Database:

select RECHNUNG
go top

@ 0, 0 LISTBOX oBrwRG ;
FIELDS ALLTRIM(str(RECHNUNG->menge-RECHNUNG->vmenge)),ALLTRIM(str(RECHNUNG->vmenge)), RECHNUNG->bezeichnun,str(RECHNUNG->Wert);
HEADERS "ME", "VMe", "Bezeichnung","Preis";
ALIAS "RECHNUNG";
fieldsizes 30,30,110,30;
SIZE 240, 195 OF oWndRG
SELECT RECHNUNG->AKTIV FOR " " TO " "





Best regards,
Otto
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ARRAY or DATABASE with oLbx?
Posted: Mon May 04, 2009 10:34 AM

Otto,

An array is entirely hold in memory, it does not need any disk access, thus it is faster.

Anyhow, if you are doing your tests in the Pocket PC memory card, please keep in mind that the memory card as harddisk is slower than using a Pocket PC folder in its harddisk.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: ARRAY or DATABASE with oLbx?
Posted: Mon May 04, 2009 11:35 AM

Hello Antonio,
I made more tests and found out that it is the "select for to" what makes it slow.

Best regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ARRAY or DATABASE with oLbx?
Posted: Mon May 04, 2009 12:12 PM

Otto,

> "select for to"

Yes, as it works as a filter. You should always use conditional indexes instead

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: ARRAY or DATABASE with oLbx?
Posted: Mon May 04, 2009 01:39 PM

Hello Antonio,

conditional is the solution.
Now it is high speed.

Best regards,
Otto

Continue the discussion