コード例 #1
0
def __execute_many(cursor, array, col_names, **kwargs):
    linecount = len(array)
    if not linecount:
        return
    # Transpose the array into a hash with col_names as keys
    params = rhnLib.transpose_to_hash(array, col_names)
    for k, v in kwargs.items():
        params[k] = [ v ] * linecount

    apply(cursor.executemany, (), params)
コード例 #2
0
def __execute_many(cursor, array, col_names, **kwargs):
    """ Execute the cursor, with arguments extracted from the array
        The array is converted into a hash having col_names as keys, and adds
        whatever kwarg was specified too.
    """
    linecount = len(array)
    if not linecount:
        return
    # Transpose the array into a hash with col_names as keys
    params = rhnLib.transpose_to_hash(array, col_names)
    for k, v in list(kwargs.items()):
        params[k] = [v] * linecount

    cursor.executemany(**params)
コード例 #3
0
ファイル: server_kickstart.py プロジェクト: m47ik/uyuni
def __execute_many(cursor, array, col_names, **kwargs):
    """ Execute the cursor, with arguments extracted from the array
        The array is converted into a hash having col_names as keys, and adds
        whatever kwarg was specified too.
    """
    linecount = len(array)
    if not linecount:
        return
    # Transpose the array into a hash with col_names as keys
    params = rhnLib.transpose_to_hash(array, col_names)
    for k, v in kwargs.items():
        params[k] = [v] * linecount

    cursor.executemany(**params)