171 def GetCurrentLeafContent(self, leafName):
172 """ Read a DB table content and return 3 lists :
173 - dbId : the data_id list corresponding to each entry in the table
174 - dbContent : the table values as a dictionary with keys corresponding to the dbId list
175 - paramName : the name of the table parameters """
176
177 upLeafName=leafName.upper()
178
179
180 if leafName not in self.TagAndNodeVersionDict:
181 dbId=[]
182 dbContent={}
183 paramName=[]
184 return dbId,dbContent,paramName
185
186
187
188 leafTagId=self.TagAndNodeVersionDict[leafName][1]
189
190 query = self.dbSchema.tableHandle(upLeafName+"_DATA2TAG").newQuery()
191 query.addToOutputList(upLeafName+'_DATA_ID')
192
193 bindstag2node = coral.AttributeList()
194 condString=upLeafName+'_TAG_ID='+str(leafTagId)
195 query.setCondition(condString,bindstag2node)
196
197 dictRes,typeList=self.AnalyseDBRequestOutput_Query(query)
198 dataIdList=[int(s[upLeafName+'_DATA_ID']) for s in dictRes]
199 del query
200
201
202
203 query = self.dbSchema.tableHandle(upLeafName+"_DATA").newQuery()
204
205 condString=upLeafName+'_DATA_ID IN ('+str(dataIdList)[1:-1]+") ORDER BY "+upLeafName+"_DATA_ID"
206 query.setCondition(condString,bindstag2node)
207
208 dictRes,typeList=self.AnalyseDBRequestOutput_Query(query)
209 del query
210
211
212
213
214
215
216 paramName=[s[0] for s in typeList]
217
218 paramKey=typeList[0][0]
219 dbId=[]
220 dbContent={}
221 for s in dictRes:
222 key=int(s[paramKey])
223 dbId.append(key)
224 v=[s[k[0]] for k in typeList]
225 dbContent[key]=v
226
227 return dbId,dbContent,paramName
228
229
230
231
232