[Xotcl] -type of Attributes
eckhardnospam at gmx.de
Thu May 1 13:28:26 CEST 2008
two questions on the -type field of the Attribute class:
There is obviously no documentation on the available types? I needed to
force an error on a wrong -type that told me all the available types
Is there a -type that denotes a string? There is alnum and alpha, but I
mean ordinary strings that can contain arbitrary (utf-8, ISO-8859-1
etc.) characters? Or alternatively, are the types extensible?
Background of this question: The -type of an attribute seems to be a
useful invention for an automated persistency framework for databases.
The problem with that automation is currently that you can not really
generate SQL automatically for XOTcl attributes, because you don't know
their exact storage types from looking at the classes.
If it was possible to assign the proper -type to attributes (e.g.
"text", "date", "bytea" ...), then I could see two cool possibilities
for a persistency framework:
a) create XOTcl classes automatically using meta information of the
database, and -type as validator
b) create CRUD and select statements automatically from XOTcl classes,
using -type for the proper quoting/format that the database expects
At least for the basic types this could be helpful.
More information about the Xotcl