" VALUES(" + self.values + ")"
self.cursor.execute(insert_query)
self.conn.commit()
+ self.cursor.execute("SELECT * FROM swarms ORDER BY id DESC LIMIT 1")
+ row = self.cursor.fetchone()
+ return row[0]
def add_client_session(self, session):
"""Insert session in database. session type is Session."""
" VALUES(" + self.values + ")"
self.cursor.execute(insert_query)
self.conn.commit()
+ self.cursor.execute("SELECT * FROM client_sessions "
+ "ORDER BY id DESC LIMIT 1")
+ row = self.cursor.fetchone()
+ return row[0]
def get_string_timestamp(self, ts):
# Timestamp is Python Datatime. Convert it to string format and
" VALUES(" + self.values + ")"
self.cursor.execute(insert_query)
self.conn.commit()
+ self.cursor.execute("SELECT * FROM swarms ORDER BY id DESC LIMIT 1")
+ row = self.cursor.fetchone()
+ return row[0]
def add_client_session(self, session):
"""Insert session in database. session type is Session."""
" VALUES(" + self.values + ")"
self.cursor.execute(insert_query)
self.conn.commit()
+ self.cursor.execute("SELECT * FROM client_sessions "
+ "ORDER BY id DESC LIMIT 1")
+ row = self.cursor.fetchone()
+ return row[0]
def get_string_timestamp(self, ts):
# Timestamp is Python Datatime. Convert it to string format.
def add_swarm(self, swarm):
for h in self.handlers:
- h.add_swarm(swarm)
+ swarm_id = h.add_swarm(swarm)
+ return swarm_id
def add_client_session(self, session):
for h in self.handlers:
- h.add_client_session(session)
+ session_id = h.add_client_session(session)
+ return session_id
def add_peer_status_message(self, msg):
for h in self.handlers: