개정판 3926c898
Symbol.getPath() 관련 제거 및 기존 DB를 테스트를 위해 이름 변경후 프로젝트 폴더에 이동
DTI_PID/DTI_PID/SG_DbHelper.py | ||
---|---|---|
9 | 9 |
ROOT_DIR = "" |
10 | 10 |
DB_PATH = "db" |
11 | 11 |
DB_NAME = "ITI_PID.db" |
12 |
|
|
12 |
|
|
13 | 13 |
CREATE_SYMBOLS_TABLE_SQL = ''' |
14 | 14 |
CREATE TABLE 'Symbol' ( |
15 | 15 |
'uid' INTEGER PRIMARY KEY AUTOINCREMENT, |
16 | 16 |
'symId' INTEGER NOT NULL, |
17 | 17 |
'name' TEXT NOT NULL, |
18 | 18 |
'type' TEXT, |
19 |
'path' TEXT, |
|
20 | 19 |
'threshold' NUMERIC NOT NULL DEFAULT 0.4, |
21 | 20 |
'minMatchPoint' INTEGER NOT NULL DEFAULT 0, |
22 | 21 |
'isDetectOrigin' INTEGER NOT NULL DEFAULT 0, |
... | ... | |
29 | 28 |
'additionalSymbol' TEXT |
30 | 29 |
); |
31 | 30 |
''' |
32 |
|
|
31 |
#CREATE_SYMBOLS_TABLE_SQL = ''' |
|
32 |
# CREATE TABLE 'Symbol' ( |
|
33 |
# 'uid' INTEGER PRIMARY KEY AUTOINCREMENT, |
|
34 |
# 'symId' INTEGER NOT NULL, |
|
35 |
# 'name' TEXT NOT NULL, |
|
36 |
# 'type' TEXT, |
|
37 |
# 'path' TEXT, |
|
38 |
# 'threshold' NUMERIC NOT NULL DEFAULT 0.4, |
|
39 |
# 'minMatchPoint' INTEGER NOT NULL DEFAULT 0, |
|
40 |
# 'isDetectOrigin' INTEGER NOT NULL DEFAULT 0, |
|
41 |
# 'rotationCount' INTEGER NOT NULL DEFAULT 4, |
|
42 |
# 'ocrOption' INTEGER NOT NULL DEFAULT 0, |
|
43 |
# 'isContainChild' INTEGER NOT NULL DEFAULT 0, |
|
44 |
# 'originalPoint' TEXT, |
|
45 |
# 'connectionPoint' TEXT, |
|
46 |
# 'baseSymbol' TEXT, |
|
47 |
# 'additionalSymbol' TEXT |
|
48 |
# ); |
|
49 |
#''' |
|
50 |
|
|
33 | 51 |
INSERT_SYMBOL_SQL = ''' |
34 |
INSERT INTO Symbol(symId, name, type, path, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol)
|
|
35 |
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
|
52 |
INSERT INTO Symbol(symId, name, type, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol) |
|
53 |
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); |
|
36 | 54 |
''' |
37 |
|
|
55 |
#INSERT_SYMBOL_SQL = ''' |
|
56 |
# INSERT INTO Symbol(symId, name, type, path, threshold, minMatchPoint, isDetectOrigin, rotationCount, ocrOption, isContainChild, originalPoint, connectionPoint, baseSymbol, additionalSymbol) |
|
57 |
# VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); |
|
58 |
#''' |
|
59 |
|
|
38 | 60 |
UPDATE_SYMBOL_SQL = ''' |
39 | 61 |
UPDATE Symbol |
40 | 62 |
SET |
41 |
symId = ?, name = ?, type = ?, path = ?, threshold = ?, minMatchPoint = ?, isDetectOrigin = ?,
|
|
63 |
symId = ?, name = ?, type = ?, threshold = ?, minMatchPoint = ?, isDetectOrigin = ?, |
|
42 | 64 |
rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?, |
43 | 65 |
baseSymbol = ?, additionalSymbol = ? |
44 | 66 |
WHERE uid = ? |
45 | 67 |
''' |
68 |
#UPDATE_SYMBOL_SQL = ''' |
|
69 |
# UPDATE Symbol |
|
70 |
# SET |
|
71 |
# symId = ?, name = ?, type = ?, path = ?, threshold = ?, minMatchPoint = ?, isDetectOrigin = ?, |
|
72 |
# rotationCount = ?, ocrOption = ?, isContainChild = ?, originalPoint = ?, connectionPoint = ?, |
|
73 |
# baseSymbol = ?, additionalSymbol = ? |
|
74 |
# WHERE uid = ? |
|
75 |
#''' |
|
46 | 76 |
|
47 | 77 |
def __init__(self, rootDir): |
48 | 78 |
print("DB Helper __init__") |
... | ... | |
107 | 137 |
conn = sqlite3.connect(self.dbFullPath) |
108 | 138 |
|
109 | 139 |
cursor = conn.cursor() |
110 |
query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getPath(), symbol.getThreshold()
|
|
140 |
query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getThreshold() |
|
111 | 141 |
, symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
112 | 142 |
, symbol.getOcrOption(), symbol.getIsContainChild() |
113 | 143 |
, symbol.getOriginalPoint(), symbol.getConnectionPoint() |
114 | 144 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol()) |
145 |
#query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getPath(), symbol.getThreshold() |
|
146 |
# , symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
|
147 |
# , symbol.getOcrOption(), symbol.getIsContainChild() |
|
148 |
# , symbol.getOriginalPoint(), symbol.getConnectionPoint() |
|
149 |
# , symbol.getBaseSymbol(), symbol.getAdditionalSymbol()) |
|
115 | 150 |
cursor.execute(self.INSERT_SYMBOL_SQL, query) |
116 | 151 |
conn.commit() |
117 | 152 |
isAdded = True |
... | ... | |
127 | 162 |
conn = sqlite3.connect(self.dbFullPath) |
128 | 163 |
|
129 | 164 |
cursor = conn.cursor() |
130 |
query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getPath(), symbol.getThreshold()
|
|
165 |
query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getThreshold() |
|
131 | 166 |
, symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
132 | 167 |
, symbol.getOcrOption(), symbol.getIsContainChild() |
133 | 168 |
, symbol.getOriginalPoint(), symbol.getConnectionPoint() |
134 | 169 |
, symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getUid()) |
170 |
#query = (symbol.getId(), symbol.getName(), symbol.getType(), symbol.getPath(), symbol.getThreshold() |
|
171 |
# , symbol.getMinMatchCount(), symbol.getIsDetectOnOrigin(), symbol.getRotationCount() |
|
172 |
# , symbol.getOcrOption(), symbol.getIsContainChild() |
|
173 |
# , symbol.getOriginalPoint(), symbol.getConnectionPoint() |
|
174 |
# , symbol.getBaseSymbol(), symbol.getAdditionalSymbol(), symbol.getUid()) |
|
135 | 175 |
cursor.execute(self.UPDATE_SYMBOL_SQL, query) |
136 | 176 |
conn.commit() |
137 | 177 |
isUpdated = True |
내보내기 Unified diff