group and having clause init
This commit is contained in:
parent
cc49fdefe9
commit
11466211ac
3 changed files with 73 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue