View · Search · Index
No registered users in community xowiki
in last 10 minutes

[Xotcl] -type of Attributes

From: Eckhard Lehmann <eckhardnospam_at_gmx.de>
Date: Thu, 01 May 2008 13:28:26 +0200

Hi,

two questions on the -type field of the Attribute class:

1)
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

2)
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.

Any thoughts?


-- 
Eckhard