Issue Details (XML | Word | Printable)

Key: CORE-5619
Type: New Feature New Feature
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Slavomir Skopalik
Votes: 4
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Sleep function into fbudf

Created: 20/Sep/17 11:13 PM   Updated: 21/Sep/17 08:41 AM
Component/s: UDF
Affects Version/s: 2.5.7, 3.0.2, 4.0 Alpha 1
Fix Version/s: None

Environment: Any

QA Status: No test


 Description  « Hide
Add Sleep function as common fbudf function.
This is helpful during obtaining lock or testing.
Declaration like:
DECLARE EXTERNAL FUNCTION Sleep
INTEGER NULL
RETURNS INTEGER BY VALUE
ENTRY_POINT 'Sleep' MODULE_NAME 'masaudf';

Implementation (in pascal):
function Sleep(time:PINT):integer; cdecl;
begin
  result:=0;
  if time=nil then exit;
  windows.Sleep(time^);
end;


 All   Comments   Change History   Subversion Commits      Sort Order: Descending order - Click to sort in ascending order
Pavel Zotov added a comment - 21/Sep/17 08:41 AM
Almost every test that is created to emulate work of real users need for pause mechanism between SQL statements. Currently it can be implemented either using shell calls (ping or sleep) or by artificial delay using 'set transaction lock timeout N' + try to lock the record which was already locked. This is ugly way, of course, but it is the only way to do pause inside PSQL (inside execute block etc).
Please consider adding such feature into FB-3 - as built-in func like rdb$get/set_context(). FB-3 will be 'mainstream' after 1-2 year and for 4-5 years for sure.

Alexander Peshkov added a comment - 21/Sep/17 08:26 AM
UDF suppport will sooner of all be deprecated in FB4 (in favor of UDR).
I.e. in the exact form this suggestion is hardly realistic. But what about adding UDR sleep() for various debugging purposes - why not.