Use the MySQL function to determine the video extension code _ MySQL
Source: Internet
Author: User
Use the MySQL function to determine the video extension code bitsCN.com
Delimiter |
Drop function if exists IS_MOBILE |
Create function IS_MOBILE (x VARCHAR (255) returns tinyint (1)
BEGIN
DECLARE result TINYINT (1) DEFAULT 0;
SET x = LCASE (x );
If right (x, 4) = '.mp4 'THEN
SET result = 1;
Elseif left (x, 9) = '[ctvideo]' THEN
SET result = 1;
End if;
RETURN result;
END;
Delimiter;
Note:
This method has application scenarios. I used to make a tag in the creation of the sphinx index, for example:
SELECT IS_MOBILE ('http: // www.bitsCN.com/demo/test.mp4') AS m
If the front-end is used in large quantities, the MySQL pressure will be increased. it is recommended that the script program be used.
I personally only have a temporary solution, which will be completed by upgrading the system later. BitsCN.com
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.