db.py (1306:7908551ae2a8) | db.py (1309:7daf185ddae8) |
---|---|
1import MySQLdb, re, string 2 3def statcmp(a, b): 4 v1 = a.split('.') 5 v2 = b.split('.') 6 7 last = min(len(v1), len(v2)) - 1 8 for i,j in zip(v1[0:last], v2[0:last]): --- 193 unchanged lines hidden (view full) --- 202 print '%-40s %-10s %-5s' % ('run name', 'user', 'id') 203 print '-' * 62 204 for run in self.allRuns: 205 if user == None or user == run.user: 206 print '%-40s %-10s %-10d' % (run.name, run.user, run.run) 207 208 # Name: listTicks 209 # Desc: Prints all samples for a given run | 1import MySQLdb, re, string 2 3def statcmp(a, b): 4 v1 = a.split('.') 5 v2 = b.split('.') 6 7 last = min(len(v1), len(v2)) - 1 8 for i,j in zip(v1[0:last], v2[0:last]): --- 193 unchanged lines hidden (view full) --- 202 print '%-40s %-10s %-5s' % ('run name', 'user', 'id') 203 print '-' * 62 204 for run in self.allRuns: 205 if user == None or user == run.user: 206 print '%-40s %-10s %-10d' % (run.name, run.user, run.run) 207 208 # Name: listTicks 209 # Desc: Prints all samples for a given run |
210 def listTicks(self, run=None): | 210 def listTicks(self, runs=None): |
211 print "tick" 212 print "----------------------------------------" | 211 print "tick" 212 print "----------------------------------------" |
213 sql = 'select distinct dt_tick from data where dt_stat=1950' 214 #if run != None: 215 # sql += ' where dt_run=%d' % run | 213 sql = 'select distinct dt_tick from data where dt_stat=1180 and (' 214 if runs != None: 215 first = True 216 for run in runs: 217 if first: 218 # sql += ' where' 219 first = False 220 else: 221 sql += ' or' 222 sql += ' dt_run=%s' % run.run 223 sql += ')' |
216 self.query(sql) 217 for r in self.cursor.fetchall(): 218 print r[0] 219 | 224 self.query(sql) 225 for r in self.cursor.fetchall(): 226 print r[0] 227 |
228 # Name: retTicks 229 # Desc: Prints all samples for a given run 230 def retTicks(self, runs=None): 231 sql = 'select distinct dt_tick from data where dt_stat=1180 and (' 232 if runs != None: 233 first = True 234 for run in runs: 235 if first: 236 first = False 237 else: 238 sql += ' or' 239 sql += ' dt_run=%s' % run.run 240 sql += ')' 241 self.query(sql) 242 ret = [] 243 for r in self.cursor.fetchall(): 244 ret.append(r[0]) 245 return ret 246 |
|
220 # Name: liststats 221 # Desc: Prints all statistics that appear in the database, 222 # the optional argument is a regular expression that can 223 # be used to prune the result set 224 def listStats(self, regex=None): 225 print '%-60s %-8s %-10s' % ('stat name', 'id', 'type') 226 print '-' * 80 227 --- 188 unchanged lines hidden --- | 247 # Name: liststats 248 # Desc: Prints all statistics that appear in the database, 249 # the optional argument is a regular expression that can 250 # be used to prune the result set 251 def listStats(self, regex=None): 252 print '%-60s %-8s %-10s' % ('stat name', 'id', 'type') 253 print '-' * 80 254 --- 188 unchanged lines hidden --- |