Skip to content
Si Carter edited this page Jul 13, 2017 · 2 revisions

Welcome to the fbLockUDF wiki!

Firebird Lock UDF is a UDF module for windows server which can obtain a server wide lock for a maximum of a specified amount of seconds.

Especially useful if you require unique access to resources for a short period of time.

Locks are not connection or transaction specific, and there is no security available for who can obtain or release a lock.

External Function Definitions

DECLARE EXTERNAL FUNCTION fb_ServerLockGet CSTRING(100), INTEGER
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fbServerLockGet'
MODULE_NAME 'fbLockUdf';

DECLARE EXTERNAL FUNCTION fb_ServerLockRel CSTRING(100)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fbServerLockRel'
MODULE_NAME 'fbLockUdf';

Restrictions

Maximum of 10 locks per database instance. Maximum lock wait of 2000 milliseconds fbServerLockGet

fbServerLockGet

Obtains a server wide lock

Parameters

  • CSTRING(100) - Unique string to identify the lock INTEGER - Number of seconds the lock can remain active

Return Value - INTEGER

  • 0 - Lock Obtained
  • 1 - Maximum Lock Count Exceeded
  • 2 - Lock Already Exists
  • 3 - Invalid Lock Handle
  • 4 - Access Denied
  • 5 - Time Out waiting to obtain a lock
  • 6 - Invalid Lock Name
  • 7 - Invalid Parameter
  • 8 - Invalid Age (Must be between 0 and 1440 seconds)
  • 9 - Lock not Found
  • 999 - General Error

fbServerLockRel

fbServerLockRel releases a server wide lock

Parameters

  • CSTRING(100) - Unique string to identify the lock

Return Value - INTEGER

  • 0 - Lock Released
  • 3 - Invalid Lock Handle
  • 4 - Access Denied
  • 5 - Time Out waiting to obtain a lock
  • 6 - Invalid Lock Name
  • 9 - Lock not Found
  • 999 - General Error

Source code is available via Git Hub https://github.com/k3ldar/fbLockUDF

Features

  • 32 and 64 bit versions.
  • Free for personal, commercial and all other uses.
  • Source code available.
  • Unlimited Updates/Patches
  • Open Source - Released under Initial Developers Public Licence