ARRAY or DATABASE with oLbx?

ARRAY or DATABASE with oLbx?

Postby Otto » Mon May 04, 2009 9: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: Select all  Expand view  RUN
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
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: ARRAY or DATABASE with oLbx?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ARRAY or DATABASE with oLbx?

Postby Otto » 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: ARRAY or DATABASE with oLbx?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ARRAY or DATABASE with oLbx?

Postby Otto » Mon May 04, 2009 1:39 pm

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
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 10 guests