Skip to content

Commit

Permalink
Fix issue #224
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Richter committed May 5, 2020
1 parent cfa25d3 commit ced14c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion floor_generator/lib/processor/query_method_processor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class QueryMethodProcessor extends Processor<QueryMethod> {

if (query == null || query.isEmpty) throw _processorError.noQueryDefined;

final substitutedQuery = query.replaceAll(RegExp(r':[^\s)]+'), '?');
final substitutedQuery = query.replaceAll(RegExp(r':[.\w]+'), '?');
_assertQueryParameters(substitutedQuery, _methodElement.parameters);
return _replaceInClauseArguments(substitutedQuery);
}
Expand Down
12 changes: 12 additions & 0 deletions floor_generator/test/processor/query_method_processor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@ void main() {

expect(actual, equals('SELECT * FROM Persons WHERE name LIKE ?'));
});

test('Parse query with commas', () async {
final methodElement = await _createQueryMethodElement('''
@Query('SELECT * FROM :table,:othertable')
Future<List<Person>> findPersonsWithNamesLike(String table, String othertable);
''');

final actual =
QueryMethodProcessor(methodElement, [], []).process().query;

expect(actual, equals('SELECT * FROM ?,?'));
});
});

group('errors', () {
Expand Down

0 comments on commit ced14c4

Please sign in to comment.