• <bdo id='L9w9S'></bdo><ul id='L9w9S'></ul>
  • <small id='L9w9S'></small><noframes id='L9w9S'>

  • <tfoot id='L9w9S'></tfoot>

      <legend id='L9w9S'><style id='L9w9S'><dir id='L9w9S'><q id='L9w9S'></q></dir></style></legend>
      <i id='L9w9S'><tr id='L9w9S'><dt id='L9w9S'><q id='L9w9S'><span id='L9w9S'><b id='L9w9S'><form id='L9w9S'><ins id='L9w9S'></ins><ul id='L9w9S'></ul><sub id='L9w9S'></sub></form><legend id='L9w9S'></legend><bdo id='L9w9S'><pre id='L9w9S'><center id='L9w9S'></center></pre></bdo></b><th id='L9w9S'></th></span></q></dt></tr></i><div id='L9w9S'><tfoot id='L9w9S'></tfoot><dl id='L9w9S'><fieldset id='L9w9S'></fieldset></dl></div>

      1. 如何在MySql中转义撇号(')?

        时间:2023-08-19

      2. <tfoot id='rwv2A'></tfoot>
          <tbody id='rwv2A'></tbody>
      3. <i id='rwv2A'><tr id='rwv2A'><dt id='rwv2A'><q id='rwv2A'><span id='rwv2A'><b id='rwv2A'><form id='rwv2A'><ins id='rwv2A'></ins><ul id='rwv2A'></ul><sub id='rwv2A'></sub></form><legend id='rwv2A'></legend><bdo id='rwv2A'><pre id='rwv2A'><center id='rwv2A'></center></pre></bdo></b><th id='rwv2A'></th></span></q></dt></tr></i><div id='rwv2A'><tfoot id='rwv2A'></tfoot><dl id='rwv2A'><fieldset id='rwv2A'></fieldset></dl></div>

          <bdo id='rwv2A'></bdo><ul id='rwv2A'></ul>

            <small id='rwv2A'></small><noframes id='rwv2A'>

            <legend id='rwv2A'><style id='rwv2A'><dir id='rwv2A'><q id='rwv2A'></q></dir></style></legend>

                  本文介绍了如何在MySql中转义撇号(')?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  MySQL 文档说它应该是 \'.但是,scite 和 mysql 都显示 '' 有效.我看到了,它的工作原理.我该怎么办?

                  解决方案

                  您引用的 MySQL 文档实际上比您提到的要多一些.它还说,

                  <块引用>

                  在用'"引用的字符串中的'"可以写成''".

                  (另外,您链接到 MySQL 5.0 版本的表 8.1.特殊字符转义序列,当前版本是 5.6 — 但当前的 表 8.1.特殊字符转义序列看起来非常相似.)

                  我认为 Postgres 注释backslash_quote (string) 参数 提供信息:

                  <块引用>

                  这控制引号是否可以在字符串文字中用 \' 表示.表示引号的首选 SQL 标准方式是将引号加倍 (''),但 PostgreSQL 历来也接受 \'.但是,使用 \' 会带来安全风险...

                  这对我说,与使用反斜杠转义单引号相比,使用双引号字符是更好的整体和长期选择.

                  现在,如果您还想在等式中添加语言选择、​​SQL 数据库及其非标准特性的选择以及查询框架的选择,那么您最终可能会有不同的选择.你没有提供太多关于你的约束的信息.

                  The MySQL documentation says that it should be \'. However, both scite and mysql shows that '' works. I saw that and it works. What should I do?

                  解决方案

                  The MySQL documentation you cite actually says a little bit more than you mention. It also says,

                  A "'" inside a string quoted with "'" may be written as "''".

                  (Also, you linked to the MySQL 5.0 version of Table 8.1. Special Character Escape Sequences, and the current version is 5.6 — but the current Table 8.1. Special Character Escape Sequences looks pretty similar.)

                  I think the Postgres note on the backslash_quote (string) parameter is informative:

                  This controls whether a quote mark can be represented by \' in a string literal. The preferred, SQL-standard way to represent a quote mark is by doubling it ('') but PostgreSQL has historically also accepted \'. However, use of \' creates security risks...

                  That says to me that using a doubled single-quote character is a better overall and long-term choice than using a backslash to escape the single-quote.

                  Now if you also want to add choice of language, choice of SQL database and its non-standard quirks, and choice of query framework to the equation, then you might end up with a different choice. You don't give much information about your constraints.

                  这篇关于如何在MySql中转义撇号(')?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MySQL 条件插入 下一篇:mysql如何加入两个表?

                  相关文章

                  最新文章

                    <i id='suFbI'><tr id='suFbI'><dt id='suFbI'><q id='suFbI'><span id='suFbI'><b id='suFbI'><form id='suFbI'><ins id='suFbI'></ins><ul id='suFbI'></ul><sub id='suFbI'></sub></form><legend id='suFbI'></legend><bdo id='suFbI'><pre id='suFbI'><center id='suFbI'></center></pre></bdo></b><th id='suFbI'></th></span></q></dt></tr></i><div id='suFbI'><tfoot id='suFbI'></tfoot><dl id='suFbI'><fieldset id='suFbI'></fieldset></dl></div>
                  1. <legend id='suFbI'><style id='suFbI'><dir id='suFbI'><q id='suFbI'></q></dir></style></legend>

                    • <bdo id='suFbI'></bdo><ul id='suFbI'></ul>
                  2. <small id='suFbI'></small><noframes id='suFbI'>

                    1. <tfoot id='suFbI'></tfoot>