Files
cuidamais/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/UserDao_Impl.java.uniqueId4

302 lines
10 KiB
Plaintext

package com.example.cuida.data.dao;
import android.database.Cursor;
import androidx.annotation.NonNull;
import androidx.room.EntityDeletionOrUpdateAdapter;
import androidx.room.EntityInsertionAdapter;
import androidx.room.RoomDatabase;
import androidx.room.RoomSQLiteQuery;
import androidx.room.SharedSQLiteStatement;
import androidx.room.util.CursorUtil;
import androidx.room.util.DBUtil;
import androidx.sqlite.db.SupportSQLiteStatement;
import com.example.cuida.data.model.User;
import java.lang.Class;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Collections;
import java.util.List;
@SuppressWarnings({"unchecked", "deprecation"})
public final class UserDao_Impl implements UserDao {
private final RoomDatabase __db;
private final EntityInsertionAdapter<User> __insertionAdapterOfUser;
private final EntityDeletionOrUpdateAdapter<User> __updateAdapterOfUser;
private final SharedSQLiteStatement __preparedStmtOfDeleteAll;
public UserDao_Impl(@NonNull final RoomDatabase __db) {
this.__db = __db;
this.__insertionAdapterOfUser = new EntityInsertionAdapter<User>(__db) {
@Override
@NonNull
protected String createQuery() {
return "INSERT OR REPLACE INTO `users` (`uid`,`name`,`email`,`password`,`age`,`utenteNumber`,`profilePictureUri`) VALUES (nullif(?, 0),?,?,?,?,?,?)";
}
@Override
protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
statement.bindLong(1, entity.uid);
if (entity.name == null) {
statement.bindNull(2);
} else {
statement.bindString(2, entity.name);
}
if (entity.email == null) {
statement.bindNull(3);
} else {
statement.bindString(3, entity.email);
}
if (entity.password == null) {
statement.bindNull(4);
} else {
statement.bindString(4, entity.password);
}
statement.bindLong(5, entity.age);
if (entity.utenteNumber == null) {
statement.bindNull(6);
} else {
statement.bindString(6, entity.utenteNumber);
}
if (entity.profilePictureUri == null) {
statement.bindNull(7);
} else {
statement.bindString(7, entity.profilePictureUri);
}
}
};
this.__updateAdapterOfUser = new EntityDeletionOrUpdateAdapter<User>(__db) {
@Override
@NonNull
protected String createQuery() {
return "UPDATE OR ABORT `users` SET `uid` = ?,`name` = ?,`email` = ?,`password` = ?,`age` = ?,`utenteNumber` = ?,`profilePictureUri` = ? WHERE `uid` = ?";
}
@Override
protected void bind(@NonNull final SupportSQLiteStatement statement, final User entity) {
statement.bindLong(1, entity.uid);
if (entity.name == null) {
statement.bindNull(2);
} else {
statement.bindString(2, entity.name);
}
if (entity.email == null) {
statement.bindNull(3);
} else {
statement.bindString(3, entity.email);
}
if (entity.password == null) {
statement.bindNull(4);
} else {
statement.bindString(4, entity.password);
}
statement.bindLong(5, entity.age);
if (entity.utenteNumber == null) {
statement.bindNull(6);
} else {
statement.bindString(6, entity.utenteNumber);
}
if (entity.profilePictureUri == null) {
statement.bindNull(7);
} else {
statement.bindString(7, entity.profilePictureUri);
}
statement.bindLong(8, entity.uid);
}
};
this.__preparedStmtOfDeleteAll = new SharedSQLiteStatement(__db) {
@Override
@NonNull
public String createQuery() {
final String _query = "delete from users";
return _query;
}
};
}
@Override
public void insert(final User user) {
__db.assertNotSuspendingTransaction();
__db.beginTransaction();
try {
__insertionAdapterOfUser.insert(user);
__db.setTransactionSuccessful();
} finally {
__db.endTransaction();
}
}
@Override
public void update(final User user) {
__db.assertNotSuspendingTransaction();
__db.beginTransaction();
try {
__updateAdapterOfUser.handle(user);
__db.setTransactionSuccessful();
} finally {
__db.endTransaction();
}
}
@Override
public void deleteAll() {
__db.assertNotSuspendingTransaction();
final SupportSQLiteStatement _stmt = __preparedStmtOfDeleteAll.acquire();
try {
__db.beginTransaction();
try {
_stmt.executeUpdateDelete();
__db.setTransactionSuccessful();
} finally {
__db.endTransaction();
}
} finally {
__preparedStmtOfDeleteAll.release(_stmt);
}
}
@Override
public User login(final String email, final String password) {
final String _sql = "SELECT * FROM users WHERE email = ? AND password = ? LIMIT 1";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 2);
int _argIndex = 1;
if (email == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, email);
}
_argIndex = 2;
if (password == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, password);
}
__db.assertNotSuspendingTransaction();
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
final int _cursorIndexOfEmail = CursorUtil.getColumnIndexOrThrow(_cursor, "email");
final int _cursorIndexOfPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "password");
final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "age");
final int _cursorIndexOfUtenteNumber = CursorUtil.getColumnIndexOrThrow(_cursor, "utenteNumber");
final int _cursorIndexOfProfilePictureUri = CursorUtil.getColumnIndexOrThrow(_cursor, "profilePictureUri");
final User _result;
if (_cursor.moveToFirst()) {
final String _tmpName;
if (_cursor.isNull(_cursorIndexOfName)) {
_tmpName = null;
} else {
_tmpName = _cursor.getString(_cursorIndexOfName);
}
final String _tmpEmail;
if (_cursor.isNull(_cursorIndexOfEmail)) {
_tmpEmail = null;
} else {
_tmpEmail = _cursor.getString(_cursorIndexOfEmail);
}
final String _tmpPassword;
if (_cursor.isNull(_cursorIndexOfPassword)) {
_tmpPassword = null;
} else {
_tmpPassword = _cursor.getString(_cursorIndexOfPassword);
}
final int _tmpAge;
_tmpAge = _cursor.getInt(_cursorIndexOfAge);
final String _tmpUtenteNumber;
if (_cursor.isNull(_cursorIndexOfUtenteNumber)) {
_tmpUtenteNumber = null;
} else {
_tmpUtenteNumber = _cursor.getString(_cursorIndexOfUtenteNumber);
}
_result = new User(_tmpName,_tmpEmail,_tmpPassword,_tmpAge,_tmpUtenteNumber);
_result.uid = _cursor.getInt(_cursorIndexOfUid);
if (_cursor.isNull(_cursorIndexOfProfilePictureUri)) {
_result.profilePictureUri = null;
} else {
_result.profilePictureUri = _cursor.getString(_cursorIndexOfProfilePictureUri);
}
} else {
_result = null;
}
return _result;
} finally {
_cursor.close();
_statement.release();
}
}
@Override
public User checkUser(final String email) {
final String _sql = "SELECT * FROM users WHERE email = ? LIMIT 1";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
int _argIndex = 1;
if (email == null) {
_statement.bindNull(_argIndex);
} else {
_statement.bindString(_argIndex, email);
}
__db.assertNotSuspendingTransaction();
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfUid = CursorUtil.getColumnIndexOrThrow(_cursor, "uid");
final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
final int _cursorIndexOfEmail = CursorUtil.getColumnIndexOrThrow(_cursor, "email");
final int _cursorIndexOfPassword = CursorUtil.getColumnIndexOrThrow(_cursor, "password");
final int _cursorIndexOfAge = CursorUtil.getColumnIndexOrThrow(_cursor, "age");
final int _cursorIndexOfUtenteNumber = CursorUtil.getColumnIndexOrThrow(_cursor, "utenteNumber");
final int _cursorIndexOfProfilePictureUri = CursorUtil.getColumnIndexOrThrow(_cursor, "profilePictureUri");
final User _result;
if (_cursor.moveToFirst()) {
final String _tmpName;
if (_cursor.isNull(_cursorIndexOfName)) {
_tmpName = null;
} else {
_tmpName = _cursor.getString(_cursorIndexOfName);
}
final String _tmpEmail;
if (_cursor.isNull(_cursorIndexOfEmail)) {
_tmpEmail = null;
} else {
_tmpEmail = _cursor.getString(_cursorIndexOfEmail);
}
final String _tmpPassword;
if (_cursor.isNull(_cursorIndexOfPassword)) {
_tmpPassword = null;
} else {
_tmpPassword = _cursor.getString(_cursorIndexOfPassword);
}
final int _tmpAge;
_tmpAge = _cursor.getInt(_cursorIndexOfAge);
final String _tmpUtenteNumber;
if (_cursor.isNull(_cursorIndexOfUtenteNumber)) {
_tmpUtenteNumber = null;
} else {
_tmpUtenteNumber = _cursor.getString(_cursorIndexOfUtenteNumber);
}
_result = new User(_tmpName,_tmpEmail,_tmpPassword,_tmpAge,_tmpUtenteNumber);
_result.uid = _cursor.getInt(_cursorIndexOfUid);
if (_cursor.isNull(_cursorIndexOfProfilePictureUri)) {
_result.profilePictureUri = null;
} else {
_result.profilePictureUri = _cursor.getString(_cursorIndexOfProfilePictureUri);
}
} else {
_result = null;
}
return _result;
} finally {
_cursor.close();
_statement.release();
}
}
@NonNull
public static List<Class<?>> getRequiredConverters() {
return Collections.emptyList();
}
}