3 def self.adapter_selector
4 [/sybase/i, lambda{|cfg,adapt| adapt.extend(JdbcSpec::Sybase)}]
7 def add_limit_offset!(sql, options) # :nodoc:
8 @limit = options[:limit]
9 @offset = options[:offset]
11 # Use temp table to hack offset with Sybase
12 sql.sub!(/ FROM /i, ' INTO #artemp FROM ')
14 # "SET ROWCOUNT 0" turns off limits, so we havesy
15 # to use a cheap trick.
17 sql.sub!(/WHERE/i, 'WHERE 1 = 2 AND ')
18 elsif sql =~ /ORDER\s+BY/i
19 sql.sub!(/ORDER\s+BY/i, 'WHERE 1 = 2 ORDER BY')
26 # If limit is not set at all, we can ignore offset;
27 # if limit *is* set but offset is zero, use normal select
28 # with simple SET ROWCOUNT. Thus, only use the temp table
29 # if limit is set and offset > 0.
31 !@limit.nil? && !@offset.nil? && @offset > 0
35 !@limit.nil? && @limit == 0