def select_from_table(table=nil,columns=nil,condition=nil,params=nil)

    raise ArgumentError if !table || !columns
    query = nil
    vals = []

    if condition
        quests,vals = Database.make_where_params(condition,'AND')
        if params and params['distinct']
            query = "SELECT DISTINCT #{columns} FROM \"#{table}\" WHERE #{quests}"
        elsif params and params['order by']
            query = "SELECT #{columns} FROM \"#{table}\" WHERE #{quests} ORDER BY #{params['order by']}"
        else
            query = "SELECT #{columns} FROM \"#{table}\" WHERE #{quests}"
        end
    else
        query = "SELECT #{columns} FROM \"#{table}\""
    end

    execute_sql query, vals
  end
def select_from_table(table=nil,columns=nil,condition=nil,params=nil)

    raise ArgumentError if !table || !columns
    query = nil
    vals = []

    if condition
        quests,vals = Database.make_where_params(condition,'AND')
        if params and params['distinct']
            query = "SELECT DISTINCT #{columns} FROM \"#{table}\" WHERE #{quests}"
        elsif params and params['order by']
            query = "SELECT #{columns} FROM \"#{table}\" WHERE #{quests} ORDER BY #{params['order by']}"
        else
            query = "SELECT #{columns} FROM \"#{table}\" WHERE #{quests}"
        end
    else
        query = "SELECT #{columns} FROM \"#{table}\""
    end

    execute_sql query, vals
  end
self
 support for select statements
 this function takes table name, columns (as a comma-separated list),
 condition (as a hash), and params (as a hash)
 example usage is the following:
 select_from_table('object_values', '*', {"source_id"=>2,"update_type"=>'query'},
                   {"order by"=>'object'})
 this would return all columns where source_id = 2 and update_type = 'query' ordered
 by the "object" column