parts of class sqlite's implementation

This commit is contained in:
ChessNineeee committed 2021-04-01 22:53:58 +08:00
1 parent 8abc77eb6b
commit ee437ff924
2 files changed
+43 -3

No files matched your search

@@ -7,10 +7,48 @@ package minsecurity.identity.persist.sqlite;
* @Date: 22:34 2021/04/01
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
// 存在配置信息,使用单例模式封装工具类
public class Sqlite {
private static final Sqlite Instance = new Sqlite(); // sqlite 唯一object
private String passwd = "2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99"; // 初始数据库密码
private String db_file = "identity.db"; // 数据库文件名
private Sqlite(){
public static String home(){
return "";
}
/**
* 获取Sqlite object
* @return Sqlite object
*/
public static Sqlite getInstance() {
return Instance;
}
/**
* 设置数据库的连接密码
* @param pass 新密码
* @throws Exception
*/
public void setPasswd(String pass) throws Exception {
if (pass.length() != 64){
throw new Exception("Invalid Length");
}
passwd = pass;
}
public void open(String filePath){
try{
boolean db_exists = SqliteUtil.pathExists(filePath);
if (!db_exists){
}
String real_db_file = filePath + db_file;
}catch (Exception ex){
// TODO 出错时关闭数据库
}
}
}
@@ -9,6 +9,8 @@ import java.io.File;
* @Date: 10:34 2021/03/10
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
// 无配置信息,采用静态类
public final class SqliteUtil {
// Home returns the home directory for the executing user.
//