gpt4 book ai didi

android - sqlite插入特殊字符

转载 作者:行者123 更新时间:2023-11-29 18:12:50 25 4
gpt4 key购买 nike

db.execSQL("INSERT OR REPLACE INTO 'sms' (sms_id,text) VALUES (10,'__[ ]__|"?___'-@------@- '');");

在 sqlite 上运行它并向我显示这一行:

SQLiteManager: Likely SQL syntax error: INSERT INTO 'sms' (sms_id,text) VALUES (10,'__[ ]__|"?___'-@------@- ''); [ unrecognized token: "@" ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [mozIStorageConnection.createStatement]

我需要一个代码来插入任何带有任何符号的文本

最佳答案

你好,我认为你应该看看在 SQLite 中使用双 qutes '' 转义 qutes

Sqlite FAQ Site - Escaping quotes

所以在你的情况下:

INSERT INTO 'sms' (sms_id,text) VALUES (10,'__[ ]__|"?___''-@------@- '');

关于android - sqlite插入特殊字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9766340/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com