ARRAY or DATABASE with oLbx?

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

ARRAY or DATABASE with oLbx?

Post by Otto »

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: Select all

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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ARRAY or DATABASE with oLbx?

Post by Antonio Linares »

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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: ARRAY or DATABASE with oLbx?

Post by Otto »

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

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ARRAY or DATABASE with oLbx?

Post by Antonio Linares »

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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: ARRAY or DATABASE with oLbx?

Post by Otto »

Hello Antonio,

conditional is the solution.
Now it is high speed.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply