Forum OpenACS Q&A: Re: Some tips about XoTcl development best practices

Collapse
Posted by Antonio Pisano on
Seems like somehing in nx framework is missing, if I am not wrong. ::xo::db::Attribute was working, so some nx must be there already, but maybe there is something else I need to enable...
Collapse
Posted by Gustaf Neumann on
Antonio, please get the newest version of nsf/nx from git and recompile+install it to get the xotcl class browser with the newest version of xotcl-core working on your local instance (e.g. use the HEAD option for xotcl in install-ns.sh). Most of the other stuff is robust against the latest changes, but the detailed introspection is not).

The head version of nsf/nx/xotcl2 will be released quite soon.

Collapse
Posted by Antonio Pisano on
Ok, fine with that.

There is something else that I still can't figure:
In apy doc, if i look at ::xo::db::sql::acs_attribute I get in the source code something that seems it has been auto-generated.

api-doc states that such method is defined in packages/xotcl-core/tcl/05-db-procs.tcl, but I can't grasp how: the code I can find there calls such proc, but the real definition seems to come from somewere else.

Collapse
Posted by Gustaf Neumann on
xotcl-core generates at startup automatically interfaces to all stored procedures in the database. For every package (in the oracle terminology) an object in the ::xo::db::sql namespace is generated. By calling e.g.
::xo::db::sql::acs_attribute create_attribute
one is calling actually in an postgres installation the stored procedure
acs_attribute__create_attribute
This interface is much faster than the usual OpenACS interface and allows to handle defaults for attribtues, give error messages about expected attributes, etc.

btw, i've updated xotcl-core once more, it should be now more backwards compatible (not tested), so you might not have to update nsf/nx.

all the best
-gn