FW_DbfToArray() and meter

FW_DbfToArray() and meter

Postby lucasdebeltran » Fri May 25, 2012 12:21 pm

Hello,

Is possible to use a Metter with this function?.

Thanks.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: FW_DbfToArray() and meter

Postby nageswaragunupudi » Fri May 25, 2012 5:45 pm

First create the meter object with total equal to the number of records in the dbf.

Also initialize a variable n := 0

Then call fw_dbftoarray with second parameter as { || oMeter:Set( ++n ), .t. }
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_DbfToArray() and meter

Postby lucasdebeltran » Fri May 25, 2012 7:41 pm

Thanks so much.

Please, can you look at AIS/ADS and xBrowse spped?.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: FW_DbfToArray() and meter

Postby nageswaragunupudi » Sat May 26, 2012 2:26 am

lucasdebeltran wrote:Thanks so much.

I assume you are referring to client server implementation of ADS

Please, can you look at AIS/ADS and xBrowse spped?.

Please try the same browse with WBrowse (the fastest) and XBrowse and see if XBrowse is a lot slower than WBrowse of the same dbf.

If the difference is very significant, I can suggest a few ways to improve xbrowse speeds. We can bring the speeds closer to wbrowse but not better.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: FW_DbfToArray() and meter

Postby lucasdebeltran » Sat May 26, 2012 10:06 am

Mr. Nages,

Thank you for your valuable help.

Yes, I will appreciate your tips please.


Also, I tried an alternative: obtain a local copy of the dbf and browse locally. In this case, xBrowse is very fast, but I came across the performance with ADS obtaining the records.

This are the samples:

COPY sample:
Code: Select all  Expand view
// Harbour Advantage RDD sample

#include "FiveWin.ch"
#include "ads.ch"
#include "xbrowse.ch"

Request ADS,ADSKeyCount,ADSKeyNo,OrdKeyCount,OrdKeyNo, AdsGetRelKeyPos, AdsSetRelKeyPos

//----------------------------------------------------------------------------//

function Main()

     local aArray := {}, cDbf, i

     local nInicio, nFinal

     local lCopy := .F.



     // Driver CDX----------------------------------------------------------------
     REQUEST DBFCDX, DBFFPT


     RddRegister( "ADS", 1 )
     RddSetDefault( "ADS" )

     //setting up server type
     // 1 = Local Server (no client / server)
     // 2 = Remote Server
     // 3 = Local + Remot
     // 4 = Internet Server
     // 5 = Local + Internet
     // 6 = Remote+Internet
     // 7 = Local + Remote + Internet , best choice
     adsSetServerType( 4 )  // ó  adsSetServerType( ADS_REMOTE_SERVER )

     //setting up the file types
     // 1 = DBFNTX
     // 2 = DBFCDX
     // 3 = ADSADI
     adsSetFileType( ADS_CDX )  // o ADS_CDX

     AdsRightsCheck(.F.)









   IF AdsConnect60( "\\189.228.227.218:2000\cursos\adsdemo\cibconwn\stc\internet.add", 4,"demo","demo")


       MsgInfo("Esta ahora conectado al Sevidor AIS de . en Mexico "+CRLF+CRLF+;
        "You are now connected to AIS Server","Bienvenido / Welcome / Versión "+ADSVersion())



   ELSE

      MsgStop("Se ha rechazado la conexión al servidor AIS, por favor intente mas tarde"+CRLF+CRLF+;
         "Conection to AIS Server rejected, please, try again later","AIS Error")
      QUIT

   ENDIF




   USE CATCUE SHARED NEW ALIAS "DATOS"
   DATOS->(AdsCacheRecords(50))
   DATOS->(OrdSetFocus("NUMCUENTA"))
   DATOS->(DBGOTOP())


   sysrefresh()






   nInicio := seconds()

   COPY TO "TEMPORAL.DBF" VIA "DBFCDX"

   nfinal := seconds()
   msgalert(nFinal-nInicio, " TIME CopyTable ")



   USE TEMPORAL NEW
   XBROWSE()

   dbcloseall()
   quit

return nil

//----------------------------------------------------------------------------//



ADSQL:
Code: Select all  Expand view
function Test_SQL()

   LOCAL cSql   := ""
   LOCAL aArray := {}

   LOCAL cAlias := Alias()




   /*al inicio de la instruccion sql se define un area vacia*/
   DBSelectArea(0)


   /*se define instruccion sql en una cadena de texto*/
   cSql := "SELECT * FROM CUSTOMER"
   msgINFO(csql, "cSql")


   /*crea instruccion sql y pasa los datos a tabla temporal*/
   ADSCreateSQLStatement( "REPTMP", 2 )


   IF ADSExecuteSQLDirect( cSql )

      DBSelectArea("REPTMP")

      REPTMP->( DBGoTop() )


      IF LastRec() > 0  // !REPTMP->( Eof() )

         /*lista resultado en tabla*/
         xbrowse()
         //aArray := FW_DbfToArray()
         //XBROWSER aArray

      ELSE

         /*no se encontro datos que cumpla condicion sql*/
         MsgInfo( "No se ha encontrado REGISTROS" )

      ENDIF

      /*cierra tabla de datos temporal*/
      REPTMP->( DBCloseArea() )




   ELSE

      Alert( "AdsExecuteSQLDirect() failed with error "+ Str( ADSGetLastError() ) )



   ENDIF



   /*se selecciona area de datos anterior*/
   IF !Empty(cAlias)
      DBSelectArea(cAlias)
   ENDIF

   /*da foco al browse*/


RETURN NIL
 




But using Daniel´s TDolphin, I can xBrowse the full table almost inmmediate. So there is also an issue about performance with ADS and Harbour.

In this latest point I am lost and I don´t know who could help.

Thank you very much.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests