Unfortunately MySQL only supports the CURRENT_TIMESTAMP function for setting default values on a column. If you maintain a CMS type system you’ll more than likely want UUIDs for each article or page, and also likely want to keep that data in your MySQL database. UUIDs are commonly used as unique identifiers in ATOM or RSS news feeds.
To automatically add a UUID when you insert a row, use a trigger:
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
TRIGGER `mydatabase`.`Add UUID to mytable` BEFORE INSERT
ON `mydatabase`.`mytable`
FOR EACH ROW BEGIN
SET NEW.`uuid` = UUID();
END$$
DELIMITER;
UUIDs are 36 characters wide, so a column type of CHAR(36) is suitable.
Posted in Dunno.
Tagged with mysql, triggers, uuid.
By robbiebow
– 1 February, 2010
So a while ago I wrote up a golden opportunity about to be missed and it looks like, indeed, it shall. Despite Bank of England Governor, Mervyn King, calling for exactly the same change, for exactly the same reasons, the Gubmint are going to give the FSA some illusory powers to interfere with bankers’ employment contracts. These powers won’t be used and would be shot down in court if they were. It’s also an after-the-fact measure: The system is buggered already once you have your bonus because you get your bonus after you buy lots of risky debt / sell lots of unsustainable mortgages. It looks like Darling & Brown are more interested in landing a fat bribe consultancy post from the bankers for themselves rather like Tony Blair than making Britain any better a place to live or do business.
Posted in politics.
By robbiebow
– 17 November, 2009
So the key to success with fried rice is to make sure your rice pretty dry before you fry it. Soak it then steam it (or boil it) then dry it a little in a warm pan, turning frequently so that it ends up moist, not damp, and all excess water is steamed off. Then fry it in the wok with a little oil, turning frequently, veg, ginger, Chinese 5 spices &c. I then made a well at the bottom of the wok and added some eggs and basically scrambled them there; mixing in the rice when they were half runny, half cooked, to make egg fried rice. Fry up some diced meat (chicken / pork / whatever) in another pan and add.
Om nom nom!
Posted in cooking.
Tagged with fried rice.
By robbiebow
– 11 November, 2009