Closing a database

From: Wijck, Bart van <"Wijck,>
Date: Thu, 8 Jul 2004 12:45:16 +0200

----boundary-LibPST-iamunique-248578387_-_-
Content-type: text/plain

Hi BlackBox people,

Can anyone answer the following question:

As long as you are processing a database with SQL you need database and
table objects. When you are done processing you set these object pointers to
NIL. With the explicit command Kernel.Cleanup the garbage collector closes
the database, or I presume this happens anyway when you are finish executing
altogether. The point obviously is not to keep the database open longer than
necessary.

What I do not understand why BlackBox advises to make the database pointer a
local variable and only export the table pointer. Yes you can at anytime
recreate the database pointer form the table pointer via:

        db := <sybsytem>.rt.base; (* where rt is the result table
pointer *)

But what is the big difference? The presumably large chunk of memory where
the database object is allocated is retained in any case until all (!)
references to it are set to NIL. So even if db is local and presumably set
to NIL automatically when the procedure in which it is defined has finished
executing, there's still the reference to it in rt.base (which is global and
exported).
Closing the database still needs to be done explicitly by setting rt := NIL.

So why not export both objects and set them to NIL when needed?

Regards, Bart






-- 
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xyTo get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xyCurrent posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-248578387_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQ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