dbSkip / Tautoget question

Post Reply
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

dbSkip / Tautoget question

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Re: dbSkip / Tautoget question

Post by Frank Demont »

Marc

On 6-10 there was a discussion : cmxShared()

Have you tried to use cmxShared(.f.) ?

Frank
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: dbSkip / Tautoget question

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: dbSkip / Tautoget question

Post 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
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: dbSkip / Tautoget question

Post 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
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: dbSkip / Tautoget question

Post by James Bott »

Mark,

Please email me at jbott at compuserve dot com.

James
Post Reply