redletterday Table (17)
Red letter days for calendar (holidays, birthday of king etc)
Fields
Name | Description | Type | Null |
---|---|---|---|
redletterday_id | Primary key | PK | |
reddate | The date | DateTime | |
country_id | Which country does this red letter day belong to. It will show up in the diary for associates with this country as homecountry. | FK country | |
reds | The n´th bit corresponding to the date in dates month, is true if the color is active. | UInt | ● |
colored | The n´th bit corresponding to the date in dates month, is true if the color is active. | UInt | ● |
color | color can be one of the following: RLD_COLOR_BLACK, RLD_COLOR_RED, RLD_COLOR_SPES | UShort | ● |
text | Text to show on the date | String(79) | ● |
updatedCount | Number of updates made to this record | UShort | |
rgbColour | Actual RGB colour index | UInt | ● |
extraFlags | Extra flags, spare field | UInt | ● |
Calendar information regarding which days are to be set in red is stored in a single table
This table is used to mark specific days in the calendar as red. The format of some columns in this table needs further explanation. For every month there will be a row with reddate = month 1st midnight. This should contain a bitmap of all red days for this month in the reds column. This 32-bit bitmap is computed using least significant bit as 1st of month and 1 as red, 0 as not red.
Example:
September 1995. Sundays are 3rd, 10th, 17th and 24th.
Let’s say that the 15th and 23rd are to be marked red in addition to Sundays. This results in the following:
Sundays
1st.................................32nd
00100000 01000000 10000001 00000000
Then extra red letter days
00000000 00000010 00000010 00000000
If we OR these together we get the correct bitmap
00100000 01000010 10000011 00000000
Now LSB is to the left, and we split this into 8-bit portions to make it easier to manipulate. First, move binary LSB to the right as usual
00000100 01000010 11000001 00000000
Then type this number in Windows Calculator’s scientific mode using binary numbers. Then click decimal mode to get the value
12665348
So to set RedLetterDay for September 1995, do as follows:
Get unique ID for RedLetterDay table (id = 27 in Sequence), and increment.
INSERT INTO RedLetterDay (redletterday_id, reddate, country_id, reds) VALUES (next_id, 809913600, mycountry, 12665348)
This will make September 3, 10, 15, 17, 23, 24 red in the calendar.
Indexes
Fields | Types | Description |
---|---|---|
redletterday_id | PK | Unique |
country_id, reddate | FK, DateTime | Clustered |
Relationships
Table | Description |
---|---|
country | Country information |
Replication Flags
- Replicate changes DOWN from central to satellites and travellers.
- Replicate changes UP from satellites and travellers back to central.
- Copy to satellite and travel prototypes.
Security Flags
- No access control via user's Role.