Subject | Re: [IBO] CURRENT_CONNECTION intrisic in IB_Connection? |
---|---|
Author | Helen Borrie |
Post date | 2006-03-11T00:33Z |
At 08:43 AM 11/03/2006, you wrote:
yourself at connect time if you think you are going to want it for something.
Across the API, the application acquires a "handle", which belongs
exclusively to that particular connection instance. You can't query
the database for it and it is *not* the same value as the server
delivers as the context variable CURRENT_CONNECTION.
structure, which will enable IBO to store a property for it. But of
course *getting* it still requires a call to the database, as with
any info call.
syntax. An event identifier is a string. Try
POST_EVENT 'WHATEVER$' || CURRENT_USER;
and
POST_EVENT 'WHATEVER$' || CAST(CURRENT_TRANSACTION AS VARCHAR(18));
But don't overlook the fact that CURRENT_TRANSACTION is entirely
contextual to the current transaction in which the SP is running
(which, of course, is known only to the server - it is not the same
as the transaction handle that the client instance knows
about). Since you will have to register the event *before* you start
the transaction, you won't know the value of CURRENT_TRANSACTION
before the event, so you will never receive a signal for it.
Helen
>There is much I can gain from posting an event likeNo, it's not (though there is nothing to stop you from picking it up
>
> POST_EVENT 'MAININTEREST$SUBINTEREST$' || CURRENT_CONNECTION;
>
>so I am searching for the corresponding value in my TIB_Connection
>instance. Is it there? I would rather (if it's possible) avoid a DSQL like
>
>SELECT CURRENT_CONNECTION
>FROM RDB$DATABASE
>
>because that is *another* system question/query down the line. Point is
>that somewhere in the workings of TIB_Connection.Connect this value
>/should/ is passed back to the client anyway.
yourself at connect time if you think you are going to want it for something.
Across the API, the application acquires a "handle", which belongs
exclusively to that particular connection instance. You can't query
the database for it and it is *not* the same value as the server
delivers as the context variable CURRENT_CONNECTION.
>I suspect that it might not be since CURRENT_CONNECTION wasThat's right; and InterBase doesn't have that context variable.
>introduced in FB 1.5 only.
>Must I do a SELECT CURRENT_CONNECTION FROM RDB$DATABASE?Yes. In Fb2 you will be able to pick it up as a field in an API
structure, which will enable IBO to store a property for it. But of
course *getting* it still requires a call to the database, as with
any info call.
>BTW POST_EVENT 'WHATEVER$' + CURRENT_USER is another issue altogether asNot that I know of. The statement you're showing here isn't valid
>is CURRENT_TRANSACTION.
syntax. An event identifier is a string. Try
POST_EVENT 'WHATEVER$' || CURRENT_USER;
and
POST_EVENT 'WHATEVER$' || CAST(CURRENT_TRANSACTION AS VARCHAR(18));
But don't overlook the fact that CURRENT_TRANSACTION is entirely
contextual to the current transaction in which the SP is running
(which, of course, is known only to the server - it is not the same
as the transaction handle that the client instance knows
about). Since you will have to register the event *before* you start
the transaction, you won't know the value of CURRENT_TRANSACTION
before the event, so you will never receive a signal for it.
Helen