Converts a list of MyDBRow into a parameters.Parameters object

    This facilitates transfering data from SQLite table row to a XParameterEditor window

    See also: get_table_info()

def table_info_to_parameters(table_info):
    """
    Converts a list of MyDBRow into a parameters.Parameters object

    This facilitates transfering data from SQLite table row to a XParameterEditor window

    See also: get_table_info()
    """

    # Example of item in table_info:
    #   MyDBRow([('cid', 0), ('name', 'id'), ('type', 'integer'), ('notnull', 0), ('dflt_value', None), ('pk', 1)])

    opbj = a99.Parameters()
    for field_info in table_info.values():
        p = a99.Parameter()
        if field_info.type == "integer":
            p.type = int
        elif field_info.type == "real":
            p.type = float
        else:
            p.type = str

        p.name = field_info.name
        if field_info.dflt_value is not None:
            p.value = field_info.dflt_value
        opbj.params.append(p)
    return opbj