Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleep function into fbudf [CORE5619] #5885

Open
firebird-automations opened this issue Sep 21, 2017 · 2 comments
Open

Sleep function into fbudf [CORE5619] #5885

firebird-automations opened this issue Sep 21, 2017 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Slavomir Skopalik (skopaliks)

Votes: 4

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;

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant