Handle para query - Freeze de pantalla

Post Reply
nlerdafehn
Posts: 50
Joined: Tue Feb 02, 2021 10:21 pm
Location: Buenos Aires, Argentina
Contact:

Handle para query - Freeze de pantalla

Post by nlerdafehn »

Buenas noches,

Utilizo Tdolphin para trabajar con MySQL.

Hay alguna manera de que muestre un reloj de trabajando y no se freeze la aplicación cuando una query tarda más de 5 segundos en completarse? Porque lo que sucede es que, en clientes que deben generar un reporte, con una query muy complicada con muchos resultados, tarda aprox 10 segundos en ejecutarse (esta muy optimizada) y la pantalla a los segundos se friza, y si el usuario hace click, windows la considera como que no responde e intenta cerrarla.

A su vez, tengo queries de migracion de datos de un servidor a otro que toma unos minutos, y lo mismo. Reviso por mysql el processlist y me da como finalizada, pero no regresa a la aplicación para darle el mensaje de finalizado.

Existe alguna manera de solucionar esto?

Muchas gracias.
Nicolás
User avatar
Lailton
Posts: 169
Joined: Fri Jul 20, 2012 1:49 am
Location: Brazil
Has thanked: 2 times
Been thanked: 6 times
Contact:

Re: Handle para query - Freeze de pantalla

Post by Lailton »

Tiene probado con MT?
Creo que utilizar MultiThreading se pode hacer en una segunda thread la query y no ira hacer freeze.

https://github.com/Petewg/harbour-core/ ... iThreading
Regards,
Lailton Fernando Mariano
nlerdafehn
Posts: 50
Joined: Tue Feb 02, 2021 10:21 pm
Location: Buenos Aires, Argentina
Contact:

Re: Handle para query - Freeze de pantalla

Post by nlerdafehn »

Gracias por responder.

Si, con MT evito que se frize la app principal, pero si muestro el dialogo de proceso, (ej: Recibiendo informacion... Generando TXT de exportación) se friza ese dialogo.

A su vez, no retorna una vez finalizada una query que tarde unos 2 minutos y que efectivamente haya sido terminada en el mysql.
Nicolás
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Handle para query - Freeze de pantalla

Post by cnavarro »

Try with MsgRun for execute query
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Handle para query - Freeze de pantalla

Post by carlos vargas »

he intentado poner un timer en msgrun, pero igual se freeza, el problema es que una vez se muestra el mensaje de espera, si por alguna razon la app pierde foco al retomarlo se freeza, igual pasa si el proceso toma tiempo, y se presiona cualquier tecla o se da click con el raton.

Mi idea era poner un sysrefresh con un timer adosado al dlg del msgrun pero no funciona, igual se congela

MSGRUN

Code: Select all | Expand


...
   ACTIVATE DIALOG oDlg ON PAINT oDlg:SayText( oDlg:cMsg );
            ON INIT ( oTmr := MsgRunBldTimer( oDlg ), oDlg:Center( oWndParent ) );
            VALID MsgRunEndTimer( oTmr )

RETURN uReturn

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

STATIC FUNCTION MsgRunBldTimer( oDlg )
   LOCAL oTimer

   oTimer := TTimer():New( 400, {|| oTimer:Deactivate(), SysRefresh(), oTimer:Activate() }, oDlg )
   oTimer:Activate()

RETURN oTimer

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

STATIC FUNCTION MsgRunEndTimer( oTimer )

   oTimer:DeActivate()
   oTimer:End()

RETURN TRUE

 
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Handle para query - Freeze de pantalla

Post by carlos vargas »

Estimado, alguien sabe para que sirve la funcion SetAsMsgBox() la cual aparece en MsgRun

Code: Select all | Expand


   IF oWndParent == NIL .and. CenterMsgs( "?" )
        lCenterMsg := TRUE
        SetAsMsgBox()
     ENDIF
 


Me parece que la variable oWndParent nunca es usada, aun si es usada cuando se llama en MsgRun.

siguiero, para empezar,

Code: Select all | Expand


   IF oWndParent == NIL
      oWndParent := GetWndDefault()
   ENDIF
 


y luego un OF oWndParent en la definicion de los dialogos...
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Handle para query - Freeze de pantalla

Post by nageswaragunupudi »

If

Code: Select all | Expand


CenterMsgs( .t. )
 

is set, all windows MsgBox messages like MsgInfo,MsgAlert,MsgYesNo, etc are all centered in the active window/dialog and without this setting they are all centered in the desktop window.

MsgRun() also behaves the same way.
If CenterMsgs() is set and oWndParent is not specified, then MsgRun() is centered in the active window/dialog.

This is accomplished by this code:

Code: Select all | Expand


IF oWndParent == NIL .and. CenterMsgs( "?" )
   lCenterMsg := TRUE
   SetAsMsgBox()
ENDIF
 


In the above code, SetAsMsgBox() sets this dialog to behave like the standard windows msgboxes.

If oWndParent is specified, then the dialog is centered in the specified oWndParent, irrespective of the setting of CenterMsgs()

Otherwise the MsgRun dialog is centered in the desktop window.
Regards

G. N. Rao.
Hyderabad, India
User avatar
carlos vargas
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Handle para query - Freeze de pantalla

Post by carlos vargas »

Ok. Rao, thank you!
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Handle para query - Freeze de pantalla

Post by James Bott »

Carlos,

I am not sure if this will help, but here is an example of a displayed timer while a routine is running.

This was originally posted by Enrico.

Code: Select all | Expand

9/27/2006 8:27 AM

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oTmr

    DEFINE DIALOG oDlg

    DEFINE TIMER oTmr OF oDlg;
           INTERVAL 1000;
           ACTION TONE( 440, 1 )

    ACTIVATE DIALOG oDlg;
             ON INIT ( oTmr:hWndOwner := oDlg:hWnd,;
                       oTmr:Activate() );
             CENTER

    RELEASE TIMER oTmr

    RETURN NIL

// EMG
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Post Reply