개정판 a04c0210
issue #646: 심볼 라이브러리 불러오기(MSSQL 지원)
Change-Id: If662cc81304dc39ed200b2bf24daa24ed32ea570
DTI_PID/DTI_PID/DetectSymbolDialog.py | ||
---|---|---|
178 | 178 |
target_cursor.execute(f"delete from {table}") |
179 | 179 |
|
180 | 180 |
for table in tables: |
181 |
sql = f"select * from {table}" |
|
182 |
cursor.execute(sql) |
|
183 |
rows = cursor.fetchall() |
|
184 |
for row in rows: |
|
185 |
cols = ','.join(['?' for item in row]) |
|
186 |
sql = f"insert into {table} values({cols})" |
|
187 |
params = tuple(self.convert_to_params(row)) |
|
188 |
target_cursor.execute(sql, params) |
|
181 |
if app_doc_data.project.database.db_type == 'MSSQL' and table == 'Symbol': |
|
182 |
target_cursor.execute(f"SET IDENTITY_INSERT {table} ON") |
|
183 |
|
|
184 |
try: |
|
185 |
sql = f"select * from {table}" |
|
186 |
cursor.execute(sql) |
|
187 |
col_names = ','.join(list(map(lambda x: '[' + x[0] + ']', cursor.description))) |
|
188 |
rows = cursor.fetchall() |
|
189 |
for row in rows: |
|
190 |
cols = ','.join(['?' for item in row]) |
|
191 |
sql = app_doc_data.project.database.to_sql(f"insert into {table}({col_names}) values({cols})") |
|
192 |
params = tuple(self.convert_to_params(row)) |
|
193 |
target_cursor.execute(sql, params) |
|
194 |
finally: |
|
195 |
if app_doc_data.project.database.db_type == 'MSSQL' and table == 'Symbol': |
|
196 |
target_cursor.execute(f"SET IDENTITY_INSERT {table} OFF") |
|
189 | 197 |
|
190 | 198 |
if app_doc_data.project.database.db_type == 'SQLite': |
191 | 199 |
target_cursor.execute('commit') |
DTI_PID/DTI_PID/Scripts/ID2.sql | ||
---|---|---|
48 | 48 |
Width INTEGER, |
49 | 49 |
Height INTEGER, |
50 | 50 |
Flip INTEGER, |
51 |
Image VARCHAR(MAX),
|
|
52 |
Svg VARCHAR(MAX),
|
|
51 |
Image BLOB,
|
|
52 |
Svg BLOB,
|
|
53 | 53 |
FOREIGN KEY ( |
54 | 54 |
SymbolType_UID |
55 | 55 |
) |
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
1179 | 1179 |
Width INTEGER, |
1180 | 1180 |
Height INTEGER, |
1181 | 1181 |
Flip INTEGER, |
1182 |
Image VARBINARY(MAX),
|
|
1183 |
Svg VARBINARY(MAX),
|
|
1182 |
Image VARCHAR(MAX),
|
|
1183 |
Svg VARCHAR(MAX),
|
|
1184 | 1184 |
FOREIGN KEY ( |
1185 | 1185 |
SymbolType_UID |
1186 | 1186 |
) |
내보내기 Unified diff