class Sequel::JDBC::Derby::Dataset
Constants
- BITCOMP_CLOSE
- BITCOMP_OPEN
- BLOB_CLOSE
- BLOB_OPEN
- BOOL_FALSE
- BOOL_FALSE_OLD
- BOOL_TRUE
- BOOL_TRUE_OLD
- CAST_STRING_OPEN
- DEFAULT_FROM
- DERBY_CLOB_METHOD
- EMULATED_FUNCTION_MAP
- FETCH_FIRST
- HSTAR
- JAVA_SQL_CLOB
- OFFSET
- PAREN_CLOSE
- PAREN_OPEN
- ROWS
- ROWS_ONLY
- SELECT_CLAUSE_METHODS
- TIME_FORMAT
Public Instance Methods
Derby doesn't support an expression between CASE and WHEN, so remove conditions.
# File lib/sequel/adapters/jdbc/derby.rb, line 196 def case_expression_sql_append(sql, ce) super(sql, ce.with_merged_expression) end
If the type is String, trim the extra spaces since CHAR is used instead of varchar. This can cause problems if you are casting a char/varchar to a string and the ending whitespace is important.
# File lib/sequel/adapters/jdbc/derby.rb, line 203 def cast_sql_append(sql, expr, type) if type == String sql << CAST_STRING_OPEN super sql << PAREN_CLOSE else super end end
# File lib/sequel/adapters/jdbc/derby.rb, line 213 def complex_expression_sql_append(sql, op, args) case op when :% sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"} when :&, :|, :^, :<<, :>> raise Error, "Derby doesn't support the #{op} operator" when :'B~' sql << BITCOMP_OPEN literal_append(sql, args.at(0)) sql << BITCOMP_CLOSE when :extract sql << args.at(0).to_s << PAREN_OPEN literal_append(sql, args.at(1)) sql << PAREN_CLOSE else super end end
Derby supports GROUP BY ROLLUP (but not CUBE)
# File lib/sequel/adapters/jdbc/derby.rb, line 233 def supports_group_rollup? true end
Derby does not support IS TRUE.
# File lib/sequel/adapters/jdbc/derby.rb, line 238 def supports_is_true? false end
Derby does not support IN/NOT IN with multiple columns
# File lib/sequel/adapters/jdbc/derby.rb, line 243 def supports_multiple_column_in? false end
Private Instance Methods
Handle clobs on Derby as strings.
# File lib/sequel/adapters/jdbc/derby.rb, line 258 def convert_type_proc(v) if v.is_a?(JAVA_SQL_CLOB) DERBY_CLOB_METHOD else super end end
Derby needs the standard workaround to insert all default values into a table with more than one column.
# File lib/sequel/adapters/jdbc/derby.rb, line 273 def insert_supports_empty_values? false end
Derby needs a hex string casted to BLOB for blobs.
# File lib/sequel/adapters/jdbc/derby.rb, line 267 def literal_blob_append(sql, v) sql << BLOB_OPEN << v.unpack(HSTAR).first << BLOB_CLOSE end
Derby uses an expression yielding false for false values. Newer versions can use the FALSE literal, but the latest gem version cannot.
# File lib/sequel/adapters/jdbc/derby.rb, line 279 def literal_false if db.svn_version >= 1040133 BOOL_FALSE else BOOL_FALSE_OLD end end
Derby handles fractional seconds in timestamps, but not in times
# File lib/sequel/adapters/jdbc/derby.rb, line 288 def literal_sqltime(v) v.strftime(TIME_FORMAT) end
Derby uses an expression yielding true for true values. Newer versions can use the TRUE literal, but the latest gem version cannot.
# File lib/sequel/adapters/jdbc/derby.rb, line 294 def literal_true if db.svn_version >= 1040133 BOOL_TRUE else BOOL_TRUE_OLD end end
Derby doesn't support common table expressions.
# File lib/sequel/adapters/jdbc/derby.rb, line 303 def select_clause_methods SELECT_CLAUSE_METHODS end
Use a default FROM table if the dataset does not contain a FROM table.
# File lib/sequel/adapters/jdbc/derby.rb, line 308 def select_from_sql(sql) if @opts[:from] super else sql << DEFAULT_FROM end end
Offset comes before limit in Derby
# File lib/sequel/adapters/jdbc/derby.rb, line 317 def select_limit_sql(sql) if o = @opts[:offset] sql << OFFSET literal_append(sql, o) sql << ROWS end if l = @opts[:limit] sql << FETCH_FIRST literal_append(sql, l) sql << ROWS_ONLY end end