Difference between revisions of "Database patterns"
Line 4: | Line 4: | ||
The [[#about|about]] tables contain database meta data. | The [[#about|about]] tables contain database meta data. | ||
+ | |||
+ | An about table is named 't_about_{name}'. | ||
== lookup == | == lookup == | ||
The [[#lookup|lookup]] tables contain hard-coded reference data. | The [[#lookup|lookup]] tables contain hard-coded reference data. | ||
+ | |||
+ | A lookup table is named 't_lookup_{name}'. | ||
A lookup table must contain a 'a_{name}_enum' column which identifies a row. The 'a_{name}_enum' column is usually be a [[#DBT_UINT8|DBT_UINT8]]. | A lookup table must contain a 'a_{name}_enum' column which identifies a row. The 'a_{name}_enum' column is usually be a [[#DBT_UINT8|DBT_UINT8]]. | ||
Line 14: | Line 18: | ||
If you're extending a [[PHPBOM]] lookup table you should code from the max enum down. | If you're extending a [[PHPBOM]] lookup table you should code from the max enum down. | ||
+ | |||
+ | == token == | ||
+ | |||
+ | The [[#token|token]] tables contain tokens. | ||
+ | |||
+ | A token table is named 't_token_{name}'. | ||
+ | |||
+ | A token table must contain a 'a_{name}' column which contains the token. The 'a_{name}' column is usually a [[#DBT_TOKEN|DBT_TOKEN]]. | ||
= Database types = | = Database types = | ||
Line 24: | Line 36: | ||
A [[#DBT_ASCII_CHAR_BIN|DBT_ASCII_CHAR_BIN]] is a single case-sensitive ASCII character. | A [[#DBT_ASCII_CHAR_BIN|DBT_ASCII_CHAR_BIN]] is a single case-sensitive ASCII character. | ||
+ | |||
+ | == DBT_TOKEN == | ||
+ | |||
+ | A [[#DBT_TOKEN|DBT_TOKEN]] is a case-sensitive 32-character alphanumeric ASCII string. |
Revision as of 07:11, 18 March 2020
Patterns
about
The about tables contain database meta data.
An about table is named 't_about_{name}'.
lookup
The lookup tables contain hard-coded reference data.
A lookup table is named 't_lookup_{name}'.
A lookup table must contain a 'a_{name}_enum' column which identifies a row. The 'a_{name}_enum' column is usually be a DBT_UINT8.
If an optional 'a_{name}_char' column exists it must be of type DBT_ASCII_CHAR_BIN. The PHPBOM library will use lowercase char codes and applications can use uppercase char codes.
If you're extending a PHPBOM lookup table you should code from the max enum down.
token
The token tables contain tokens.
A token table is named 't_token_{name}'.
A token table must contain a 'a_{name}' column which contains the token. The 'a_{name}' column is usually a DBT_TOKEN.
Database types
DBT_UINT8
A DBT_UINT8 is an integer from 0 to 255.
DBT_ASCII_CHAR_BIN
A DBT_ASCII_CHAR_BIN is a single case-sensitive ASCII character.
DBT_TOKEN
A DBT_TOKEN is a case-sensitive 32-character alphanumeric ASCII string.