In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the MySQL string to base64 coding methods, the contents of the article are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand the MySQL string into base64 coding method.
Grammar
TO_BASE64 (str)
Where str is a string that needs to be encoded.
Example 1-basic usage
Here is an example to demonstrate the basic usage:
SELECT TO_BASE64 ('Dog')
Results:
+-+ | TO_BASE64 ('Dog') | +-+ | RG9n | +-+
In this example, the parameter is Dog, and once converted to base-64, it becomes RG9n.
We can use the FROM_BASE64 () function to decode the base-64 string:
SELECT FROM_BASE64 ('RG9n')
Results:
+-+ | FROM_BASE64 ('RG9n') | +-+ | Dog | +-+
Example 2-A long string
Here is an example of using a longer string:
SELECT TO_BASE64 ('My cat chases dogsgiving')
Results:
+-- + | TO_BASE64 ('My cat chases dogsgiving') | +-+ | TXkgY2F0IGNoYXNlcyBkb2dzIQ== | +-+
Example 3-non-string parameter
If the parameter is not a string, it is first converted to a string:
SELECT TO_BASE64 (123)
Results:
+-+ | TO_BASE64 (123) | +-+ | MTIz | +-
Example 4-NULL parameters
If you type NULL, you will get NULL:
SELECT TO_BASE64 (NULL)
Results:
+-+ | TO_BASE64 (NULL) | +-+ | NULL | +-+
Example 5-missing parameter
If you don't pass a parameter, you'll get an error:
SELECT TO_BASE64 ()
Results:
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'TO_BASE64'
Example 6-too many parameters
If you pass in too many parameters, you will also get an error:
SELECT TO_BASE64 ('Cat',' Dog')
Results:
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'TO_BASE64'
After reading the above methods of converting MySQL strings to base64 coding, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.