dbSkip / Tautoget question

dbSkip / Tautoget question

Postby Marc Vanzegbroeck » Fri Nov 12, 2010 9:38 am

Hello,

I use TAutoget class in my program.
To fill my array I use

Code: Select all  Expand view  RUN
       
        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/viewtopic.php?f=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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: dbSkip / Tautoget question

Postby Frank Demont » Fri Nov 12, 2010 3:59 pm

Marc

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

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

Frank
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Re: dbSkip / Tautoget question

Postby Marc Vanzegbroeck » Fri Nov 12, 2010 6:35 pm

Frank,

I get an error
Code: Select all  Expand view  RUN
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: dbSkip / Tautoget question

Postby Marcelo Via Giglio » Sat Nov 13, 2010 12:25 am

Hola

try directly from table (dbf)


Code: Select all  Expand view  RUN


   REDEFINE GET oGet ID 101 OF oDlg  ;
            UPDATE  ;
            PICTURE "@!"

            oGet:bPostKey := {|oGet, cBuffer| setCliente( oget ) }

 



Code: Select all  Expand view  RUN

//------------------------------------------------------------------------------
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
Marcelo Via Giglio
 
Posts: 1071
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: dbSkip / Tautoget question

Postby Marc Vanzegbroeck » Sat Nov 13, 2010 9:39 am

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

Re: dbSkip / Tautoget question

Postby James Bott » Sat Nov 13, 2010 6:18 pm

Mark,

Please email me at jbott at compuserve dot com.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests