119 def ReadTagAndNodeVersionsFromDB(self):
120 """ Read tag and node versions defined for the geometry tag """
121
122
123
124 bStopLoop=False
125 tagDictGbl={}
126
127
128 if self.dbGeoTagId=="":
129 Logging.log.error("The geometry tag %s could not be found in the database.", self.dbGeoTag)
130 Logging.log.error("Its name might be misspelled and/or the script might access a local DB that is not up to date.")
131 import sys
132 sys.exit()
133
134
135 tagIdList=[int(self.dbGeoTagId)]
136
137
138 while not bStopLoop :
139
140 query0 = self.dbSchema.newQuery()
141
142 query0.addToOutputList('C.NODE_NAME',"nodename")
143 query0.addToOutputList('A.TAG_NAME',"tagname")
144 query0.addToOutputList('A.TAG_ID',"tagid")
145
146 query0.addToTableList( "HVS_TAG2NODE","A" )
147 query0.addToTableList( "HVS_LTAG2LTAG","B")
148 query0.addToTableList( "HVS_NODE","C" )
149
150 bindstag2node = coral.AttributeList()
151 condString=
"C.NODE_ID=A.NODE_ID AND A.TAG_ID=B.CHILD_TAG and B.PARENT_TAG IN (%s)" %
str(tagIdList)[1:-1]
152 Logging.log.verbose("----------------------------\n"+condString)
153 query0.setCondition(condString,bindstag2node)
154
155
156 dictRes,paramType=self.AnalyseDBRequestOutput_Query(query0,"nodename")
157 tagDictGbl.update(dictRes)
158 del query0
159
160 if len(dictRes.keys())==0:
161
162 bStopLoop=True
163 else:
164
165 tagIdList=[int(dictRes[k][1]) for k in dictRes.keys()]
166
167
168 self.TagAndNodeVersionDict.update(tagDictGbl)
169
170