-1

I have a query for my Sqlite/Brite databse that takes two conditions. One to check for a selected quarter, and another to make sure an action attribute isn't "delete". When I only have the WHERE clause to check for the selected quarter, I get all the data I want. When I add the WHERE clause to check to make sure it doesn't have a "deleted" attribute, nothing comes back. Nothing should have a deleted attribute so all the same data should come back, but it isn't. Why is this?

Heres the function that's causing me the issues

 Stream<List<dynamic>> getTransaction() async* {
    List _transaction = [];
    final sessionData = await getSession();
    final db = await initDatabase();
    yield* db.createQuery(
        "transactions",
        where: 'action != "delete" AND transaction_quarter = ? ',
        whereArgs: [sessionData['selected_quarter']]
    ).mapToList((row) => TransModel.Transaction.fromMap(row));
  }
Carter
  • 179
  • 11

2 Answers2

0

it looks like you have "delete" in your SQL. I think you'll need 'delete'. They are definitely not the same.

Randal Schwartz
  • 39,428
  • 4
  • 43
  • 70
0

You can try to pass "delete" in args

db.createQuery(
        "transactions",
        where: 'action != ? AND transaction_quarter = ? ',
        whereArgs: ["delete", sessionData['selected_quarter']]
    )
Oleg Plotnikov
  • 305
  • 2
  • 11