我在sqlite的問題。Sqlite + Android行結果中的空列
我把我預先加載的sqlite數據庫放在我的應用程序上,一切正常,連接正常,數據庫的存在沒問題。但是,當我查詢選擇一些行只返回一列中的空數據。我檢查過我的數據庫,那行裏唯一奇怪的是那個行/列中的字符。
如何查詢我的數據庫以返回所有結果甚至是具有奇怪字符的行?
這是我的代碼,我試圖獲得行。
public List<Song> getAllSongs(){
List<Song> result = new ArrayList<Song>();
String selectQuery = "select a.Name, b.Name from Song as a, Artist as b where a.IdArtist = b._id order by a.Name";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()){
do{
Song song = new Song();
song.setName(cursor.getString(0));
song.setArtist(cursor.getString(1));
result.add(song);
}while(cursor.moveToNext());
}
return result;
}
而且也,我奇怪的字符的含義是「'」,‘N’,...
你試過什麼?請給出你的java代碼。 – Sajmon 2013-03-24 22:42:44
更重要的是:定義「奇怪的人物」並舉例說明。 – 2013-03-24 22:48:48
我已更新我的代碼來獲取行,當我嘗試cursor.getString(1)它是空的:( – shinjidev 2013-03-24 22:49:17