- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
125 lines
4.7 KiB
Java
125 lines
4.7 KiB
Java
package androidx.work.impl.model;
|
|
|
|
import android.database.Cursor;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.room.EntityInsertionAdapter;
|
|
import androidx.room.RoomDatabase;
|
|
import androidx.room.RoomSQLiteQuery;
|
|
import androidx.room.util.DBUtil;
|
|
import androidx.sqlite.db.SupportSQLiteStatement;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class DependencyDao_Impl implements DependencyDao {
|
|
private final RoomDatabase __db;
|
|
private final EntityInsertionAdapter<Dependency> __insertionAdapterOfDependency;
|
|
|
|
public DependencyDao_Impl(@NonNull RoomDatabase roomDatabase) {
|
|
this.__db = roomDatabase;
|
|
this.__insertionAdapterOfDependency = new EntityInsertionAdapter<Dependency>(roomDatabase) { // from class: androidx.work.impl.model.DependencyDao_Impl.1
|
|
@Override // androidx.room.SharedSQLiteStatement
|
|
@NonNull
|
|
public String createQuery() {
|
|
return "INSERT OR IGNORE INTO `Dependency` (`work_spec_id`,`prerequisite_id`) VALUES (?,?)";
|
|
}
|
|
|
|
@Override // androidx.room.EntityInsertionAdapter
|
|
public void bind(@NonNull SupportSQLiteStatement supportSQLiteStatement, @NonNull Dependency dependency) {
|
|
supportSQLiteStatement.bindString(1, dependency.getWorkSpecId());
|
|
supportSQLiteStatement.bindString(2, dependency.getPrerequisiteId());
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.DependencyDao
|
|
public void insertDependency(Dependency dependency) {
|
|
this.__db.assertNotSuspendingTransaction();
|
|
this.__db.beginTransaction();
|
|
try {
|
|
this.__insertionAdapterOfDependency.insert((EntityInsertionAdapter<Dependency>) dependency);
|
|
this.__db.setTransactionSuccessful();
|
|
} finally {
|
|
this.__db.endTransaction();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.DependencyDao
|
|
public boolean hasCompletedAllPrerequisites(String str) {
|
|
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT COUNT(*)=0 FROM dependency WHERE work_spec_id=? AND prerequisite_id IN (SELECT id FROM workspec WHERE state!=2)", 1);
|
|
acquire.bindString(1, str);
|
|
this.__db.assertNotSuspendingTransaction();
|
|
boolean z = false;
|
|
Cursor query = DBUtil.query(this.__db, acquire, false, null);
|
|
try {
|
|
if (query.moveToFirst()) {
|
|
z = query.getInt(0) != 0;
|
|
}
|
|
return z;
|
|
} finally {
|
|
query.close();
|
|
acquire.release();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.DependencyDao
|
|
public List<String> getPrerequisites(String str) {
|
|
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT prerequisite_id FROM dependency WHERE work_spec_id=?", 1);
|
|
acquire.bindString(1, str);
|
|
this.__db.assertNotSuspendingTransaction();
|
|
Cursor query = DBUtil.query(this.__db, acquire, false, null);
|
|
try {
|
|
ArrayList arrayList = new ArrayList(query.getCount());
|
|
while (query.moveToNext()) {
|
|
arrayList.add(query.getString(0));
|
|
}
|
|
return arrayList;
|
|
} finally {
|
|
query.close();
|
|
acquire.release();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.DependencyDao
|
|
public List<String> getDependentWorkIds(String str) {
|
|
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT work_spec_id FROM dependency WHERE prerequisite_id=?", 1);
|
|
acquire.bindString(1, str);
|
|
this.__db.assertNotSuspendingTransaction();
|
|
Cursor query = DBUtil.query(this.__db, acquire, false, null);
|
|
try {
|
|
ArrayList arrayList = new ArrayList(query.getCount());
|
|
while (query.moveToNext()) {
|
|
arrayList.add(query.getString(0));
|
|
}
|
|
return arrayList;
|
|
} finally {
|
|
query.close();
|
|
acquire.release();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.DependencyDao
|
|
public boolean hasDependents(String str) {
|
|
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT COUNT(*)>0 FROM dependency WHERE prerequisite_id=?", 1);
|
|
acquire.bindString(1, str);
|
|
this.__db.assertNotSuspendingTransaction();
|
|
boolean z = false;
|
|
Cursor query = DBUtil.query(this.__db, acquire, false, null);
|
|
try {
|
|
if (query.moveToFirst()) {
|
|
z = query.getInt(0) != 0;
|
|
}
|
|
return z;
|
|
} finally {
|
|
query.close();
|
|
acquire.release();
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public static List<Class<?>> getRequiredConverters() {
|
|
return Collections.emptyList();
|
|
}
|
|
}
|