def save_db_outdoor(Outdoor): with app.app_context(): db = get_db() db.execute('INSERT INTO outdoor(update_time,temperature,humidity,radiation,co2,wind_direction,wind_speed,rain_snow,atmosphere)\ VALUES(?,?,?,?,?,?,?,?,?)', [Outdoor.get_update_time(), Outdoor.get_temperature(), Outdoor.get_humidity(), Outdoor.get_radiation(), Outdoor.get_co_2(), Outdoor.get_wind_direction(), \ Outdoor.get_wind_speed(), Outdoor.get_rain(), Outdoor.get_atmosphere()]) db.commit() db.close() print 'outdoor save success'
def save_db_outdoor(Outdoor): with app.app_context(): db = get_db() db.execute('INSERT INTO outdoor(update_time,temperature,humidity,radiation,co2,wind_direction,wind_speed,rain_snow,atmosphere)\ VALUES(?,?,?,?,?,?,?,?,?)', [Outdoor.get_update_time(), Outdoor.get_temperature(), Outdoor.get_humidity(), Outdoor.get_radiation(), Outdoor.get_co_2(), Outdoor.get_wind_direction(), Outdoor.get_wind_speed(), Outdoor.get_rain(), Outdoor.get_atmosphere()]) db.commit() db.close() print 'outdoor save success'
def save_db_outdoor(Outdoor): with app.app_context(): db = get_db() db.cursor().execute( 'insert into outdoor(update_time,temperature,humidity,radiation,co2,wind_direction,wind_speed,rain_snow,atmosphere)\ values(%s,%s,%s,%s,%s,%s,%s,%s,%s)', [ Outdoor.get_update_time(), Outdoor.get_temperature(), Outdoor.get_humidity(), Outdoor.get_radiation(), Outdoor.get_co_2(), Outdoor.get_wind_direction(), Outdoor.get_wind_speed(), Outdoor.get_rain(), Outdoor.get_atmosphere() ]) db.commit() print 'outdoor save success'