Sha256: d9467b52da4c5b9dc64169f0ddd3cbf621ad1885470caa1e496f49f05b0603ee

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

grammar SQLSelect
  include SQLRowSupport

  include SQLSelectClause
  include SQLFromClause
  include SQLWhereCondition
  include SQLOrderByClause
  include SQLLimit
  include SQLHelpers

  rule select_expression
    select
    from_or_empty
    where_tree
    limit_condition_or_empty
    order_by_condition_or_empty
    {      
      def query_type
        :select
      end
      
      def tree
        result = {}
        
        selectables = select.eval
        
        result[:limit] = limit_condition_or_empty.eval unless limit_condition_or_empty.eval.nil?
        result[:order_by] = order_by_condition_or_empty.eval unless order_by_condition_or_empty.eval.nil?
        result[:from] = from_or_empty.tables if defined? from_or_empty.tables
        result[:where] = where_tree.eval unless where_tree.eval.nil?
        result[:columns] = selectables[:columns] unless selectables[:columns].nil?
        result[:numbers] = selectables[:numbers] unless selectables[:numbers].nil?
        result[:aliases] = selectables[:aliases] unless selectables[:aliases].nil?
        
        result
      end
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hipster_sql_to_hbase-0.2.2 lib/sql_parser/sql_select.treetop