From 3192fa76378c0a42ef1e4f088b51f5561766116e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AD=E5=BC=80=E7=AE=B1?= Date: Tue, 10 Jan 2023 20:01:03 +0800 Subject: [PATCH 1/7] =?UTF-8?q?[=E6=89=8B=E5=8A=A8=E9=80=89=E9=A2=98][news?= =?UTF-8?q?]:=2020230109.3=20=E2=AD=90=EF=B8=8F=20OBS=20Studio=2029=20Rele?= =?UTF-8?q?ase=20Has=20Little=20in=20Store=20For=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...io 29 Release Has Little in Store For Linux.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/news/20230109.3 ⭐️ OBS Studio 29 Release Has Little in Store For Linux.md diff --git a/sources/news/20230109.3 ⭐️ OBS Studio 29 Release Has Little in Store For Linux.md b/sources/news/20230109.3 ⭐️ OBS Studio 29 Release Has Little in Store For Linux.md new file mode 100644 index 0000000000..a6d65103b1 --- /dev/null +++ b/sources/news/20230109.3 ⭐️ OBS Studio 29 Release Has Little in Store For Linux.md @@ -0,0 +1,92 @@ +[#]: subject: "OBS Studio 29 Release Has Little in Store For Linux" +[#]: via: "https://news.itsfoss.com/obs-studio-29-release/" +[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/" +[#]: collector: "lkxed" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +OBS Studio 29 Release Has Little in Store For Linux +====== + +OBS Studio 29 is an exciting release with key improvements across all platforms. + +![OBS Studio 29 Release Has Little in Store For Linux][1] + +[OBS Studio][2] is one of the most popular open-source screen recording and streaming software. + +Used by many Linux users and content creators, it has a pretty neat set of tools and features that lets you record and stream content. + +Its last major release was back in September 2022, which brought in native support for Apple Silicon, updated UI, improved color support, and more. + +Its next release, v29, seems to be a bit interesting, but not so much for Linux users 😞 + +### OBS Studio 29: What's New? + +![obs studio 29][3] + +This release has plenty of improvements and fixes; some of the highlights include the following: + +- **Media key support for Linux** +- **New Audio Filters** +- **Improved NVIDIA Video and Audio Filters** +- **Better Encoder Support** +- **Various Fixes and Improvements** + +**Media key support:** You can finally use the media keys on your keyboard to control the playback or the volume with OBS on Linux. + +**New Audio Filters:** OBS Studio 29 features two new audio filters, an upward compressor filter, and a 3-band equalizer filter. + +**Improved NVIDIA Video and Audio Filters:** Various improvements have been made to these filters. + +A new Mask Refresh slider has been added, alongside support for temporal processing, that is supposed to provide better quality masking. + +**Better Encoder Support:** Well, OBS Studio 29 received improved support for several encoders, such as: + +- AMD AV1 Encoder for[RX7000 series][4] of GPUs on Windows. +- Intel AV1 Encoder for [Arc GPUs][5] on Windows. +- Intel HEVC Encoder on Windows. +- Native HEVC and ProRes encoders for macOS. + +> 📋 Note that support for these encoders is only for either Windows or macOS.Sadly, they miss out on support for Linux. We hope these are added in a future release of OBS Studio. + +**Various Fixes and Improvements:** Apart from the ones listed above, OBS Studio 29 features plenty of other changes, such as: + +- Websockets 5.1.0 +- The replay buffer's memory limit is now limited to 75% of installed system RAM, instead of being fixed to 8 GB. +- Support for encryption and authentication for SRT and RIST outputs. +- Ability to inspect and/or mute individual browser docks. +- Support for higher refresh rates in case of video captures. + +For more technical details, you can go through the [official release notes][6]. + +### Download OBS Studio 29 + +To get the latest OBS Studio 29, you can get the [Flatpak][7], the recommended method. + +You can also explore other installation methods mentioned in its official download page. + +[OBS Studio 29][8] + +-------------------------------------------------------------------------------- + +via: https://news.itsfoss.com/obs-studio-29-release/ + +作者:[Sourav Rudra][a] +选题:[lkxed][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://news.itsfoss.com/author/sourav/ +[b]: https://github.com/lkxed +[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/obs-studio-29-release.png +[2]: https://obsproject.com +[3]: https://news.itsfoss.com/content/images/2023/01/OBS_Studio_29.png +[4]: https://en.wikipedia.org/wiki/Radeon_RX_7000_series +[5]: https://www.intel.in/content/www/in/en/products/details/discrete-gpus/arc.html +[6]: https://github.com/obsproject/obs-studio/releases/tag/29.0.0 +[7]: https://flathub.org/apps/details/com.obsproject.Studio +[8]: https://obsproject.com/download From eac9131992876e2f3591d461f3614c640bc129fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AD=E5=BC=80=E7=AE=B1?= Date: Tue, 10 Jan 2023 20:03:41 +0800 Subject: [PATCH 2/7] =?UTF-8?q?[=E6=89=8B=E5=8A=A8=E9=80=89=E9=A2=98][tech?= =?UTF-8?q?]:=2020230110.0=20=E2=AD=90=EF=B8=8F=E2=AD=90=EF=B8=8F=20A=20gu?= =?UTF-8?q?ide=20to=20strings=20in=20MySQL.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0110.0 ⭐️⭐️ A guide to strings in MySQL.md | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md diff --git a/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md b/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md new file mode 100644 index 0000000000..a0047585ee --- /dev/null +++ b/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md @@ -0,0 +1,228 @@ +[#]: subject: "A guide to strings in MySQL" +[#]: via: "https://opensource.com/article/23/1/strings-mysql" +[#]: author: "Hunter Coleman https://opensource.com/users/hunterc" +[#]: collector: "lkxed" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +A guide to strings in MySQL +====== + +Strings are one of the most common data types you will use in MySQL. Many users insert and read strings in their databases without thinking too much about them. This article aims to give you a bit of a deep dive into how MySQL stores and displays your string variables so that you can have better control over your data. + +You can break strings into two categories: binary and nonbinary. You probably think about nonbinary strings most of the time. Nonbinary strings have character sets and collations. Binary strings, on the other hand, store things such as MP3 files or images. Even if you store a word in a binary string, such as **song**, it is not stored in the same way as in a nonbinary string. + +I will focus on nonbinary strings. All nonbinary strings in MySQL are associated with a character set and a collation. A string's character set controls what characters can be stored in the string, and its collation controls how the strings are ordered when you display them. + +### Character sets + +To view the character sets on your system, run the following command: + +``` +SHOW CHARACTER SET; +``` + +This command will output four columns of data, including the character set: + +- Name +- Brief description +- Default collation +- Maximum size of each character in the character set + +MySQL used to default to the **latin1** character set, but since version 8.0, the default has been **utf8mb4**. The default collation is now **utf8mb4_0900_ai_ci**. The **ai** indicates that this collation is accent insensitive (**á = a**), and the **ci** specifies that it is case insensitive (**a = A**). + +Different character sets store their characters in various-sized chunks of memory. For example, as you can see from the above command, characters stored in **utf8mb4** are stored in memory from one to four bytes in size. If you want to see if a string has multibyte characters, you can use the **CHAR_LENGTH()** and **LENGTH()** functions. **CHAR_LENGTH()** displays how many characters a string contains, whereas **LENGTH()** shows how many bytes a string has, which may or may not be the same as a string's length in characters, depending on the character set. Here is an example: + +``` +SET @a = CONVERT('data' USING latin1); + +SELECT LENGTH(@a), CHAR_LENGTH(@a); + ++------------+-----------------+ +| LENGTH(@a) | CHAR_LENGTH(@a) | ++------------+-----------------+ +| 4 | 4 | ++------------+-----------------+ +``` + +This example shows that the **latin1** character set stores characters in single-byte units. Other character sets, such as **utf16**, allow multibyte characters: + +``` +SET @b = CONVERT('data' USING utf16); + +SELECT LENGTH(@b), CHAR_LENGTH(@b); + ++------------+------------------+ +| LENGTH(@b) | CHAR_LENGTH(@b) | ++------------+------------------+ +| 8 | 4 | ++------------+------------------+ +``` + +### Collation + +A string's collation will determine how the values are displayed when you run a SQL statement with an **ORDER BY** clause. Your choice of collations is determined by what character set you select. When you ran the command `SHOW CHARACTER SET` above, you saw the default collations for each character set. You can easily see all the collations available for a particular character set. For example, if you want to see which collations are allowed by the **utf8mb4** character set, run: + +``` +SHOW COLLATION LIKE 'utf8mb4%'; +``` + +A collation can be case-insensitive, case-sensitive, or binary. Let's build a simple table, insert a few values into it, and then view the data using different collations to see how the output differs: + +``` +CREATE TABLE sample (s CHAR(5)); + +INSERT INTO sample (s) VALUES + ('AAAAA'), ('ccccc'), ('bbbbb'), ('BBBBB'), ('aaaaa'), ('CCCCC'); + +SELECT * FROM sample; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| ccccc | +| bbbbb | +| BBBBB | +| aaaaa | +| CCCCC | ++-----------+ +``` + +With case-insensitive collations, your data is returned in alphabetical order, but there is no guarantee that capitalized words will come before lowercase words, as seen below: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_turkish_ci; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| aaaaa | +| bbbbb | +| BBBBB | +| ccccc | +| CCCCC | ++-----------+ +``` + +On the other hand, when MySQL runs a case-sensitive search, lowercase will come before uppercase for each letter: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_as_cs; + ++-----------+ +| s | ++-----------+ +| aaaaa | +| AAAAA | +| bbbbb | +| BBBBB | +| ccccc | +| CCCCC | ++-----------+ +``` + +And binary collations will return all capitalized words before lowercase words: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_bin; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| ccccc | +| bbbbb | +| BBBBB | +| aaaaa | +| CCCCC | ++-----------+ +``` + +If you want to know which character set and collation a string uses, you can use the aptly named **charset** and **collation** functions. A server running MySQL version 8.0 or higher will default to using the **utf8mb4** character set and **utf8mb4_0900_ai-ci** collation: + +``` +SELECT charset('data'); + ++-------------------+ +| charset('data') | ++-------------------+ +| utf8mb4 | ++-------------------+ + + SELECT collation('data'); + ++--------------------+ +| collation('data') | ++--------------------+ +| utf8mb4_0900_ai_ci | ++--------------------+ +``` + +You can use the `SET NAMES` command to change the character set or collation used. + +To change from the **utf8mb4** character set to **utf16**, run this command: + +``` +SET NAMES 'utf16'; +``` + +If you would also like to choose a collation other than the default, you can add a **COLLATE** clause to the `SET NAMES` command. + +For example, say your database stores words in the Spanish language. The default collation for MySQL (**utf8mb4_0900_ai_ci**) sees ch and ll as two different characters and will sort them as such. But in Spanish, ch and ll are individual letters, so if you want them sorted in the proper order (following c and l, respectively), you need to use a different collation. One option is to use the **utf8mb4_spanish2_ci** collation. + +``` +SET NAMES 'utf8mb4' COLLATE 'utf8mb4_spanish2-ci'; +``` + +### Storing strings + +MySQL allows you to choose between several data types for your string values. (Even more so than other popular databases such as PostgreSQL and MongoDB.) + +Here is a list of MySQL's binary string data types, their nonbinary equivalents, and their maximum length: + +- **binary:** char (255) +- **varbinary:** varchar (65,535) +- **tinyblob:** tinytext (255) +- **blob:** text (65,535) +- **mediumblob:** mediumtext (16,777,215) +- **longblob:** longtext (4,294,967,295) + +One important thing to remember is that unlike the varbinary, varchar, text, and blob types, which are stored in variable length fields (that is, using only as much space as needed), MySQL stores binary and char types in fixed length fields. So a value such as **char(20)** or **binary(20)** will always take up 20 bytes, even if you store less than 20 characters in them. MySQL pads the values with the **ASCII NUL** value (**0x00**) for binary types and spaces for char types. + +Another thing to consider when choosing data types is whether you want spaces after the string to be preserved or stripped. When displaying data, MySQL strips whitespace from data stored with the char data type, but not varchar. + +``` +CREATE TABLE sample2 (s1 CHAR(10), s2 VARCHAR(10)); + +INSERT INTO sample2 (s1, s2) VALUES ('cat ', 'cat '); + +SELECT s1, s2, CHAR_LENGTH(s1), CHAR_LENGTH(s2) FROM sample2; + ++---------+---------+-----------------------------------+ +| s1 | s2 | CHAR_LENGTH(s1) | CHAR_LENGTH(s2) | ++---------+---------+-----------------------------------+ +| cat | cat | 3 | 10 | ++---------+---------+-----------------------------------+ +``` + +### Wrap up + +Strings are one of the most common data types used in databases, and MySQL remains one of the most popular database systems in use today. I hope that you have learned something new from this article and will be able to use your new knowledge to improve your database skills. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/23/1/strings-mysql + +作者:[Hunter Coleman][a] +选题:[lkxed][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hunterc +[b]: https://github.com/lkxed From 66504130fc3125c0af27456c2585bcb9be740f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AD=E5=BC=80=E7=AE=B1?= Date: Tue, 10 Jan 2023 20:05:08 +0800 Subject: [PATCH 3/7] =?UTF-8?q?[=E6=89=8B=E5=8A=A8=E9=80=89=E9=A2=98][news?= =?UTF-8?q?]:=2020230110.2=20=E2=AD=90=EF=B8=8F=20Wow!=20CoolerMaster's=20?= =?UTF-8?q?MasterPlus=20Software=20to=20Go=20Open=20Source!.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...er's MasterPlus Software to Go Open Source!.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md diff --git a/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md b/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md new file mode 100644 index 0000000000..ca57c55a4f --- /dev/null +++ b/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md @@ -0,0 +1,80 @@ +[#]: subject: "Wow! CoolerMaster's MasterPlus Software to Go Open Source!" +[#]: via: "https://news.itsfoss.com/coolermaster-open-source-software/" +[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/" +[#]: collector: "lkxed" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +Wow! CoolerMaster's MasterPlus Software to Go Open Source! +====== + +MasterPlus to get a complete overhaul and an open-source version? Sounds good! + +![Wow! CoolerMaster's MasterPlus Software to Go Open Source!][1] + +Most gaming/peripheral software suits are either proprietary or not officially available for Linux. + +As a result, we must constantly look for open-source tools to configure our hardware to get native functionality. + +The likes of [Piper][2], [OpenRGB][3], [Solaar][4], etc. come in handy in these situations. + +But, sometimes, even these are not enough. + +Luckily, [CoolerMaster][5] has decided to release an open-source version of its [MasterPlus][6] software that aims to work with its coolers and non-CoolerMaster coolers. + +**While this does not guarantee its availability for Linux systems, we can definitely hope for it.** + +This move should also encourage other companies like Razer and Logitech to consider making open-source tools that do away with bloat found in them. + +Let's see what CoolerMaster plans to do. + +### MasterPlus Open-Source Version: What We Know So Far + +![coolermaster masterplus revamp][7] + +**CoolerMaster revealed their plans to release a new MasterPlus open-source version** in the recent [CES 2023][8] event. Kudos to **Albert** from [Boring Text Reviews][9] for bringing this to our attention. + +**What to expect?:** A complete redesign of the MasterPlus software, with an API plug-in system that allows non-CoolerMaster coolers to integrate with it. + +They have clarified that exclusive CoolerMaster features won't work with other coolers. So, things such as detecting a leak in an AIO cooler or calculating the PSU's efficiency can't be tracked for third-party products. + +Instead, the application will only support reading basic performance info such as temperature and fan speed with the ability to configure ARGB devices. + +If you ask me, **this is better than nothing.** And, if you happen to use CoolerMaster components for your system, it is an exciting news for you! + +CoolerMaster also showcased a potential application of the API system by letting it hook into a photo application and using it to control a secondary display integrated into a computer case's side. + +Furthermore, they also introduced full cloud integration for their software. But sadly, this will not be made open-source. + +**When to expect?:** + +We do not have a concrete release date for the open sourcing of MasterPlus. + +But, if I were to guess, sometime in 2023 would be the best bet. + +💬 _Even if the tool is not confirmed to work for Linux users, on open-source tool is a good start, isn't it? What do you think?_ + +-------------------------------------------------------------------------------- + +via: https://news.itsfoss.com/coolermaster-open-source-software/ + +作者:[Sourav Rudra][a] +选题:[lkxed][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://news.itsfoss.com/author/sourav/ +[b]: https://github.com/lkxed +[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/coolermaster-masterplus-goes-opensource.png +[2]: https://github.com/libratbag/piper +[3]: https://openrgb.org +[4]: https://github.com/pwr-Solaar/Solaar +[5]: https://www.coolermaster.com +[6]: https://masterplus.coolermaster.com +[7]: https://news.itsfoss.com/content/images/2023/01/CoolerMaster_MasterPlus_Revamp-1.png +[8]: https://www.ces.tech +[9]: https://boringtextreviews.com/exclusive-say-goodbye-to-bloated-closed-source-software-coolermaster-to-release-new-open-source-version-of-its-software-with-api-integration-and-it-can-work-with-other-coolers-too From e4a926172e070a240f4fd610310e668f9a5c4924 Mon Sep 17 00:00:00 2001 From: Drwhooooo <90264412+Drwhooooo@users.noreply.github.com> Date: Tue, 10 Jan 2023 21:06:22 +0800 Subject: [PATCH 4/7] apply for traslation request, ID: Drwhooooo already add my id into the blank ( the translator line) --- ...here, a few there, pretty soon you-re talking real memory.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20210105 A few bytes here, a few there, pretty soon you-re talking real memory.md b/sources/tech/20210105 A few bytes here, a few there, pretty soon you-re talking real memory.md index dfdd3ed0d0..feea6a91df 100644 --- a/sources/tech/20210105 A few bytes here, a few there, pretty soon you-re talking real memory.md +++ b/sources/tech/20210105 A few bytes here, a few there, pretty soon you-re talking real memory.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Drwhooooo) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8e0c7207ac29ca6e416c6b71900f0f40c2e60d30 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Jan 2023 10:54:52 +0800 Subject: [PATCH 5/7] ALL @wxy https://linux.cn/article-15433-1.html --- ...er's MasterPlus Software to Go Open Source!.md | 78 ++++++++++++++++++ ...er's MasterPlus Software to Go Open Source!.md | 80 ------------------- 2 files changed, 78 insertions(+), 80 deletions(-) create mode 100644 published/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md delete mode 100644 sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md diff --git a/published/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md b/published/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md new file mode 100644 index 0000000000..000cffc3b4 --- /dev/null +++ b/published/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md @@ -0,0 +1,78 @@ +[#]: subject: "Wow! CoolerMaster's MasterPlus Software to Go Open Source!" +[#]: via: "https://news.itsfoss.com/coolermaster-open-source-software/" +[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/" +[#]: collector: "lkxed" +[#]: translator: "wxy" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-15433-1.html" + +酷冷至尊(CoolerMaster)的 MasterPlus 软件即将开源 +====== + +> MasterPlus 将被彻底改造并推出开源版本?听起来不错! + +![][1] + +大多数游戏/外设软件套装要么是专有的,要么是没有对 Linux 的官方支持。 + +因此,我们必须不断寻找开源工具来配置我们的硬件以获得原生功能。 + +像 [Piper][2]、[OpenRGB][3]、[Solaar][4] 等在这些情况下都很有用。 + +但是,有时候,即使是这些也是不够的。 + +幸运的是,[酷冷至尊(CoolerMaster)][5] 已经决定发布其 [MasterPlus][6] 软件的开源版本,旨在为其散热器和第三方的散热器提供服务。 + +**虽然这并不能保证它可以用在 Linux 系统上,但我们绝对可以期待它。** + +此举也应该鼓励雷蛇和罗技这样公司考虑制作精简过的开源工具。 + +让我们看看酷冷至尊打算怎么做。 + +### MasterPlus 开源版本:我们目前所知的情况 + +![酷冷至尊 Masterplus 改版][7] + +**酷冷至尊在最近的 [CES 2023][8] 活动中透露了他们计划发布新的 MasterPlus 开源版本**。感谢来自 [Boring Text Reviews][9] 的 Albert 让我们注意到了这一点。 + +**预期会有什么?** 对 MasterPlus 软件进行了全面的重新设计,有一个 API 插件系统,允许非酷冷至尊散热器与之整合。 + +他们已经澄清,酷冷至尊的独有功能不能配合其他散热器一起工作。因此,诸如检测 AIO 散热器的泄漏或计算 PSU 的效率等,都不能对第三方产品进行跟踪。 + +相反,该应用程序将只支持读取基本的性能信息,如温度和风扇速度,并能够配置 ARGB 设备。 + +如果你问我,**这总比没有好。** 而且,如果你的系统碰巧使用了酷冷至尊的组件,这对你来说是一个令人兴奋的消息! + +酷冷至尊还展示了 API 系统的潜在应用,让它与一个照片应用程序挂钩,用它来控制集成在电脑机箱侧面的辅助显示器。 + +此外,他们还介绍了其软件的全面云整合。但遗憾的是,这部分不会开源。 + +**什么时候?** 我们还没有 MasterPlus 开源的具体发布日期。 + +但是,如果让我猜,2023 年的某个时候是最好的选择。 + +💬 _即使该工具没有被确认可以在 Linux 上工作,对开源工具来说也是一个好的开始,不是吗?你怎么看?_ + +-------------------------------------------------------------------------------- + +via: https://news.itsfoss.com/coolermaster-open-source-software/ + +作者:[Sourav Rudra][a] +选题:[lkxed][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://news.itsfoss.com/author/sourav/ +[b]: https://github.com/lkxed +[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/coolermaster-masterplus-goes-opensource.png +[2]: https://github.com/libratbag/piper +[3]: https://openrgb.org +[4]: https://github.com/pwr-Solaar/Solaar +[5]: https://www.coolermaster.com +[6]: https://masterplus.coolermaster.com +[7]: https://news.itsfoss.com/content/images/2023/01/CoolerMaster_MasterPlus_Revamp-1.png +[8]: https://www.ces.tech +[9]: https://boringtextreviews.com/exclusive-say-goodbye-to-bloated-closed-source-software-coolermaster-to-release-new-open-source-version-of-its-software-with-api-integration-and-it-can-work-with-other-coolers-too diff --git a/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md b/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md deleted file mode 100644 index ca57c55a4f..0000000000 --- a/sources/news/20230110.2 ⭐️ Wow! CoolerMaster's MasterPlus Software to Go Open Source!.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: subject: "Wow! CoolerMaster's MasterPlus Software to Go Open Source!" -[#]: via: "https://news.itsfoss.com/coolermaster-open-source-software/" -[#]: author: "Sourav Rudra https://news.itsfoss.com/author/sourav/" -[#]: collector: "lkxed" -[#]: translator: " " -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " - -Wow! CoolerMaster's MasterPlus Software to Go Open Source! -====== - -MasterPlus to get a complete overhaul and an open-source version? Sounds good! - -![Wow! CoolerMaster's MasterPlus Software to Go Open Source!][1] - -Most gaming/peripheral software suits are either proprietary or not officially available for Linux. - -As a result, we must constantly look for open-source tools to configure our hardware to get native functionality. - -The likes of [Piper][2], [OpenRGB][3], [Solaar][4], etc. come in handy in these situations. - -But, sometimes, even these are not enough. - -Luckily, [CoolerMaster][5] has decided to release an open-source version of its [MasterPlus][6] software that aims to work with its coolers and non-CoolerMaster coolers. - -**While this does not guarantee its availability for Linux systems, we can definitely hope for it.** - -This move should also encourage other companies like Razer and Logitech to consider making open-source tools that do away with bloat found in them. - -Let's see what CoolerMaster plans to do. - -### MasterPlus Open-Source Version: What We Know So Far - -![coolermaster masterplus revamp][7] - -**CoolerMaster revealed their plans to release a new MasterPlus open-source version** in the recent [CES 2023][8] event. Kudos to **Albert** from [Boring Text Reviews][9] for bringing this to our attention. - -**What to expect?:** A complete redesign of the MasterPlus software, with an API plug-in system that allows non-CoolerMaster coolers to integrate with it. - -They have clarified that exclusive CoolerMaster features won't work with other coolers. So, things such as detecting a leak in an AIO cooler or calculating the PSU's efficiency can't be tracked for third-party products. - -Instead, the application will only support reading basic performance info such as temperature and fan speed with the ability to configure ARGB devices. - -If you ask me, **this is better than nothing.** And, if you happen to use CoolerMaster components for your system, it is an exciting news for you! - -CoolerMaster also showcased a potential application of the API system by letting it hook into a photo application and using it to control a secondary display integrated into a computer case's side. - -Furthermore, they also introduced full cloud integration for their software. But sadly, this will not be made open-source. - -**When to expect?:** - -We do not have a concrete release date for the open sourcing of MasterPlus. - -But, if I were to guess, sometime in 2023 would be the best bet. - -💬 _Even if the tool is not confirmed to work for Linux users, on open-source tool is a good start, isn't it? What do you think?_ - --------------------------------------------------------------------------------- - -via: https://news.itsfoss.com/coolermaster-open-source-software/ - -作者:[Sourav Rudra][a] -选题:[lkxed][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://news.itsfoss.com/author/sourav/ -[b]: https://github.com/lkxed -[1]: https://news.itsfoss.com/content/images/size/w2000/2023/01/coolermaster-masterplus-goes-opensource.png -[2]: https://github.com/libratbag/piper -[3]: https://openrgb.org -[4]: https://github.com/pwr-Solaar/Solaar -[5]: https://www.coolermaster.com -[6]: https://masterplus.coolermaster.com -[7]: https://news.itsfoss.com/content/images/2023/01/CoolerMaster_MasterPlus_Revamp-1.png -[8]: https://www.ces.tech -[9]: https://boringtextreviews.com/exclusive-say-goodbye-to-bloated-closed-source-software-coolermaster-to-release-new-open-source-version-of-its-software-with-api-integration-and-it-can-work-with-other-coolers-too From 328b0ddcc3426dda3777d79dbf26e9f6be8d385e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Jan 2023 11:37:46 +0800 Subject: [PATCH 6/7] ATR @wxy --- ...0110.0 ⭐️⭐️ A guide to strings in MySQL.md | 228 ----------------- ...0110.0 ⭐️⭐️ A guide to strings in MySQL.md | 230 ++++++++++++++++++ 2 files changed, 230 insertions(+), 228 deletions(-) delete mode 100644 sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md create mode 100644 translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md diff --git a/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md b/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md deleted file mode 100644 index a0047585ee..0000000000 --- a/sources/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md +++ /dev/null @@ -1,228 +0,0 @@ -[#]: subject: "A guide to strings in MySQL" -[#]: via: "https://opensource.com/article/23/1/strings-mysql" -[#]: author: "Hunter Coleman https://opensource.com/users/hunterc" -[#]: collector: "lkxed" -[#]: translator: " " -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " - -A guide to strings in MySQL -====== - -Strings are one of the most common data types you will use in MySQL. Many users insert and read strings in their databases without thinking too much about them. This article aims to give you a bit of a deep dive into how MySQL stores and displays your string variables so that you can have better control over your data. - -You can break strings into two categories: binary and nonbinary. You probably think about nonbinary strings most of the time. Nonbinary strings have character sets and collations. Binary strings, on the other hand, store things such as MP3 files or images. Even if you store a word in a binary string, such as **song**, it is not stored in the same way as in a nonbinary string. - -I will focus on nonbinary strings. All nonbinary strings in MySQL are associated with a character set and a collation. A string's character set controls what characters can be stored in the string, and its collation controls how the strings are ordered when you display them. - -### Character sets - -To view the character sets on your system, run the following command: - -``` -SHOW CHARACTER SET; -``` - -This command will output four columns of data, including the character set: - -- Name -- Brief description -- Default collation -- Maximum size of each character in the character set - -MySQL used to default to the **latin1** character set, but since version 8.0, the default has been **utf8mb4**. The default collation is now **utf8mb4_0900_ai_ci**. The **ai** indicates that this collation is accent insensitive (**á = a**), and the **ci** specifies that it is case insensitive (**a = A**). - -Different character sets store their characters in various-sized chunks of memory. For example, as you can see from the above command, characters stored in **utf8mb4** are stored in memory from one to four bytes in size. If you want to see if a string has multibyte characters, you can use the **CHAR_LENGTH()** and **LENGTH()** functions. **CHAR_LENGTH()** displays how many characters a string contains, whereas **LENGTH()** shows how many bytes a string has, which may or may not be the same as a string's length in characters, depending on the character set. Here is an example: - -``` -SET @a = CONVERT('data' USING latin1); - -SELECT LENGTH(@a), CHAR_LENGTH(@a); - -+------------+-----------------+ -| LENGTH(@a) | CHAR_LENGTH(@a) | -+------------+-----------------+ -| 4 | 4 | -+------------+-----------------+ -``` - -This example shows that the **latin1** character set stores characters in single-byte units. Other character sets, such as **utf16**, allow multibyte characters: - -``` -SET @b = CONVERT('data' USING utf16); - -SELECT LENGTH(@b), CHAR_LENGTH(@b); - -+------------+------------------+ -| LENGTH(@b) | CHAR_LENGTH(@b) | -+------------+------------------+ -| 8 | 4 | -+------------+------------------+ -``` - -### Collation - -A string's collation will determine how the values are displayed when you run a SQL statement with an **ORDER BY** clause. Your choice of collations is determined by what character set you select. When you ran the command `SHOW CHARACTER SET` above, you saw the default collations for each character set. You can easily see all the collations available for a particular character set. For example, if you want to see which collations are allowed by the **utf8mb4** character set, run: - -``` -SHOW COLLATION LIKE 'utf8mb4%'; -``` - -A collation can be case-insensitive, case-sensitive, or binary. Let's build a simple table, insert a few values into it, and then view the data using different collations to see how the output differs: - -``` -CREATE TABLE sample (s CHAR(5)); - -INSERT INTO sample (s) VALUES - ('AAAAA'), ('ccccc'), ('bbbbb'), ('BBBBB'), ('aaaaa'), ('CCCCC'); - -SELECT * FROM sample; - -+-----------+ -| s | -+-----------+ -| AAAAA | -| ccccc | -| bbbbb | -| BBBBB | -| aaaaa | -| CCCCC | -+-----------+ -``` - -With case-insensitive collations, your data is returned in alphabetical order, but there is no guarantee that capitalized words will come before lowercase words, as seen below: - -``` -SELECT * FROM sample ORDER BY s COLLATE utf8mb4_turkish_ci; - -+-----------+ -| s | -+-----------+ -| AAAAA | -| aaaaa | -| bbbbb | -| BBBBB | -| ccccc | -| CCCCC | -+-----------+ -``` - -On the other hand, when MySQL runs a case-sensitive search, lowercase will come before uppercase for each letter: - -``` -SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_as_cs; - -+-----------+ -| s | -+-----------+ -| aaaaa | -| AAAAA | -| bbbbb | -| BBBBB | -| ccccc | -| CCCCC | -+-----------+ -``` - -And binary collations will return all capitalized words before lowercase words: - -``` -SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_bin; - -+-----------+ -| s | -+-----------+ -| AAAAA | -| ccccc | -| bbbbb | -| BBBBB | -| aaaaa | -| CCCCC | -+-----------+ -``` - -If you want to know which character set and collation a string uses, you can use the aptly named **charset** and **collation** functions. A server running MySQL version 8.0 or higher will default to using the **utf8mb4** character set and **utf8mb4_0900_ai-ci** collation: - -``` -SELECT charset('data'); - -+-------------------+ -| charset('data') | -+-------------------+ -| utf8mb4 | -+-------------------+ - - SELECT collation('data'); - -+--------------------+ -| collation('data') | -+--------------------+ -| utf8mb4_0900_ai_ci | -+--------------------+ -``` - -You can use the `SET NAMES` command to change the character set or collation used. - -To change from the **utf8mb4** character set to **utf16**, run this command: - -``` -SET NAMES 'utf16'; -``` - -If you would also like to choose a collation other than the default, you can add a **COLLATE** clause to the `SET NAMES` command. - -For example, say your database stores words in the Spanish language. The default collation for MySQL (**utf8mb4_0900_ai_ci**) sees ch and ll as two different characters and will sort them as such. But in Spanish, ch and ll are individual letters, so if you want them sorted in the proper order (following c and l, respectively), you need to use a different collation. One option is to use the **utf8mb4_spanish2_ci** collation. - -``` -SET NAMES 'utf8mb4' COLLATE 'utf8mb4_spanish2-ci'; -``` - -### Storing strings - -MySQL allows you to choose between several data types for your string values. (Even more so than other popular databases such as PostgreSQL and MongoDB.) - -Here is a list of MySQL's binary string data types, their nonbinary equivalents, and their maximum length: - -- **binary:** char (255) -- **varbinary:** varchar (65,535) -- **tinyblob:** tinytext (255) -- **blob:** text (65,535) -- **mediumblob:** mediumtext (16,777,215) -- **longblob:** longtext (4,294,967,295) - -One important thing to remember is that unlike the varbinary, varchar, text, and blob types, which are stored in variable length fields (that is, using only as much space as needed), MySQL stores binary and char types in fixed length fields. So a value such as **char(20)** or **binary(20)** will always take up 20 bytes, even if you store less than 20 characters in them. MySQL pads the values with the **ASCII NUL** value (**0x00**) for binary types and spaces for char types. - -Another thing to consider when choosing data types is whether you want spaces after the string to be preserved or stripped. When displaying data, MySQL strips whitespace from data stored with the char data type, but not varchar. - -``` -CREATE TABLE sample2 (s1 CHAR(10), s2 VARCHAR(10)); - -INSERT INTO sample2 (s1, s2) VALUES ('cat ', 'cat '); - -SELECT s1, s2, CHAR_LENGTH(s1), CHAR_LENGTH(s2) FROM sample2; - -+---------+---------+-----------------------------------+ -| s1 | s2 | CHAR_LENGTH(s1) | CHAR_LENGTH(s2) | -+---------+---------+-----------------------------------+ -| cat | cat | 3 | 10 | -+---------+---------+-----------------------------------+ -``` - -### Wrap up - -Strings are one of the most common data types used in databases, and MySQL remains one of the most popular database systems in use today. I hope that you have learned something new from this article and will be able to use your new knowledge to improve your database skills. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/23/1/strings-mysql - -作者:[Hunter Coleman][a] -选题:[lkxed][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/hunterc -[b]: https://github.com/lkxed diff --git a/translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md b/translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md new file mode 100644 index 0000000000..56af862ef8 --- /dev/null +++ b/translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md @@ -0,0 +1,230 @@ +[#]: subject: "A guide to strings in MySQL" +[#]: via: "https://opensource.com/article/23/1/strings-mysql" +[#]: author: "Hunter Coleman https://opensource.com/users/hunterc" +[#]: collector: "lkxed" +[#]: translator: "wxy" +[#]: reviewer: "wxy" +[#]: publisher: " " +[#]: url: " " + +MySQL 字符串指南 +====== + +> 了解 MySQL 如何存储和显示你的字符串变量,以便你能更好地控制你的数据。 + +字符串是你在 MySQL 中使用的最常见的数据类型之一。许多用户在他们的数据库中插入和读取字符串,而没有认真地了解过它们。本文旨在让你深入了解 MySQL 如何存储和显示你的字符串变量,以便你能更好地控制你的数据。 + +你可以把字符串分成两类:二进制和非二进制。你可能在大多数时候想到的是非二进制字符串。非二进制字符串有字符集和排序的不同。另一方面,二进制字符串存储诸如 MP3 文件或图像等东西。即使你在二进制字符串中存储了一个词,比如“歌曲”,它的存储方式也与非二进制字符串不同。 + +我将重点讨论非二进制字符串。MySQL 中的所有非二进制字符串都与字符集和排序相关。字符串的字符集控制哪些字符可以存储在字符串中,而它的排序方式控制当你显示字符串时如何排序。 + +### 字符集 + +要查看你系统中的字符集,请运行以下命令: + +``` +SHOW CHARACTER SET; +``` + +这个命令将输出四列数据,包括字符集: + +- 名称 +- 简要描述 +- 默认的排序方式 +- 字符集中每个字符的最大尺寸 + +MySQL 过去默认为 `latin1` 字符集,但自 8.0 版以来,默认为 `utf8mb4`。现在的默认排序方式是 `utf8mb4_0900_ai_ci`。`ai` 表示该排序对音调不敏感( `á` = `a`),而 `ci` 则指定它对大小写不敏感(`a` = `A`)。 + +不同的字符集将其字符存储在内存中不同大小的块中。例如,从上面的命令可以看出,存储在 `utf8mb4` 的字符被存储在 1 到 4 个字节大小的内存中。如果你想看看一个字符串是否包含多字节的字符,你可以使用 `CHAR_LENGTH()` 和 `LENGTH()` 函数。`CHAR_LENGTH()` 显示一个字符串包含多少个字符,而 `LENGTH()` 显示一个字符串有多少个字节,根据字符集的不同,它可能与一个字符串的字符长度相同,也可能不相同。下面是一个例子: + +``` +SET @a = CONVERT('data' USING latin1); + +SELECT LENGTH(@a), CHAR_LENGTH(@a); + ++------------+-----------------+ +| LENGTH(@a) | CHAR_LENGTH(@a) | ++------------+-----------------+ +| 4 | 4 | ++------------+-----------------+ +``` + +这个例子表明,`latin1` 字符集以单字节为单位存储字符。其他字符集,如 `utf16`,允许多字节的字符: + +``` +SET @b = CONVERT('data' USING utf16); + +SELECT LENGTH(@b), CHAR_LENGTH(@b); + ++------------+------------------+ +| LENGTH(@b) | CHAR_LENGTH(@b) | ++------------+------------------+ +| 8 | 4 | ++------------+------------------+ +``` + +### 排序 + +当你运行带有 `ORDER BY` 子句的 SQL 语句时,字符串排序方式将决定值的显示方式。你对排序方式的选择是由你选择的字符集决定的。当你运行上面的 `SHOW CHARACTER SET` 命令时,你看到了每个字符集的默认排序方式。你可以很容易地看到某个特定字符集的所有排序方式。例如,如果你想查看 `utf8mb4` 字符集允许哪些排序,请运行: + +``` +SHOW COLLATION LIKE 'utf8mb4%'; +``` + +排序方式可以是不区分大小写的,也可以是区分大小写的,或者是二进制的。让我们建立一个简单的表,向其中插入一些值,然后用不同的排序方式查看数据,看看输出结果有什么不同: + +``` +CREATE TABLE sample (s CHAR(5)); + +INSERT INTO sample (s) VALUES + ('AAAAA'), ('ccccc'), ('bbbbb'), ('BBBBB'), ('aaaaa'), ('CCCCC'); + +SELECT * FROM sample; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| ccccc | +| bbbbb | +| BBBBB | +| aaaaa | +| CCCCC | ++-----------+ +``` + +在不区分大小写的情况下,你的数据会按字母顺序返回,但不能保证大写的单词会排在小写的单词之前,如下图所示: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_turkish_ci; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| aaaaa | +| bbbbb | +| BBBBB | +| ccccc | +| CCCCC | ++-----------+ +``` + +另一方面,当 MySQL 运行大小写敏感的搜索时,每个字母的小写将排在大写之前: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_as_cs; + ++-----------+ +| s | ++-----------+ +| aaaaa | +| AAAAA | +| bbbbb | +| BBBBB | +| ccccc | +| CCCCC | ++-----------+ +``` + +而按二进制排序方式将返回所有大写的值,然后再返回小写的值: + +``` +SELECT * FROM sample ORDER BY s COLLATE utf8mb4_0900_bin; + ++-----------+ +| s | ++-----------+ +| AAAAA | +| ccccc | +| bbbbb | +| BBBBB | +| aaaaa | +| CCCCC | ++-----------+ +``` + +如果你想知道一个字符串使用哪种字符集和排序,你可以使用被恰当命名的 `charset` 和 `collation` 函数。运行 MySQL 8.0 或更高版本的服务器将默认使用 `utf8mb4` 字符集和 `utf8mb4_0900_ai_ci` 排序: + +``` +SELECT charset('data'); + ++-------------------+ +| charset('data') | ++-------------------+ +| utf8mb4 | ++-------------------+ + +SELECT collation('data'); + ++--------------------+ +| collation('data') | ++--------------------+ +| utf8mb4_0900_ai_ci | ++--------------------+ +``` + +你可以使用 `SET NAMES` 命令来改变所使用的字符集或排序方式。 + +要从 `utf8mb4` 字符集改为 `utf16`,运行这个命令: + +``` +SET NAMES 'utf16'; +``` + +如果你想选择默认以外的排序方式,你可以在 `SET NAMES` 命令中添加一个 `COLLATE` 子句。 + +例如,假设你的数据库存储西班牙语的单词。MySQL 的默认排序(`utf8mb4_0900_ai_ci`)将 `ch` 和 `ll` 视为两个不同的字符,并将它们排序。但在西班牙语中,`ch` 和 `ll` 是单独的字母,所以如果你想让它们按正确的顺序排序(分别排在 `c` 和 `l` 之后),你需要使用不同的排序。一个选择是使用 `utf8mb4_spanish2_ci` 排序方式: + +``` +SET NAMES 'utf8mb4' COLLATE 'utf8mb4_spanish2_ci'; +``` + +### 储存字符串 + +MySQL 允许你为你的字符串值选择不同的数据类型。(甚至比其他流行的数据库,如 PostgreSQL 和 MongoDB 更多。) + +下面是 MySQL 的二进制字符串数据类型的列表、它们的非二进制对应物,以及它们的最大长度: + +- `binary`:`char`(255) +- `varbinary`:`varchar`(65,535) +- `tinyblob`:`tinytext`(255) +- `blob`:`text`(65,535) +- `mediumblob`:`mediumtext`(16,777,215) +- `longblob`:`longtext`(4,294,967,295) + +要记住的一件重要事情是,与被存储在可变长度的字段中的 `varbinary`、`varchar`、`text` 和 `blob` 类型不同(也就是说,只使用需要的空间),MySQL 将二进制(`binary`)和字符(`char`)类型存储在固定长度的字段。因此,像 `char(20)` 或 `binary(20)` 这样的值将总是占用 20 个字节,即使你在其中存储了少于 20 个字符。对于二进制类型,MySQL用 ASCII NUL 值(`0x00`)填充这些值,对于 字符类型,用空格填充。 + +在选择数据类型时要考虑的另一件事是,你是否希望在字符串后面的空格被保留或剥离。在显示数据时,MySQL 会从以字符数据类型存储的数据中剥离空格,但不会剥离 `varchar` 的空格。 + +``` +CREATE TABLE sample2 (s1 CHAR(10), s2 VARCHAR(10)); + +INSERT INTO sample2 (s1, s2) VALUES ('cat ', 'cat '); + +SELECT s1, s2, CHAR_LENGTH(s1), CHAR_LENGTH(s2) FROM sample2; + ++---------+---------+-----------------------------------+ +| s1 | s2 | CHAR_LENGTH(s1) | CHAR_LENGTH(s2) | ++---------+---------+-----------------------------------+ +| cat | cat | 3 | 10 | ++---------+---------+-----------------------------------+ +``` + +### 总结 + +字符串是数据库中最常用的数据类型之一,而 MySQL 仍然是当今最流行的数据库系统之一。我希望你能从这篇文章中学到一些新的东西,并能用你的新知识来提高你的数据库技能。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/23/1/strings-mysql + +作者:[Hunter Coleman][a] +选题:[lkxed][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hunterc +[b]: https://github.com/lkxed From 0d9ae8cb642c65e866708bfd5f6fffc47d3950b4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 11 Jan 2023 16:15:13 +0800 Subject: [PATCH 7/7] P @wxy https://linux.cn/article-15434-1.html --- .../20230110.0 ⭐️⭐️ A guide to strings in MySQL.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename {translated/tech => published}/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md (98%) diff --git a/translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md b/published/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md similarity index 98% rename from translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md rename to published/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md index 56af862ef8..73372bd403 100644 --- a/translated/tech/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md +++ b/published/20230110.0 ⭐️⭐️ A guide to strings in MySQL.md @@ -4,12 +4,14 @@ [#]: collector: "lkxed" [#]: translator: "wxy" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-15434-1.html" MySQL 字符串指南 ====== +![][0] + > 了解 MySQL 如何存储和显示你的字符串变量,以便你能更好地控制你的数据。 字符串是你在 MySQL 中使用的最常见的数据类型之一。许多用户在他们的数据库中插入和读取字符串,而没有认真地了解过它们。本文旨在让你深入了解 MySQL 如何存储和显示你的字符串变量,以便你能更好地控制你的数据。 @@ -228,3 +230,4 @@ via: https://opensource.com/article/23/1/strings-mysql [a]: https://opensource.com/users/hunterc [b]: https://github.com/lkxed +[0]: https://img.linux.net.cn/data/attachment/album/202301/11/161410lh9944zpgjgmgs8t.jpg \ No newline at end of file