class Sequel::JDBC::Derby::Dataset
Constants
- BLOB_CLOSE
- BLOB_OPEN
- BOOL_FALSE
- BOOL_FALSE_OLD
- BOOL_TRUE
- BOOL_TRUE_OLD
- CAST_STRING_OPEN
- DEFAULT_FROM
- EMULATED_FUNCTION_MAP
- FETCH_FIRST
- HSTAR
- OFFSET
- PAREN_CLOSE
- PAREN_OPEN
- ROWS
- ROWS_ONLY
- 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 202 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 209 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 219 def complex_expression_sql_append(sql, op, args) case op when :%, :'B~' complex_expression_emulate_append(sql, op, args) when :&, :|, :^, :<<, :>> raise Error, "Derby doesn't support the #{op} operator" 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 235 def supports_group_rollup? true end
Derby does not support IS TRUE.
# File lib/sequel/adapters/jdbc/derby.rb, line 240 def supports_is_true? false end
Derby does not support IN/NOT IN with multiple columns
# File lib/sequel/adapters/jdbc/derby.rb, line 245 def supports_multiple_column_in? false end
Private Instance Methods
# File lib/sequel/adapters/jdbc/derby.rb, line 251 def empty_from_sql DEFAULT_FROM 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 262 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 256 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 268 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 277 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 283 def literal_true if db.svn_version >= 1040133 BOOL_TRUE else BOOL_TRUE_OLD end end
Derby supports multiple rows in INSERT.
# File lib/sequel/adapters/jdbc/derby.rb, line 292 def multi_insert_sql_strategy :values end
Offset comes before limit in Derby
# File lib/sequel/adapters/jdbc/derby.rb, line 297 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