- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
104 lines
4.0 KiB
Java
104 lines
4.0 KiB
Java
package androidx.work.impl.model;
|
|
|
|
import android.database.Cursor;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.lifecycle.LiveData;
|
|
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.Collections;
|
|
import java.util.List;
|
|
import java.util.concurrent.Callable;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class PreferenceDao_Impl implements PreferenceDao {
|
|
private final RoomDatabase __db;
|
|
private final EntityInsertionAdapter<Preference> __insertionAdapterOfPreference;
|
|
|
|
public PreferenceDao_Impl(@NonNull RoomDatabase roomDatabase) {
|
|
this.__db = roomDatabase;
|
|
this.__insertionAdapterOfPreference = new EntityInsertionAdapter<Preference>(roomDatabase) { // from class: androidx.work.impl.model.PreferenceDao_Impl.1
|
|
@Override // androidx.room.SharedSQLiteStatement
|
|
@NonNull
|
|
public String createQuery() {
|
|
return "INSERT OR REPLACE INTO `Preference` (`key`,`long_value`) VALUES (?,?)";
|
|
}
|
|
|
|
@Override // androidx.room.EntityInsertionAdapter
|
|
public void bind(@NonNull SupportSQLiteStatement supportSQLiteStatement, @NonNull Preference preference) {
|
|
supportSQLiteStatement.bindString(1, preference.getKey());
|
|
if (preference.getValue() == null) {
|
|
supportSQLiteStatement.bindNull(2);
|
|
} else {
|
|
supportSQLiteStatement.bindLong(2, preference.getValue().longValue());
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.PreferenceDao
|
|
public void insertPreference(Preference preference) {
|
|
this.__db.assertNotSuspendingTransaction();
|
|
this.__db.beginTransaction();
|
|
try {
|
|
this.__insertionAdapterOfPreference.insert((EntityInsertionAdapter<Preference>) preference);
|
|
this.__db.setTransactionSuccessful();
|
|
} finally {
|
|
this.__db.endTransaction();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.PreferenceDao
|
|
public Long getLongValue(String str) {
|
|
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT long_value FROM Preference where `key`=?", 1);
|
|
acquire.bindString(1, str);
|
|
this.__db.assertNotSuspendingTransaction();
|
|
Long l = null;
|
|
Cursor query = DBUtil.query(this.__db, acquire, false, null);
|
|
try {
|
|
if (query.moveToFirst() && !query.isNull(0)) {
|
|
l = Long.valueOf(query.getLong(0));
|
|
}
|
|
return l;
|
|
} finally {
|
|
query.close();
|
|
acquire.release();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.work.impl.model.PreferenceDao
|
|
public LiveData<Long> getObservableLongValue(String str) {
|
|
final RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT long_value FROM Preference where `key`=?", 1);
|
|
acquire.bindString(1, str);
|
|
return this.__db.getInvalidationTracker().createLiveData(new String[]{"Preference"}, false, new Callable<Long>() { // from class: androidx.work.impl.model.PreferenceDao_Impl.2
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // java.util.concurrent.Callable
|
|
@Nullable
|
|
public Long call() throws Exception {
|
|
Long l = null;
|
|
Cursor query = DBUtil.query(PreferenceDao_Impl.this.__db, acquire, false, null);
|
|
try {
|
|
if (query.moveToFirst() && !query.isNull(0)) {
|
|
l = Long.valueOf(query.getLong(0));
|
|
}
|
|
return l;
|
|
} finally {
|
|
query.close();
|
|
}
|
|
}
|
|
|
|
public void finalize() {
|
|
acquire.release();
|
|
}
|
|
});
|
|
}
|
|
|
|
@NonNull
|
|
public static List<Class<?>> getRequiredConverters() {
|
|
return Collections.emptyList();
|
|
}
|
|
}
|