cznic / ql

github.com/cznic/ql has moved to modernc.org/ql
https://godoc.org/modernc.org/ql
BSD 3-Clause "New" or "Revised" License
1.31k stars 75 forks source link

Add sleep built in function #175

Closed gernest closed 7 years ago

gernest commented 7 years ago

This function is useful for delaying execution. The implementation is based on pg_sleep which accepts a number of seconds to sleep.

select sleep(5);

will sleep 5 seconds before returning.

APOLOGIES to reviewer. I had to make three changes in defferent parts to accomodate this, the changes in ql tool were meant to help demoonstrate the use of this function like on pg_sleep.

ql -i
ql> select now(); select sleep(5) ; select now();
2017-05-11 16:18:35.06018569 +0300 EAT
<nil>
2017-05-11 16:18:40.062569337 +0300 EAT
ql>

Check the differece in seconds between the first result set and the third. There is still a lot to be done on ql tool.

EDIT: Fix typo