Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
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 kwargs.items():
        params[k] = [v] * linecount

    cursor.executemany(**params)