Page 1 of 1
dbSkip / Tautoget question
Posted: Fri Nov 12, 2010 9:38 am
by Marc Vanzegbroeck
Hello,
I use TAutoget class in my program.
To fill my array I use
Code: Select all
klanten->(dbgotop())
do while !klanten->(eof())
aadd(aItems,(klanten->naam))
klanten->(dbskip())
enddo
The problem is that on a network, see
http://forums.fivetechsupport.com/viewt ... =3&t=19548 the program slows down and just to fill this array, it take 20sec (4500 records). (When no other user has opened the program, only 0.2sec)
Is there a faster was to fill my array, or can Tautoget can direcly seek in a database instead of an array
Thanks,
Marc
Re: dbSkip / Tautoget question
Posted: Fri Nov 12, 2010 3:59 pm
by Frank Demont
Marc
On 6-10 there was a discussion : cmxShared()
Have you tried to use cmxShared(.f.) ?
Frank
Re: dbSkip / Tautoget question
Posted: Fri Nov 12, 2010 6:35 pm
by Marc Vanzegbroeck
Frank,
I get an error
Code: Select all
Error: Unresolved external '_HB_FUN_CMXSHARED'
after adding the code. It seems to be a function of the commercial version of xHarbour.
Thanks,
Marc
Re: dbSkip / Tautoget question
Posted: Sat Nov 13, 2010 12:25 am
by Marcelo Via Giglio
Hola
try directly from table (dbf)
Code: Select all
REDEFINE GET oGet ID 101 OF oDlg ;
UPDATE ;
PICTURE "@!"
oGet:bPostKey := {|oGet, cBuffer| setCliente( oget ) }
Code: Select all
//------------------------------------------------------------------------------
FUNCTION setCliente( oGet )
//------------------------------------------------------------------------------
LOCAL nPosItem := 0
LOCAL nPosCursor := oGet:nPos // Current cursor position
LOCAL nLength := LEN(oGet:cText) // Text length
LOCAL cStartTxt := LEFT(oGet:cText, nPosCursor-1) // Start text (position 1 to cursor position -1)
LOCAL cItem := ""
LOCAL nKey := 0
nKey := oGet:nLastKey
DO CASE
CASE nKey == VK_TAB .or. ;
nKey == VK_RETURN .or. ;
nKey == VK_DELETE
oGet:Assign() // Assign typed text
CASE nKey >= 32 .And. nKey <= 256
clientes -> ( DBEXIST( cStartTxt, "nombre", .T. ) )
cItem := clientes -> nombre
IF LEFT( cItem, LEN(cStartTxt) ) = cStartTxt
nLength := LEN( RTRIM( cItem ) )
cItem += SPACE( nLength - LEN(cItem) )
oGet:SetText( cItem )
oGet:SetSel( nPosCursor -1, nLength) // Select found text
oGet:oGet:Buffer = PAD( cItem, LEN( oGet:oGet:Buffer ))
RETURN(.t.)
ENDIF
oGet:HideSel() // Text not found -> Undo selected text
ENDCASE
RETURN( .T. )
This is not a generic solution, it's particular solution, I hope can be an start to solve your problem
regards
Marcelo
Re: dbSkip / Tautoget question
Posted: Sat Nov 13, 2010 9:39 am
by Marc Vanzegbroeck
Thanks Marcelo,
I already changed the code yesterday evening in something like this. I only have to change it to meke in more generic by passing the database-name, indexkey and the fieldname to search.
Regards,
Marc
Re: dbSkip / Tautoget question
Posted: Sat Nov 13, 2010 6:18 pm
by James Bott
Mark,
Please email me at jbott at compuserve dot com.
James