def save_db_indoor(Indoor): with app.app_context(): db = get_db() db.execute( 'INSERT INTO indoor(node_number,update_time,temperature,humidity,radiation,co2) VALUES(?,?,?,?,?,?)', [ Indoor.get_name(), Indoor.get_update_time(), Indoor.get_temperature(), Indoor.get_humidity(), Indoor.get_radiation(), Indoor.get_co2() ]) db.commit() db.close() print 'indoor save success'
def save_db_indoor(Indoor): with app.app_context(): db = get_db() indoor_node = "indoor_node_" + Indoor.get_name() db.cursor().execute( 'insert into ' + indoor_node + '(node,update_time,temperature,humidity,radiation,co2) values(%s,%s,%s,%s,%s,%s)', [ Indoor.get_name(), get_current_time(), Indoor.get_temperature(), Indoor.get_humidity(), Indoor.get_radiation(), Indoor.get_co2() ]) db.commit() db.cursor().close() db.close() print 'indoor save success'
def save_db_indoor(Indoor): with app.app_context(): db = get_db() db.execute('INSERT INTO indoor(node_number,update_time,temperature,humidity,radiation,co2) VALUES(?,?,?,?,?,?)', [Indoor.get_name(), Indoor.get_update_time(), Indoor.get_temperature(), Indoor.get_humidity(), Indoor.get_radiation(), Indoor.get_co2()]) db.commit() db.close() print 'indoor save success'