개정판 c5410c70
issue #1171: open fast with db data and xml both
Change-Id: I1cf7dcf92b2ffa843c222830707a205308cece93
DTI_PID/DTI_PID/AppDocData.py | ||
---|---|---|
90 | 90 |
self._symbolType = {} |
91 | 91 |
self._lineNoPropertiesUID = {} |
92 | 92 |
|
93 |
self._connecterss = {} |
|
94 |
self._associationss = {} |
|
95 |
self._attributess = {} |
|
96 |
|
|
97 |
def clearTempDBData(self): |
|
98 |
self._connecterss = {} |
|
99 |
self._associationss = {} |
|
100 |
self._attributess = {} |
|
101 |
|
|
93 | 102 |
def clearItemList(self, trim): |
94 | 103 |
''' |
95 | 104 |
@brief clear item list |
... | ... | |
139 | 148 |
self._symbolType = {} |
140 | 149 |
self._lineNoPropertiesUID = {} |
141 | 150 |
|
151 |
self._connecterss = {} |
|
152 |
self._associationss = {} |
|
153 |
self._attributess = {} |
|
154 |
|
|
142 | 155 |
''' |
143 | 156 |
@brief Get drawing file list |
144 | 157 |
@author euisung |
... | ... | |
2057 | 2070 |
|
2058 | 2071 |
def get_component_connectors(self, component): |
2059 | 2072 |
""" get connectors of given component """ |
2073 |
if self._connecterss and component in self._connecterss: |
|
2074 |
return self._connecterss[component] |
|
2075 |
elif self._connecterss: |
|
2076 |
return [] |
|
2077 |
|
|
2060 | 2078 |
conn = self.project.database.connect() |
2061 | 2079 |
with conn: |
2062 | 2080 |
try: |
2063 | 2081 |
# Get a cursor object |
2064 | 2082 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
2065 | 2083 |
|
2066 |
sql = "select * from Points where Components_UID='{}' order by [Index]".format(component) |
|
2084 |
#sql = "select * from Points where Components_UID='{}' order by [Index]".format(component) |
|
2085 |
sql = "select * from Points order by Components_UID, [Index]".format(component) |
|
2067 | 2086 |
cursor.execute(sql) |
2068 |
return cursor.fetchall() |
|
2087 |
|
|
2088 |
pre = '' |
|
2089 |
rows = cursor.fetchall() |
|
2090 |
for row in rows: |
|
2091 |
if pre != row['Components_UID']: |
|
2092 |
if pre != '': |
|
2093 |
self._connecterss[pre] = compo |
|
2094 |
pre = row['Components_UID'] |
|
2095 |
compo = [] |
|
2096 |
compo.append(row) |
|
2097 |
else: |
|
2098 |
compo.append(row) |
|
2099 |
|
|
2100 |
return self._connecterss[component] if component in self._connecterss else [] |
|
2069 | 2101 |
# Catch the exception |
2070 | 2102 |
except Exception as ex: |
2071 | 2103 |
from App import App |
... | ... | |
2074 | 2106 |
|
2075 | 2107 |
def get_component_associations(self, component): |
2076 | 2108 |
""" get associations of given component """ |
2109 |
if self._associationss and component in self._associationss: |
|
2110 |
return self._associationss[component] |
|
2111 |
elif self._associationss: |
|
2112 |
return [] |
|
2113 |
|
|
2077 | 2114 |
conn = self.project.database.connect() |
2078 | 2115 |
with conn: |
2079 | 2116 |
try: |
2080 | 2117 |
# Get a cursor object |
2081 | 2118 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
2082 | 2119 |
|
2083 |
sql = "select * from Associations where Components_UID='{}'".format(component) |
|
2120 |
#sql = "select * from Associations where Components_UID='{}'".format(component) |
|
2121 |
sql = "select * from Associations order by Components_UID" |
|
2084 | 2122 |
cursor.execute(sql) |
2085 |
return cursor.fetchall() |
|
2123 |
|
|
2124 |
pre = '' |
|
2125 |
rows = cursor.fetchall() |
|
2126 |
for row in rows: |
|
2127 |
if pre != row['Components_UID']: |
|
2128 |
if pre != '': |
|
2129 |
self._associationss[pre] = compo |
|
2130 |
pre = row['Components_UID'] |
|
2131 |
compo = [] |
|
2132 |
compo.append(row) |
|
2133 |
else: |
|
2134 |
compo.append(row) |
|
2135 |
|
|
2136 |
return self._associationss[component] if component in self._associationss else [] |
|
2086 | 2137 |
# Catch the exception |
2087 | 2138 |
except Exception as ex: |
2088 | 2139 |
from App import App |
... | ... | |
2091 | 2142 |
|
2092 | 2143 |
def get_component_attributes(self, component): |
2093 | 2144 |
""" get attributes of given component """ |
2145 |
if self._attributess and component in self._attributess: |
|
2146 |
return self._attributess[component] |
|
2147 |
elif self._attributess: |
|
2148 |
return [] |
|
2149 |
|
|
2094 | 2150 |
conn = self.project.database.connect() |
2095 | 2151 |
with conn: |
2096 | 2152 |
try: |
2097 | 2153 |
# Get a cursor object |
2098 | 2154 |
cursor = conn.cursor() if self.project.database.db_type == 'SQLite' else conn.cursor(as_dict=True) |
2099 | 2155 |
|
2156 |
#sql = "select * from [Attributes] a \ |
|
2157 |
# join SymbolAttribute b on a.SymbolAttribute_UID=b.UID where a.Components_UID='{}' order by a.Components_UID,b.[index]".format(component) |
|
2100 | 2158 |
sql = "select * from [Attributes] a \ |
2101 |
join SymbolAttribute b on a.SymbolAttribute_UID=b.UID where a.Components_UID='{}' order by a.Components_UID,b.[index]".format(component)
|
|
2159 |
join SymbolAttribute b on a.SymbolAttribute_UID=b.UID order by a.Components_UID, b.[index]"
|
|
2102 | 2160 |
cursor.execute(sql) |
2103 |
return cursor.fetchall() |
|
2161 |
|
|
2162 |
pre = '' |
|
2163 |
rows = cursor.fetchall() |
|
2164 |
for row in rows: |
|
2165 |
if pre != row['Components_UID']: |
|
2166 |
if pre != '': |
|
2167 |
self._attributess[pre] = compo |
|
2168 |
pre = row['Components_UID'] |
|
2169 |
compo = [] |
|
2170 |
compo.append(row) |
|
2171 |
else: |
|
2172 |
compo.append(row) |
|
2173 |
|
|
2174 |
return self._attributess[component] if component in self._attributess else [] |
|
2104 | 2175 |
# Catch the exception |
2105 | 2176 |
except Exception as ex: |
2106 | 2177 |
from App import App |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
2546 | 2546 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
2547 | 2547 |
self.addMessage.emit(MessageType.Error, message) |
2548 | 2548 |
finally: |
2549 |
pass
|
|
2549 |
app_doc_data.clearTempDBData
|
|
2550 | 2550 |
#self.graphicsView.scene.blockSignals(False) |
2551 | 2551 |
|
2552 | 2552 |
''' |
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
4105 | 4105 |
); |
4106 | 4106 |
|
4107 | 4107 |
CREATE TABLE OPCRelations ( |
4108 |
From_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID),
|
|
4108 |
From_Drawings_UID VARCHAR (37), |
|
4109 | 4109 |
From_LineNo_UID VARCHAR (37), |
4110 |
From_OPC_UID VARCHAR (37) REFERENCES Components (UID) PRIMARY KEY,
|
|
4111 |
To_Drawings_UID VARCHAR (37) REFERENCES Drawings (UID),
|
|
4110 |
From_OPC_UID VARCHAR (37) PRIMARY KEY, |
|
4111 |
To_Drawings_UID VARCHAR (37), |
|
4112 | 4112 |
To_LineNo_UID VARCHAR (37), |
4113 |
To_OPC_UID VARCHAR (37) REFERENCES Components (UID)
|
|
4113 |
To_OPC_UID VARCHAR (37) |
|
4114 | 4114 |
); |
4115 | 4115 |
|
4116 | 4116 |
CREATE TABLE PipeRuns ( |
내보내기 Unified diff