Ajuda com Minigui + SQL SERVER 2012

Projeto MiniGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Ajuda com Minigui + SQL SERVER 2012

Mensagem por JoséQuintas »

Minha rotina de log anterior

Código: Selecionar todos

PROCEDURE pAdminLog

   LOCAL cDbf, cnMySql := ADOClass():New( AppConexao() )

   IF AppConexao() == NIL
      IF ! AbreArquivos( "jpreguso" )
         RETURN
      ENDIF
   ELSE
      cnMySql:cSql := "SELECT * FROM JPREGUSO ORDER BY RUINFINC DESC LIMIT 5000"
      cDbf := cnMySql:SqlToDbf()
      USE ( cDbf ) ALIAS jpreguso
   ENDIF
   SELECT jpreguso
   SET ORDER TO 0
   GOTO TOP
   SKIP -15
   FazBrowse( { ;
      { "HORÁRIO",   { || Substr( jpreguso->ruInfInc, 1, 26 ) } }, ;
      { "DESCRIÇÃO", { || jpreguso->ruTexto } }, ;
      { "ARQUIVO",   { || jpreguso->ruArquivo } }, ;
      { "CÓDIGO",    { || jpreguso->ruCodigo } }, ;
      { "INFINC",    { || jpreguso->ruInfInc } } } )
   CLOSE DATABASES

   RETURN
rotina atual com ADO

Código: Selecionar todos

PROCEDURE pAdminLog

   LOCAL oTBrowse, cnMySql := ADOClass():New( AppConexao() )

   IF AppConexao() == NIL
      RETURN
   ENDIF
   WITH OBJECT cnMySql
      :cSql := "SELECT * FROM JPREGUSO ORDER BY IDREGUSO DESC LIMIT 50000"
      :Execute()
      oTBrowse := { ;
         { "HORARIO",   { || :String( "RUINFINC", 26 ) } }, ;
         { "DESCRIÇÃO", { || :String( "RUTEXTO", 100 ) } }, ;
         { "ARQUIVO",   { || :String( "RUARQUIVO", 15 ) } }, ;
         { "CÓDIGO",    { || :String( "RUCODIGO", 9 ) } }, ;
         { "RUINFINC",  { || :String( "RUINFINC", 80 ) } } }
      BrowseADO( cnMySql, oTBrowse, "RUTEXTO" )
      :CloseRecordset()
   ENDWITH

   RETURN
Reduziu de uns 10 segundos para 1 segundo...
É que ficou tão instantâneo, que aumentei de 5.000 pra 50.000 registros, como dá pra ver na rotina.
Por isso tá demorando 1 segundo kkkk
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder