As an anonymous user, you can only add new data. If you would like to also modify existing data, please create an account and indicate your languages on your user page.

Help:Expression table

From OmegaWiki
Revision as of 23:38, 7 July 2011 by Kipcool (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Help:Index Database layout Expression table



Tracks all existing expressions, as well as expressions that have been deleted. A expression is a specific word (e.g. "word") in a specific language (e.g. "English").

+-----------------------+------------------+------+-----+---------+-------+
| Field                 | Type             | Null | Key | Default | Extra |
+-----------------------+------------------+------+-----+---------+-------+
| expression_id         | int(10) unsigned | NO   | MUL | NULL    |       | 
| spelling              | varchar(255)     | YES  |     | NULL    |       | 
| language_id           | int(10)          | NO   | MUL | 0       |       | 
| add_transaction_id    | int(11)          | NO   | MUL | NULL    |       | 
| remove_transaction_id | int(11)          | YES  | MUL | NULL    |       | 
+-----------------------+------------------+------+-----+---------+-------+

[edit] Fields

expression_id 
A number that identifies the expression
spelling 
A string corresponding to the word of that expression, e.g. "word".
language_id 
The language of that expression. See Language table.
add_transaction_id 
Indicates when and by who the expression was added. See Transactions table.
remove_transaction_id 
Indicates when and by who the expression was removed. NULL if the expression is still in use

. Actually, this field is currently not touched when an expression is removed (this is not a feature, it is a bug). Instead, the Syntrans table should be consulted (see below) to know if an expression has been removed.

[edit] Sample MySQL code

The following code will return all the valid (i.e. not removed) words in English (language_id=85):

select distinct spelling

from uw_expression, uw_syntrans
where uw_expression.expression_id = uw_syntrans.expression_id
and uw_expression.language_id = 85
and uw_syntrans.remove_transaction_id IS NULL;

However, the following code will give a wrong result (more results than expected):

select spelling

from uw_expression
where uw_expression.language_id = 85
and uw_expression.remove_transaction_id IS NULL;