Sha256: c58121cee1e8f7b2d0b95e71b54f44da1239bfa1cc59f7a99d6dc27b84cc72b8
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
grammar SQLUpdate include SQLRowSupport include SQLWhereCondition include SQLOrderByClause include SQLLimit include SQLHelpers rule update "UPDATE" SPACES (low_priority SPACES)? (ignore SPACES)? table_name SPACES "SET" SPACES col_val_pairs where_tree order_by_condition_or_empty limit_condition_or_empty { def query_type :update end def tree result = { :update => table_name.eval, :set => col_val_pairs.eval } where_tree_val = where_tree.eval result[:where] = where_tree_val unless where_tree_val.nil? order_by_val = order_by_condition_or_empty.eval result[:order_by] = order_by_val unless order_by_val.nil? limit_val = limit_condition_or_empty.eval result[:limit] = limit_val unless limit_val.nil? result end } end rule col_val_pairs col_val_pair optional_spaces COMMA optional_spaces col_val_pairs { def eval result1, result2 = col_val_pair.eval, col_val_pairs.eval [result1,result2].flatten end } / col_val_pair end rule col_val_pair one_column_name optional_spaces "=" optional_spaces simple_primitive { def eval [{ :column => one_column_name.eval, :value => simple_primitive.eval }] end } end rule low_priority "LOW_PRIORITY" end rule ignore "IGNORE" end end
Version data entries
6 entries across 6 versions & 1 rubygems