Android 我想在sqlite数据库中安全地更新用户名和密码
我尝试过使用SQLCipher等,但仍然能够破解我的数据库。我想安全地插入、更新。任何帮助或建议都会更好。谢谢 请检查我为insert编写的代码,并更新其正常数据库代码。我想保护相同的结构代码Android 我想在sqlite数据库中安全地更新用户名和密码,android,Android,我尝试过使用SQLCipher等,但仍然能够破解我的数据库。我想安全地插入、更新。任何帮助或建议都会更好。谢谢 请检查我为insert编写的代码,并更新其正常数据库代码。我想保护相同的结构代码 public class SqlDatabaseAdapter { SqlHelper helper; public SqlDatabaseAdapter(Context context) { he
public class SqlDatabaseAdapter {
SqlHelper helper;
public SqlDatabaseAdapter(Context context)
{
helper=new SqlHelper(context);
}
public long insertData(String email,String password)
{
SQLiteDatabase db=helper.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(SqlHelper.NAME,email);
cv.put(SqlHelper.PASSWORD,password);
long id=db.insert(SqlHelper.TABLE_NAME,null,cv);
return id;
}
public int updateData(String oldName,String newName)
{
SQLiteDatabase db=helper.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(SqlHelper.NAME, newName);
int upade=db.update(SqlHelper.TABLE_NAME,cv,SqlHelper.NAME+"=?",new String[]{oldName});
return upade;
}
}
…后面的答案甚至不接近编译,但被接受。请显示数据库结构、示例输入和所需结果。即尽可能接近a。SQLite命令行工具提供了一种方便的方法,只需在适当定制的toy数据库上使用.dump即可。另外,如果您声明是否可以直接从该toydatabase上的命令行工具实现目标,这也会很有帮助。
public int updateData(String oldName,String newName)
{
ContentValues values = new ContentValues();
values.put(SqlHelper.UID, ID);
values.put(SqlHelper.NAME,email);
values.put(SqlHelper.PWD,pwd);
// updating row
db.updae(TABLE_NAME, values, KEY_ID + " = ?",
new String[] { String.valueOf(user.getId()) });
return upade;
}
public static boolean updateEntry(Student st)
{
db=dbhelper.getWritableDatabase();
// Define the updated row content.
ContentValues updatedValues = new ContentValues();
// Assign values for each row.
updatedValues.put(USER_EMAILID, st.getEmailid());
updatedValues.put(USER_NAME,st.getName());
updatedValues.put(USER_CONTACT, st.getMobileno());
//String where=Database.USER_EMAILID +"=+?";
//String where="emailid +=?";
int row_id=db.update(Database.TABLE_NAME,updatedValues, "emailid=?", new String[]{st.getEmailid()});
Log.d("login", "updated record " +row_id);
return true;
}