lib/search: generate list of ? instead of interpolation
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:jadb/_data_ingestion/jmdict/table_names.dart';
|
||||
import 'package:jadb/_data_ingestion/tanos-jlpt/objects.dart';
|
||||
import 'package:jadb/_data_ingestion/tanos-jlpt/overrides.dart';
|
||||
import 'package:jadb/util/sqlite_utils.dart';
|
||||
import 'package:sqflite_common/sqlite_api.dart';
|
||||
|
||||
Future<List<int>> _findReadingCandidates(
|
||||
@@ -13,7 +12,8 @@ Future<List<int>> _findReadingCandidates(
|
||||
JMdictTableNames.readingElement,
|
||||
columns: ['entryId'],
|
||||
where:
|
||||
'reading IN (${word.readings.map((e) => escapeStringValue(e)).join(',')})',
|
||||
'"reading" IN (${List.filled(word.readings.length, '?').join(',')})',
|
||||
whereArgs: [...word.readings],
|
||||
)
|
||||
.then((rows) => rows.map((row) => row['entryId'] as int).toList());
|
||||
|
||||
@@ -34,14 +34,20 @@ Future<List<(int, String)>> _findSenseCandidates(
|
||||
JLPTRankedWord word,
|
||||
Database db,
|
||||
) =>
|
||||
db
|
||||
.rawQuery('SELECT entryId, phrase '
|
||||
'FROM ${JMdictTableNames.senseGlossary} '
|
||||
'JOIN ${JMdictTableNames.sense} USING (senseId)'
|
||||
'WHERE phrase IN (${word.meanings.map((e) => escapeStringValue(e)).join(',')})')
|
||||
.then((rows) => rows
|
||||
.map((row) => (row['entryId'] as int, row['phrase'] as String))
|
||||
.toList());
|
||||
db.rawQuery(
|
||||
'SELECT entryId, phrase '
|
||||
'FROM "${JMdictTableNames.senseGlossary}" '
|
||||
'JOIN "${JMdictTableNames.sense}" USING (senseId)'
|
||||
'WHERE phrase IN (${List.filled(
|
||||
word.meanings.length,
|
||||
'?',
|
||||
).join(',')})',
|
||||
[...word.meanings],
|
||||
).then(
|
||||
(rows) => rows
|
||||
.map((row) => (row['entryId'] as int, row['phrase'] as String))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Future<int?> findEntry(
|
||||
JLPTRankedWord word,
|
||||
|
||||
Reference in New Issue
Block a user