2
Hi, I have a small problem in the following method:
Future<List> getAllTarefasMediaPrioridade(String status) async{
Database dbTarefas = await db;
List<Tarefas> listTarefasMediaPrioridade;
List listMap2 = await dbTarefas.rawQuery("SELECT * FROM $tarefasTable");
if(status.isEmpty){
try{
List listMap = await dbTarefas.rawQuery("SELECT * FROM $tarefasTable"
" WHERE $prioridadeColumn = Media");
for(Map m in listMap) listTarefasMediaPrioridade.add(Tarefas.fromMap(m));
} catch (e){
e.toString();
}
return listTarefasMediaPrioridade;
}
else{
return listTarefasMediaPrioridade = List();
}
}
When I do : List listMap2 = await dbTarefas.rawQuery("SELECT * FROM $tarefasTable");
, he returns me all the data I have in my comic :
Even there is correct, but when I will insert a Where :
final String prioridadeColumn = "prioridadeColumn";
List listMap = await dbTarefas.rawQuery("SELECT * FROM $tarefasTable WHERE $prioridadeColumn = Media");
I get the error: no such column: Media (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM tarefasTable WHERE prioridadeColumn = Media
I can’t identify what’s wrong.
is understanding Media as a column, I think the right one would be
SELECT * FROM $tarefasTable WHERE $prioridadeColumn = 'Media'
– Ricardo Pontual