James Bott wrote:Marc,
You really need to avoid filters. Filters require reading the entire database each time you call them. So for an incremental search of 10 characters you are going to read the entire database 10 times.
Even if you don't do an incremental search, you still have to read the entire database using a filter. Using a scope you only read the database records you need. Way faster!
Another possibility is to use a scope, then filter only the records in the scope.
DATABASE oKlant // my early way
and then stuff for oKlant
I see many times :
oCustomers:= TDatabase():New(,"temp",,.f.)
oCustomers:use()
Is the second way the way it should be done in order to use ALL options in FWH or is it the same ?
Class TCustomers from TDatabase
Method New()
Endclass
Method New Class TCustomers
::use(,"Customers","customers")
Return self
oCustomers := TCustomers():new() // create the table object
oCustomers:seek("12345")
oCustomer:= TCustomer():New(oCustomers:custno) // create a customer object
oCustomer:AcceptPayment( nAmount, dDate)
// Usage
oBill:=TPublic():New(.T.)
// Vaiables Declaration
oBill:nBillNo:=100
oBill:dBillDate:=Date()
oBill:cCustCode:=Space(10)
oBill:cCustName:=Space(35)
I used
DATABASE oKlant // my early way
and then stuff for oKlant
I see many times :
oCustomers:= TDatabase():New(,"temp",,.f.)
oCustomers:use()
Is the second way the way it should be done in order to use ALL options in FWH or is it the same ?
Class TCustomers from TDatabase
Method New()
Endclass
Method New( lShared ) Class TCustomers
Default lShared:= .T.
super:new(,"Customers",,lShared) // database filename only exists here.
::use()
Return Self
The variable oCustomers should be declared as LOCAL. Note that you can still pass oCustomers to a function if you wish.
The variable oCustomers should be declared as LOCAL. Note that you can still pass oCustomers to a function if you wish.
Why not public? Then the oCustomers is visible everywhere and we don't have to paste them by a function.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 71 guests