I am reworking fields and datatypes so that you can redefine a field by describing it's datatype instead of using the <db> tag. This should be in a next release - the old way will still work, ofcourse, but it is an additional option that is primarily ment to make builder xmls cleaner.

The idea is that you can specify a field as follows:

<field name="mydata">
  <datatype base="eline" xmlns="http://www.mmbase.org/xmlns/datatypes"; >
    <required value="true" />
    <maxlength value="255" />
  </datatype>
</field>

Which would automatically deduce type (STRING), size (255), state (persistent) and notrnull (true, dependent on required).
You van override state and readionly status as field tag attributes:

<field name="generatedinfo" state="virual" readonly="true">
...

and override type, size, and notnull using the <storage> tag:

<field name="mydata2">
  <datatype base="xml" xmlns="http://www.mmbase.org/xmlns/datatypes"; >
    <maxlength value="255" />
  </datatype>
  <storage type="STRING" size="1024" notnull="true" >
</field>

(the example may not make much sense, but there could be situations where this is needed.
I didn't want to use the db.type tag, as it has a lot of other stuff.
So I added a storage key that overrides a datatype's default (or defines the datatype if you do not define it).

Anyway, when working on trying to determine size using a LengthDatatYpe maxLength propery I found this:

- Field.getMaxLenth() is an int
- LengthDataType.getMAxLength() is a long

Both are (as of 1.8) part of the bridge.
This means that to solve the conflict between the two is hard to do without breaking backward compatibility in the bridge.
I was wodnetring what should be done?
I now downsize the long to int, which works for the 1.8 release, but should we change the type of either method?
And if so, when? In 1.9? Or asap?

--
Pierre van Rooden
Mediapark, C 107 tel. +31 (0)35 6772815
"Hard work may pay off in the long run, but laziness always pays off right now."
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to