如何转义 cql 中的符号字符 (&)?

How do I escape the ampersand character (&) in cql?

我正在向 table 中插入一个语句,看起来像这样: insert into db.table (field1, field2) values (1, 'eggs&cheese')

但是当我稍后在我们的服务器上查询这个错误时,我的查询 returns: eggs\u0026cheese 相反。

不确定是使用\还是'

如果有人能提供帮助,那就太好了。谢谢!

这似乎不是 CQL 的问题,而是您的应用显示值的方式。

例如,如果 CQL 列类型是 text,则 unicode 字符被编码为 UTF-8 字符串。

使用此示例架构:

CREATE TABLE unicodechars (
    id int PRIMARY KEY,
    randomtext text
)

cqlsh 按预期显示 & 符号:

cqlsh> SELECT * FROM unicodechars  ;

 id | randomtext
----+-------------
  1 | eggs&cheese