(tablename,data)
return result
写入数据库,并返回ID
写入数据库,并返回ID
写入数据库 并返回ID
def InsertIntoDBAndReturnID(tablename,data):
    """写入数据库,并返回ID
    """
    sql = forEachPlusInsertProps(tablename,data)
    conn = dbpool.connection(write=True,tablename=tablename)
    cursor = conn.cursor()
    cursor.execute(sql)
    conn.commit()
    cursor.execute("SELECT LAST_INSERT_ID();")
    result=cursor.fetchall()[0]
    cursor.close()
    conn.close()
    return result
def InsertIntoDBAndReturnID ( tablename , data ) : sql = forEachPlusInsertProps ( tablename , data ) conn = dbpool . connection ( write = True , tablename = tablename ) cursor = conn . cursor ( ) cursor . execute ( sql ) conn . commit ( ) cursor . execute ( "SELECT LAST_INSERT_ID();" ) result = cursor . fetchall ( ) [ 0 ] cursor . close ( ) conn . close ( ) return result