Changeset 876 for trunk/Monitoring/smon/local_repo.py
- Timestamp:
- 06/12/13 11:14:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Monitoring/smon/local_repo.py
r875 r876 59 59 _conn.execute("create unique index if not exists idx_simulation_1 on simulation (name)") 60 60 61 _conn.execute("create table if not exists message (id INTEGER PRIMARY KEY, simulation_id TEXT )") # TODO: check how to use INT datatype for simulation_id column61 _conn.execute("create table if not exists message (id INTEGER PRIMARY KEY, simulation_id TEXT, body TEXT, crea_date TEXT)") # TODO: check how to use INT datatype for simulation_id column 62 62 63 63 def cleanup(): … … 84 84 rs=c.fetchone() 85 85 while rs is not None: 86 li.append(types.Simulation(name=rs[0],id=rs[1],status=rs[2])) 86 87 s=types.Simulation(name=rs[0],id=rs[1],status=rs[2]) 88 89 li.append(s) 90 91 87 92 rs=c.fetchone() 88 93 … … 136 141 137 142 def create_message(message): 138 _conn.execute("insert into message (simulation_id) values (?)",(message.simuid,)) 143 144 _conn.execute("insert into message (simulation_id,crea_date) values (?,?)",(message.simuid, message.timestamp)) 139 145 140 146 _conn.commit() … … 143 149 c=_conn.cursor() 144 150 145 _conn.execute("select id, content from message where simulation_id=? order by iddesc limit 1",(simulation.id,))151 _conn.execute("select id, simulation_id, body, crea_date from message where simulation_id=? order by crea_date desc limit 1",(simulation.id,)) 146 152 147 153 rs=c.fetchone() 148 154 149 155 if rs is None: 150 raise Exception()156 raise types.MessageNotFoundException() 151 157 152 return types.Message(id=rs[0] )158 return types.Message(id=rs[0],simulation_id=rs[1],body=rs[2],timestamp=rs[3])
Note: See TracChangeset
for help on using the changeset viewer.