我发现在 iPhone 应用程序中更新/插入表格时遇到问题,因为我有一个文本列,当该文本包含 ' 符号时,事情就会变得混乱。处理这个问题的最佳方法是什么?
在使用带有撇号的字符串之前我应该检查吗?有没有一种快速添加格式的方法,可以在每个撇号前面添加转义字符?
这个问题还有道理吗?哈哈。
sqlite 要求 ' 符号转义两个 ''。
从这个看官方sqlite常见问题解答 http://www.sqlite.org/faq.html#q4:
(14) How do I use a string literal that contains an embedded single-quote (') character?
The SQL standard specifies that single-quotes in strings are escaped by putting two single quotes in a row. SQL works like the Pascal programming language in the regard. SQLite follows this standard. Example:
INSERT INTO xyz VALUES('5 O''clock');
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)