Subject | Re: [firebird-support] UDF Unloaded |
---|---|
Author | Helen Borrie |
Post date | 2006-12-14T01:29:47Z |
At 10:08 AM 14/12/2006, you wrote:
first time a client calls a function in that library. It is not
loaded by the client and it is not unloaded "when the user
disconnects" - unless, of course, the "user" is the embedded server client.
A UDF is a *function*. It takes inputs from the caller and returns a
scalar result. A UDF must not be used as though it were a process or
procedure. If you are using a UDF to maintain some value that's
intended to be altered there by successive function calls then you
are asking for trouble, i.e. corrupted memory, leakage, server crash, etc.
client connection is an issue (separate) for the server but not for a
UDF. The UDF itself has no awareness of the client. The client has
made a request to the server that causes the server to invoke the
external function. The server waits for the result, sends the result
to an output buffer and frees any memory it had allocated for the
function call.
./heLen
>Hi,UDFs live in libraries. A library is loaded *by the server* the
>
>I wanted to know when are UDF's unloaded? I'm doing something "risky"
>where I have a internal variable counter in the udf and I noticed the
>UDF is unloaded when the user disconnects,
first time a client calls a function in that library. It is not
loaded by the client and it is not unloaded "when the user
disconnects" - unless, of course, the "user" is the embedded server client.
A UDF is a *function*. It takes inputs from the caller and returns a
scalar result. A UDF must not be used as though it were a process or
procedure. If you are using a UDF to maintain some value that's
intended to be altered there by successive function calls then you
are asking for trouble, i.e. corrupted memory, leakage, server crash, etc.
>but I wanted to know whatA UDF wouldn't be "doing something that isn't completed yet". A lost
>if I had a UDF function that is doing something that isn't completed
>yet when the user disconnects?
client connection is an issue (separate) for the server but not for a
UDF. The UDF itself has no awareness of the client. The client has
made a request to the server that causes the server to invoke the
external function. The server waits for the result, sends the result
to an output buffer and frees any memory it had allocated for the
function call.
./heLen