Created
July 31, 2009 19:29
-
-
Save jgornick/159385 to your computer and use it in GitHub Desktop.
Sequel Pro Binary Field Showing NULL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `provisionlists` ( | |
`provision_list_id` int(11) NOT NULL auto_increment, | |
`provision_list_uuid` binary(16) NOT NULL, | |
`date_created` datetime NOT NULL, | |
PRIMARY KEY (`provision_list_id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 | |
DELIMITER // | |
DROP TRIGGER IF EXISTS `events`.`insert_provision_list_uuid` // | |
CREATE TRIGGER insert_provision_list_uuid BEFORE INSERT ON provisionlists | |
FOR EACH ROW | |
BEGIN | |
SET NEW.provision_list_uuid = UNHEX(REPLACE(UUID(),'-','')); | |
END;// | |
DELIMITER ; | |
INSERT INTO provisionlists (date_created) VALUES (NOW()); | |
mysql> SELECT * FROM provisionlists; | |
+-------------------+---------------------+---------------------+ | |
| provision_list_id | provision_list_uuid | date_created | | |
+-------------------+---------------------+---------------------+ | |
| 1 | ????W,?*?RrD?' | 2009-07-31 14:18:06 | | |
+-------------------+---------------------+---------------------+ | |
1 row in set (0.00 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment