- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
95 lines
3.4 KiB
Java
95 lines
3.4 KiB
Java
package androidx.room.util;
|
|
|
|
import android.database.Cursor;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
|
import kotlin.io.CloseableKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
/* loaded from: classes.dex */
|
|
public final class ViewInfo {
|
|
public static final Companion Companion = new Companion(null);
|
|
public final String name;
|
|
public final String sql;
|
|
|
|
public static final ViewInfo read(SupportSQLiteDatabase supportSQLiteDatabase, String str) {
|
|
return Companion.read(supportSQLiteDatabase, str);
|
|
}
|
|
|
|
public ViewInfo(String name, String str) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
this.name = name;
|
|
this.sql = str;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ViewInfo)) {
|
|
return false;
|
|
}
|
|
ViewInfo viewInfo = (ViewInfo) obj;
|
|
if (Intrinsics.areEqual(this.name, viewInfo.name)) {
|
|
String str = this.sql;
|
|
String str2 = viewInfo.sql;
|
|
if (str != null) {
|
|
if (Intrinsics.areEqual(str, str2)) {
|
|
return true;
|
|
}
|
|
} else if (str2 == null) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hashCode = this.name.hashCode() * 31;
|
|
String str = this.sql;
|
|
return hashCode + (str != null ? str.hashCode() : 0);
|
|
}
|
|
|
|
public String toString() {
|
|
return "ViewInfo{name='" + this.name + "', sql='" + this.sql + "'}";
|
|
}
|
|
|
|
@SourceDebugExtension({"SMAP\nViewInfo.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ViewInfo.kt\nandroidx/room/util/ViewInfo$Companion\n+ 2 CursorUtil.kt\nandroidx/room/util/CursorUtil\n*L\n1#1,83:1\n145#2,7:84\n*S KotlinDebug\n*F\n+ 1 ViewInfo.kt\nandroidx/room/util/ViewInfo$Companion\n*L\n73#1:84,7\n*E\n"})
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public final ViewInfo read(SupportSQLiteDatabase database, String viewName) {
|
|
ViewInfo viewInfo;
|
|
Intrinsics.checkNotNullParameter(database, "database");
|
|
Intrinsics.checkNotNullParameter(viewName, "viewName");
|
|
Cursor query = database.query("SELECT name, sql FROM sqlite_master WHERE type = 'view' AND name = '" + viewName + '\'');
|
|
try {
|
|
if (query.moveToFirst()) {
|
|
String string = query.getString(0);
|
|
Intrinsics.checkNotNullExpressionValue(string, "cursor.getString(0)");
|
|
viewInfo = new ViewInfo(string, query.getString(1));
|
|
} else {
|
|
viewInfo = new ViewInfo(viewName, null);
|
|
}
|
|
CloseableKt.closeFinally(query, null);
|
|
return viewInfo;
|
|
} catch (Throwable th) {
|
|
try {
|
|
throw th;
|
|
} catch (Throwable th2) {
|
|
CloseableKt.closeFinally(query, th);
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|