Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

25.10. MySQL 专有命令

25.10.1. SQL_NO_CACHE

SELECT /*!40001 SQL_NO_CACHE */ * FROM table
		

25.10.2. SIGNAL Syntax

DROP TRIGGER `members_before_insert`;
CREATE DEFINER=`neo`@`%` TRIGGER `members_before_insert` BEFORE INSERT ON `members` FOR EACH ROW BEGIN
	IF new.username IS NOT NULL THEN
		IF not exists(select username from members_available where username = new.username) THEN
	   	/*set new.username = NULL;*/
	   	SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'An error occurred', MYSQL_ERRNO = 1001;
		END IF;
	END IF;
END;
		

		
comments powered by Disqus