Subject | Re: [IBO] CURRENT_CONNECTION intrisic in IB_Connection? |
---|---|
Author | Dany M |
Post date | 2006-03-11T10:16:35Z |
Helen Borrie wrote:
What I meant with "another issue" was to say that it is another issue
for me regarding this post. It is difficult to express since my first
language is not english, I tried to hint that I don't need hints about
the other variables :)
/Dany
> At 08:43 AM 11/03/2006, you wrote:First of all, thank you for you answer.
>> There is much I can gain from posting an event like
>>
>> 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.
>
> No, it's not (though there is nothing to stop you from picking it up
> 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 was
>> introduced in FB 1.5 only.
>
> That's right; and InterBase doesn't have that context variable.
>
>
>> 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 as
>> is CURRENT_TRANSACTION.
>
> Not that I know of. The statement you're showing here isn't valid
> 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
>
What I meant with "another issue" was to say that it is another issue
for me regarding this post. It is difficult to express since my first
language is not english, I tried to hint that I don't need hints about
the other variables :)
/Dany