This document contains information for an outdated version (2.4) and may not be maintained any more.
If some of your projects still use this version, consider upgrading as soon as possible.
These are the data-types that you can use when defining your data objects. They are all subclasses of DBField for introducing their usage.
- Varchar: A variable-length string of up to 255 characters, designed to store raw text
- Text: A variable-length string of up to 2 megabytes, designed to store raw text
- HTMLVarchar: A variable-length string of up to 255 characters, designed to store HTML
- HTMLText: A variable-length string of up to 2 megabytes, designed to store HTML
- Enum: An enumeration of a set of strings
- Boolean: A boolean field.
- Int: An integer field.
- Decimal: A decimal number.
- Currency: A number with 2 decimal points of precision, designed to store currency values.
- Percentage: A decimal number between 0 and 1 that represents a percentage.
- Date: A date field
- SS_Datetime: A date / time field
- Time: A time field
HTMLText vs. Text, and HTMLVarchar vs. Varchar
The database field types HTMLVarchar and Varchar are exactly the same in the database. However, the templating engine knows to escape the Varchar field and not the HTMLVarchar field. So, it's important you use the right field if you don't want to be putting $FieldType.XML everywhere.
If you're going to put HTML content into the field, please use the field type with the HTML prefix. Otherwise, you're going to risk double-escaping your data, forgetting to escape your data, and generally creating a confusing situation.
- See datamodel for information about database schemas implementing these types