我怎样才能插入双引号(")到SQLite数据库VARCHAR字段? [英] How can i insert double quote ( " ) into SQLite Database Varchar field?

查看:1024
本文介绍了我怎样才能插入双引号(")到SQLite数据库VARCHAR字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图插入表与此字段 TITLE VARCHAR(200)NOT NULL 下一句:

I'm trying to insert into a table with this field TITLE varchar(200) NOT NULL the next sentence:

INSERT OR IGNORE INTO EXAMPLETABLE VALUES ("1-Preludi \"Obrint Pas 2011\"", ... 

问题是,SQLite的missunderstand的\\逃卡拉科特,我不知道如何把它放在我的Andr​​oid程序来解决这个问题(也许一个字符code?)。

The problem is that SQLite missunderstand the \" escape caracter , and i don't know how to put it to resolve the problem (Maybe a character code?) in my Android program.

推荐答案

要插入值到数据库中你应该总是使用的 SQLiteStatement (<一个href=\"http://stackoverflow.com/questions/433392/how-do-i-use-$p$ppared-statements-in-sqlite-in-android\">HowTo)因为他们逃脱你的价值观和prevent您的应用程序被到 SQL-注射的目标。

To insert values into a database you should always use SQLiteStatement (HowTo) as they escape your values and prevent your app from being a target to SQL-Injections.

此外,它多次执行编译的语句是快则是多次执行正常的插入语句。

Also, a compiled statement which is executed multiple times is faster then a normal insert-statement which is executed multiple times.

这篇关于我怎样才能插入双引号(&QUOT;)到SQLite数据库VARCHAR字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆