개정판 e2420413
issue #641: 신규 도면이 데이타베이스에 저장되지 않는 현상 수정
Change-Id: Id9db5464ade5fb2991189ca57cbcf185e107d4e8
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
3468 | 3468 |
cursor.execute('begin') |
3469 | 3469 |
|
3470 | 3470 |
for drawing in drawings: |
3471 |
image_blob_data = None |
|
3472 |
file_path = os.path.join(self.project.getDrawingFilePath(), drawing.name) |
|
3473 |
if drawing.name and os.path.isfile(file_path): |
|
3474 |
with open(file_path.encode('utf-8'), 'rb') as file: |
|
3475 |
image_blob_data = file.read() |
|
3476 |
|
|
3477 | 3471 |
if drawing.UID is None: |
3472 |
# get image data |
|
3473 |
image_blob_data = None |
|
3474 |
file_path = os.path.join(self.project.getDrawingFilePath(), drawing.name) |
|
3475 |
if drawing.name and os.path.isfile(file_path): |
|
3476 |
with open(file_path.encode('utf-8'), 'rb') as file: |
|
3477 |
image_blob_data = file.read() |
|
3478 |
# up to here |
|
3479 |
|
|
3478 | 3480 |
sql = self.project.database.to_sql( |
3479 |
'insert into Drawings(UID, [NAME], [DATETIME], Image) values(?, ?, ?, ?)')
|
|
3480 |
param = tuple([str(uuid.uuid4()), drawing.name, '', None])
|
|
3481 |
#param = tuple([str(uuid.uuid4()), drawing.name, '', image_blob_data])
|
|
3481 |
'insert into Drawings(UID, [NAME], [DATETIME], [Image]) values(?, ?, ?, ?)')
|
|
3482 |
param = tuple([str(uuid.uuid4()), drawing.name, '', image_blob_data])
|
|
3483 |
drawing.UID = param[0]
|
|
3482 | 3484 |
else: |
3483 | 3485 |
sql = self.project.database.to_sql("update Drawings set [NAME]=?,[DATETIME]=? where UID=?") |
3484 | 3486 |
param = (drawing.name, drawing.datetime, str(drawing.UID)) |
내보내기 Unified diff