개정판 d3ffdbec
db connection
Change-Id: I30517692d5a73ad255d523a0f30443509f3b540e
DTI_PID/DTI_PID/AppDatabase.py | ||
---|---|---|
3 | 3 |
|
4 | 4 |
import sqlite3 |
5 | 5 |
import pymssql |
6 |
#import traceback |
|
7 | 6 |
|
8 | 7 |
|
9 | 8 |
class AppDatabase: |
... | ... | |
82 | 81 |
|
83 | 82 |
def connect(self): |
84 | 83 |
""" return database connection depends on database type """ |
84 |
#import traceback |
|
85 |
|
|
85 | 86 |
conn = None |
86 | 87 |
if self._DBType == 'SQLite': |
87 | 88 |
conn = sqlite3.connect(self.file_path, isolation_level=None) |
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
106 | 106 |
# caches |
107 | 107 |
self._configs = None |
108 | 108 |
self._symbolBase = {} |
109 |
self._symbolType = {} |
|
110 | 109 |
self._lineNoPropertiesUID = {} |
111 | 110 |
self._attributeByType = {} |
112 | 111 |
self._connected_items_lists = None |
113 | 112 |
|
113 |
# caches not need to be clear |
|
114 |
self._symbolType = {} |
|
115 |
self._symbolNametList = {} |
|
116 |
|
|
114 | 117 |
# for load drawing data from database |
115 | 118 |
self._connecterss = {} |
116 | 119 |
self._associationss = {} |
... | ... | |
181 | 184 |
|
182 | 185 |
self._configs = None# if not past else self._configs |
183 | 186 |
self._symbolBase = {}# if not past else self._symbolBase |
184 |
self._symbolType = {}# if not past else self._symbolType |
|
185 | 187 |
self._lineNoPropertiesUID = {} |
186 | 188 |
self._attributeByType = {} |
187 | 189 |
self._connected_items_lists = QEngineeringInstLineNoTextItem() |
... | ... | |
1675 | 1677 |
''' |
1676 | 1678 |
def getSymbolNameListByType(self, type): |
1677 | 1679 |
symbolNametList = [] |
1680 |
if type in self._symbolNametList: |
|
1681 |
return self._symbolNametList[type] |
|
1678 | 1682 |
|
1679 | 1683 |
conn = self.project.database.connect() |
1680 | 1684 |
with conn: |
... | ... | |
1687 | 1691 |
rows = cursor.fetchall() |
1688 | 1692 |
for row in rows: |
1689 | 1693 |
symbolNametList.append(row['Name']) # Name String |
1694 |
self._symbolNametList[type] = symbolNametList |
|
1690 | 1695 |
except Exception as ex: |
1691 | 1696 |
print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1692 | 1697 |
sys.exc_info()[-1].tb_lineno)) |
... | ... | |
4393 | 4398 |
|
4394 | 4399 |
import uuid |
4395 | 4400 |
|
4401 |
if not drawings: |
|
4402 |
return |
|
4403 |
|
|
4396 | 4404 |
with self.project.database.connect() as conn: |
4397 | 4405 |
try: |
4398 | 4406 |
# Get a cursor object |
내보내기 Unified diff