Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 28-05-2015
Avatar de santiago14
santiago14 santiago14 is offline
Miembro
 
Registrado: sep 2003
Ubicación: Cerrillos, Salta, Argentina
Posts: 583
Poder: 21
santiago14 Va por buen camino
Question ¿Es posible cancelar la ejecución de una consulta SQL?

Buenas, estoy con un dilema.
¿Es posible cancelar la ejecución de una consulta SQL? La cosa es que a veces demora un rato y quisiera que el usuario pueda cancelar.

El código no tiene nada raro, llama a un Select que está en un procedimiento y luego llena una grilla.

Gracias.
__________________
Uno es responsable de lo que hace y de lo que omite hacer.
Responder Con Cita
  #2  
Antiguo 28-05-2015
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 29
jhonny Va camino a la famajhonny Va camino a la fama
¿Que motor de BD usas?
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #3  
Antiguo 28-05-2015
Avatar de santiago14
santiago14 santiago14 is offline
Miembro
 
Registrado: sep 2003
Ubicación: Cerrillos, Salta, Argentina
Posts: 583
Poder: 21
santiago14 Va por buen camino
Uso Firebird 2.5
__________________
Uno es responsable de lo que hace y de lo que omite hacer.
Responder Con Cita
  #4  
Antiguo 28-05-2015
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Poder: 29
jhonny Va camino a la famajhonny Va camino a la fama
Creo que eliminando la transacción correspondiente de la tabla MON$STATEMENTS o de la tabla MON$TRANSACTIONS podrías lograrlo.
__________________
Lecciones de mi Madre. Tema: modificación del comportamiento, "Pará de actuar como tu padre!"

http://www.purodelphi.com/
http://www.nosolodelphi.com/
Responder Con Cita
  #5  
Antiguo 29-05-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.039
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Cita:
The Lock Manager has been provided with the capability to cancel waiting, avoiding a condition whereby a transaction in WAIT mode could wait interminably for the end of another transaction that could not be achieved by either a DELETE FROM MON$xxx or an fb_cancel_operation request.
Cita:
Firebird 2.5: New API call to cancel operations

fb_cancel_operation() - new API call in firebird 2.5.
Implements capability to asynchronously cancel long running API call.
Author:
Alex Peshkoff <peshkoff@mail.ru>
Syntax is:
ISC_STATUS fb_cancel_operation(ISC_STATUS* status_vector,
isc_db_handle* db_handle,
ISC_USHORT option);
Description:
Action performed by this function depends upon value of last parameter, option. Option can be:
  • fb_cancel_raise: cancels any activity, related with db_handle. This means that firebird will as soon as possible (to be precise, at the nearest rescheduling point, except some special states of engine) try to stop running request and error-return to the user.
  • fb_cancel_disable: disable execution of fb_cancel_raise requests for given attachment. It's succesful when your program executes some critical things (for example, cleanup).
  • fb_cancel_enable: enables previously disabled cancel delivery.
  • fb_cancel_disable / fb_cancel_enable may be set many times - if engine is already in requested state, no action is taken. Cancel is enabled by default (i.e. after attach/create database).
Pay attention to asynchronous nature of this API call. Usually fb_cancel_raise is called when you need to stop long-running request. This means that it's called from separate thread (calling it from signal handler is bad idea, it's NOT async signal safe). Another side of asynchronous execution is that at the end of API call attachment's activity may be already cancelled, may be not (and the second is very possible). It also means that returned status vector will almost always be FB_SUCCESS, though some errors are possible (like error sending network packet to remote server).
Sample:
Thread A:
fb_cancel_operation(isc_status, &DB, fb_cancel_enable);
isc_dsql_execute_immediate(isc_status, &DB, &TR, 0, "long running statement", 3, NULL);
// waits for API call to finish...
Thread B:
fb_cancel_operation(local_status, &DB, fb_cancel_raise);
Thread A:
if (isc_status[1])
isc_print_status(isc_status); // will print "operation was cancelled"
http://ibsurgeon.com/en/articles/fir...el-operations/
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Es posible cambiar el evento del GetItemStyle del mxCalendar1 en modo ejecucion jeremiselxi Varios 0 22-01-2015 16:54:27
¿Es posible crear un botón en el formulario en tiempo de ejecución? kakarotv5 OOP 19 24-09-2008 16:50:17
Rave Report: Pierdo la ejecucion de mi programa al cancelar el "Generating"!!!! jbautista Impresión 1 22-08-2008 12:41:01
TdbNavigator cancelar la ejecucion en runtime camino OOP 2 07-07-2008 18:44:27
cancelar una consulta jmlifi SQL 1 08-11-2005 19:14:11


La franja horaria es GMT +2. Ahora son las 19:27:30.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi