Skip to content

Commit

Permalink
Add Dataset#row_number_column to DRY up some adapter code and for fut…
Browse files Browse the repository at this point in the history
…ure eager limit strategy use
  • Loading branch information
jeremyevans committed Sep 15, 2011
1 parent 142bd4b commit 9116a56
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
7 changes: 0 additions & 7 deletions lib/sequel/adapters/jdbc/as400.rb
Expand Up @@ -88,13 +88,6 @@ def select_limit_sql(sql)
def supports_window_functions?
true
end

private

# The alias to use for the row_number column when emulating LIMIT and OFFSET
def row_number_column
:x_sequel_row_number_x
end
end
end
end
Expand Down
5 changes: 0 additions & 5 deletions lib/sequel/adapters/shared/db2.rb
Expand Up @@ -267,11 +267,6 @@ def literal_true
BOOL_TRUE
end

# Holds the ROW_NUMBER value, used in offset emulation.
def row_number_column
:x_sequel_row_number_x
end

# Add a fallback table for empty from situation
def select_from_sql(sql)
@opts[:from] ? super : (sql << ' FROM "SYSIBM"."SYSDUMMY1"')
Expand Down
5 changes: 0 additions & 5 deletions lib/sequel/adapters/shared/mssql.rb
Expand Up @@ -519,11 +519,6 @@ def literal_true
BOOL_TRUE
end

# The alias to use for the row_number column when emulating OFFSET
def row_number_column
:x_sequel_row_number_x
end

# MSSQL adds the limit before the columns
def select_clause_methods
SELECT_CLAUSE_METHODS
Expand Down
6 changes: 6 additions & 0 deletions lib/sequel/dataset/misc.rb
Expand Up @@ -140,6 +140,12 @@ def inspect
"#<#{self.class}: #{sql.inspect}>"
end

# The alias to use for the row_number column, used when emulating OFFSET
# support and for eager limit strategies
def row_number_column
:x_sequel_row_number_x
end

# Splits a possible implicit alias in +c+, handling both SQL::AliasedExpressions
# and Symbols. Returns an array of two elements, with the first being the
# main expression, and the second being the alias.
Expand Down

0 comments on commit 9116a56

Please sign in to comment.