Conversation
Codecov Report
@@ Coverage Diff @@
## develop #315 +/- ##
===========================================
- Coverage 90.08% 90.07% -0.01%
===========================================
Files 74 64 -10
Lines 1855 1673 -182
===========================================
- Hits 1671 1507 -164
+ Misses 184 166 -18
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Are you finished already and want a review or is this WIP? If its a work in progress, please convert this PR into a draft for now(The option should be somewhere on the right). |
|
@mqus Any better ideas to accomplish this feature? |
|
I think the architecture of floor (or room for that matter) is not well-suited for dynamic querying or query-building, but your approach can definitely work and be a middle ground/workaround for that. We could try to move to a more complex and powerful RawQuery like room has in the future (when the other building blocks for that are ready) but I think this is sufficient for now . What are your thoughts, @vitusortner ? |
| @required final T Function(Map<String, dynamic>) mapper, | ||
| }) async { | ||
| final rows = await _database.rawQuery(sql, arguments); | ||
| final rows = await (isRaw ? _database.rawQuery(sql.replaceAll('?', arguments[0])) : _database.rawQuery(sql, arguments)); |
There was a problem hiding this comment.
This behaviour (using multiple arguments with multiple ? in a query will insert the first argument in all of them) can be pretty unexpected. please use all arguments for replacing and check if the number of ? and arguments match up.
| @required final T Function(Map<String, dynamic>) mapper, | ||
| }) async { | ||
| final rows = await _database.rawQuery(sql, arguments); | ||
| final rows = await (isRaw ? _database.rawQuery(sql.replaceAll('?', arguments[0])) : _database.rawQuery(sql, arguments)); |
# Conflicts: # floor_generator/lib/misc/constants.dart # floor_generator/lib/processor/query_method_processor.dart # floor_generator/lib/value_object/query_method.dart
|
I need this feature now, How can use your commit in my project? |
# Conflicts: # floor/lib/src/adapter/query_adapter.dart # floor_generator/lib/processor/query_method_processor.dart # floor_generator/lib/writer/database_writer.dart # floor_generator/lib/writer/query_method_writer.dart
Can achieve raw query like this:
and condition like: