21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9<br />

Available in: DSQL, PSQL<br />

Added in: 1.5<br />

Changed in: <strong>2.1</strong><br />

Context variables<br />

CURRENT_CONNECTION<br />

Description: CURRENT_CONNECTION contains the unique identifier of the current connection.<br />

Type: INTEGER<br />

Examples:<br />

select current_connection from rdb$database<br />

execute procedure P_Login(current_connection)<br />

The value of CURRENT_CONNECTION is stored on the database header page and reset to 0 upon restore. Since<br />

version <strong>2.1</strong>, it is incremented upon every new connection. (In previous versions, it was only incremented if the<br />

client read it during a session.) As a result, CURRENT_CONNECTION now indicates the number of connections<br />

since the creation – or most recent restoration – of the database.<br />

Available in: DSQL, PSQL<br />

Added in: 1.0<br />

CURRENT_ROLE<br />

Description: CURRENT_ROLE is a context variable containing the role of the currently connected user. If there<br />

is no active role, CURRENT_ROLE is NONE.<br />

Type: VARCHAR(31)<br />

Example:<br />

if (current_role 'MANAGER')<br />

then exception only_managers_may_delete;<br />

109

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!