pinchbv / floor

The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications
https://pinchbv.github.io/floor/
Apache License 2.0
951 stars 190 forks source link

SELECT query not works #776

Closed wzhou-grid closed 1 year ago

wzhou-grid commented 1 year ago

My current floor version is 1.4.2. I have updated the following settings: ext.kotlin_version = '1.9.10' ndkVersion '25.1.8937393'

But suddenly, all my select queries stopped working and got errors. The case below is just one example. E/flutter (15705): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Bad state: Unsupported query "SELECT * FROM Groups WHERE isModified" for List return type. It should be SELECT, since DELETE, UPDATE, INSERT returns int type.

This is the query in dao:

@Query('SELECT * FROM Groups WHERE isModified') Future<List<Groups>> GetAllModifiedItems();

Any ideas what happened?

thangbq190893 commented 1 year ago

I had the same problem, my code got stuck there

wzhou-grid commented 1 year ago

I figured out the issues. My table name is Groups, which is a key word of sqlite or floor!! I enclosed it with the double quotes in the query and issue is gone. @Query('SELECT * FROM "Groups" WHERE isModified') Future<List<Groups>> GetAllModifiedItems();

But it is very strange that the old query used to work without the double quotes.

dkaera commented 1 year ago

yup, closed as duplicate #775