Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Firebird e Interbase
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 24-07-2008
Avatar de RolphyReyes
RolphyReyes RolphyReyes is offline
Miembro
 
Registrado: ago 2004
Ubicación: Santo Domingo
Posts: 285
Poder: 22
RolphyReyes Va por buen camino
Smile

Saludos.

Como consejo revisa bien el manejo de las transacciones por lo regular no es buena practica el realizar bloqueos explícitos.

Te pongo la referencia del Release Notes de FB 1.5:
Cita:
(1.5) Explicit locking
Nickolay Samofatov
The addition of the optional WITH LOCK clause provides a limited explicit pessimistic locking capability
for cautious use in conditions where the affected row set is
1. extremely small (ideally, a singleton) AND
2. precisely controlled by the application code.
Caution
This is for experts only!
The need for a pessimistic lock in Firebird is very rare indeed and should be well understood before
use of this extension is considered.
It is essential to understand the effects of transaction isolation and other transaction attributes before
attempting to implement explicit locking in your application.
Syntax Pattern
SELECT ... FROM <sometable>
[WHERE ...]
[FOR UPDATE [OF ...]]
[WITH LOCK]
...;
If the WITH LOCK clause succeeds, it will secure a lock on the selected rows and prevent any other
transaction from obtaining write access to any of those rows, or their dependants, until your transaction
ends.
If the FOR UPDATE clause is included, the lock will be applied to each row, one by one, as it is
fetched into the server-side row cache. It becomes possible, then, that a lock which appeared to succeed when requested will nevertheless fail subsequently, when an attempt is made to fetch a row
which becomes locked by another transaction.
The SELECT... WITH LOCK construct is available in DSQL and PSQL.
Important
The SELECT... WITH LOCK construct can succeed only in a top-level, single-table SELECT statement.
It is not available
• in a subquery specification
• for joined sets
• with the DISTINCT operator, a GROUP BY clause or any other aggregating operation
• with a view
• with the output of a selectable stored procedure
• with an external table

Examples using Explicit Locking
i) (simple)
Código SQL [-]
SELECT * FROM DOCUMENT WHERE ID=? WITH LOCK

ii) (multiple rows, one-by-one processing with DSQL cursor)
Código SQL [-]
SELECT * FROM DOCUMENT WHERE PARENT_ID=?
FOR UPDATE WITH LOCK
Hasta luego.
__________________
Gracias,
Rolphy Reyes
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Transacciones En Firebird espectro_jd SQL 3 21-02-2007 18:54:40
Transacciones anidadas en firebird Er_Manué Conexión con bases de datos 5 07-12-2005 14:53:10
Transacciones FireBird con Zeos vichovi Conexión con bases de datos 3 13-07-2005 08:49:29
Transacciones en FireBird El_Raso Firebird e Interbase 1 26-11-2004 16:22:04
Comunicación entre transacciones (Firebird 1 + Ibo) apicito Firebird e Interbase 4 08-01-2004 19:01:56


La franja horaria es GMT +2. Ahora son las 02:06:18.


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