mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 12:02:16 +02:00
NF: Use sql to query distinct directly
This commit is contained in:
parent
5378e0626b
commit
13eda5cd0b
@ -37,6 +37,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
@ -121,11 +122,10 @@ class AnkiExporter extends Exporter {
|
||||
Timber.d("Copy cards");
|
||||
mSrc.getDb().getDatabase()
|
||||
.execSQL("INSERT INTO DST_DB.cards select * from cards where id in " + Utils.ids2str(cids));
|
||||
Set<Long> nids = new HashSet<>(mSrc.getDb().queryLongList(
|
||||
"select nid from cards where id in " + Utils.ids2str(cids)));
|
||||
List<Long> uniqueNids = mSrc.getDb().queryLongList(
|
||||
"select distinct nid from cards where id in " + Utils.ids2str(cids));
|
||||
// notes
|
||||
Timber.d("Copy notes");
|
||||
ArrayList<Long> uniqueNids = new ArrayList<>(nids);
|
||||
String strnids = Utils.ids2str(uniqueNids);
|
||||
mSrc.getDb().getDatabase().execSQL("INSERT INTO DST_DB.notes select * from notes where id in " + strnids);
|
||||
// remove system tags if not exporting scheduling info
|
||||
|
Loading…
Reference in New Issue
Block a user