1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| package com.code2roc.fastface.util;
|
| import com.code2roc.fastface.db.CommonDTO;
| import org.springframework.beans.factory.annotation.Autowired;
| import org.springframework.stereotype.Component;
|
| @Component
| public class DataBaseUtil {
| @Autowired
| private CommonDTO commonDTO;
|
| public void init() {
| String ddlSQL = "";
| if (!checkTableExist("FaceRegist")) {
| ddlSQL = "CREATE TABLE FaceRegist (" +
| "ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," +
| "UserID TEXT ," +
| "UserName TEXT ," +
| "RegistDate TEXT," +
| "UpdateDate TEXT," +
| "RegistIndex TEXT," +
| "Base64Image TEXT," +
| "ExtendA TEXT," +
| "ExtendB TEXT," +
| "ExtendC TEXT," +
| "ExtendD TEXT)";
| commonDTO.executeSQL(ddlSQL, null);
| }
| }
|
| private boolean checkTableExist(String tableName) {
| boolean check = false;
| String checkSQL = "";
| checkSQL = "SELECT COUNT(*) FROM sqlite_master WHERE name ='" + tableName + "' and type='table'";
| check = ConvertOp.convert2Int(commonDTO.executeSQLToQuery(checkSQL, null)) > 0;
| return check;
| }
| }
|
|