group and having clause init

This commit is contained in:
Denis Knauf 2011-10-06 13:27:41 +02:00
parent cc49fdefe9
commit 11466211ac
3 changed files with 73 additions and 1 deletions

View file

@ -43,6 +43,7 @@ class SmqlToAR
@table_alias[ @base_table] = @base_table.first
t = quote_table_name @table_alias[ @base_table]
@_select, @_joins, @_joined, @_includes, @_order = ["DISTINCT #{t}.*"], "", [@base_table], [], []
@_group, @_having = {}, {}
@table_model = {@base_table => @model}
end
@ -66,6 +67,14 @@ class SmqlToAR
self
end
def group col
@_group.push col
end
def having h
@_having.update h
end
def quote_column_name name
@quoter.quote_column_name( name).gsub /"\."/, ','
end