由网友(何以﹌笙箫默)分享简介:这是在SD卡中搜索音乐文件我的SQL查询。this is my SQL query for searching the MUSIC file in the SD CARD.final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;final Str...
这是在SD卡中搜索音乐文件我的SQL查询。
this is my SQL query for searching the MUSIC file in the SD CARD.
final Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
final String[] cursor_cols = {
MediaStore.Audio.Media.TITLE
};
where = MediaStore.Audio.Media.TITLE + " like ('%"+SomeSongTitle+"%')";
cursor = getContentResolver().query(uri, cursor_cols, where, null, null);
SomeSongTitle
是一些任意的输入文本的用户输入。
SomeSongTitle
is some arbitrary input text that the a user input.
我的问题是,为什么当 SomeSongTitle
包含一个单引号(例如 SomeSongTitle =不
),它崩溃。
My Question is why when SomeSongTitle
contains a single Quote(for example SomeSongTitle=don't
), it crashes.
和如何解决?
thankz的阅读,希望从你们= D听到一些解决方案。呵呵
thankz for reading and hope to hear some solution from you guys =D. hehe
推荐答案
要修复它需要用两个单引号来代替单引号。尝试使用类似...
To fix it you need to replace the single quote with two single quotes. Try using something like...
SomeSongTitle = SomeSongTitle.replace("'", "''");
相关推荐
最新文章