Dear Andrei,
The method db_1row
defined by xotcl-core works for all SQL queries, not only for queries on acs-objects. For example, acs_attributes are not acs objects.
Object o -destroy_on_cleanup
o db_1row . {select * from acs_attributes limit 1}
o info vars
The same way you can use the tables of your own data model, use arbitrary SQL queries with joins, etc.. The same is also true for
instantiate_objects
. For both methods the instance variables are created as needed by the results of the SQL queries.
If you want to create XOTcl classes from the data dictionary - which might be useful or not - it requires more work and more detailed knowledge about the available schema definition. xotcl-core is able to automatically derive XOTcl classes from the schema definition of the OpenACS meta data.
If i can be of any help for the adp integration, or if the are some results that you can share, let me know.
Concerning object/class creation/deletion:
Certain objects/class should persist in memory after a connection thread, some of these not. The objects/classes defined in the -procs.tcl files should certainly persist.
The situation with XOTcl objects and classes (which are technically Tcl commands) is pretty much the same as for other Tcl commands (e.g. the one generated by tdom). In general, temporary objects/classes can be destroyed using "manually" with the destroy
method, or - the recommended approach - with the method destroy_on_cleanup
. Most of the object creating commands in the xotcl-core SQL interface use destroy_on_cleanup
. This is described in the API definition.
In the example above, the objects created by instantiate_objects
are automatically cleaned up. Object o
from this posting is automatically cleaned up, while the version of the first posting is not.