def db_delete(id): mysql_lib.connect() sql = "delete from source where id ={}".format(id) print(sql) data = mysql_lib.executeSQL(sql) mysql_lib.close() return data
def db_update(id, name): mysql_lib.connect() sql = "update source set name='{}' where id ={}".format(name, id) print(sql) data = mysql_lib.executeSQL(sql) mysql_lib.close() return data
def db_get_by_id(id): mysql_lib.connect() sql = "select * from source where id={}".format(id) print(sql) data = mysql_lib.select(sql) mysql_lib.close() return data
def db_insert(id, name, age, gender): mysql_lib.connect() insert_sql = "insert into source values('{}','{}','{}','{}')".format( id, name, age, gender) print(insert_sql) data = mysql_lib.executeSQL(insert_sql) mysql_lib.close() return data
def db_get_all(): mysql_lib.connect() sql = "select * from source" data = mysql_lib.select(sql) mysql_lib.close() return data