Class | Sequel::JDBC::Derby::Dataset |
In: |
lib/sequel/adapters/jdbc/derby.rb
|
Parent: | JDBC::Dataset |
PAREN_CLOSE | = | Dataset::PAREN_CLOSE |
PAREN_OPEN | = | Dataset::PAREN_OPEN |
OFFSET | = | Dataset::OFFSET |
CAST_STRING_OPEN | = | "RTRIM(".freeze |
BLOB_OPEN | = | "CAST(X'".freeze |
BLOB_CLOSE | = | "' AS BLOB)".freeze |
HSTAR | = | "H*".freeze |
TIME_FORMAT | = | "'%H:%M:%S'".freeze |
DEFAULT_FROM | = | " FROM sysibm.sysdummy1".freeze |
ROWS | = | " ROWS".freeze |
FETCH_FIRST | = | " FETCH FIRST ".freeze |
ROWS_ONLY | = | " ROWS ONLY".freeze |
BOOL_TRUE_OLD | = | '(1 = 1)'.freeze |
BOOL_FALSE_OLD | = | '(1 = 0)'.freeze |
BOOL_TRUE | = | 'TRUE'.freeze |
BOOL_FALSE | = | 'FALSE'.freeze |
EMULATED_FUNCTION_MAP | = | {:char_length=>'length'.freeze} |
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 211 211: def cast_sql_append(sql, expr, type) 212: if type == String 213: sql << CAST_STRING_OPEN 214: super 215: sql << PAREN_CLOSE 216: else 217: super 218: end 219: end
# File lib/sequel/adapters/jdbc/derby.rb, line 221 221: def complex_expression_sql_append(sql, op, args) 222: case op 223: when :%, 'B~''B~' 224: complex_expression_emulate_append(sql, op, args) 225: when :&, :|, :^, :<<, :>> 226: raise Error, "Derby doesn't support the #{op} operator" 227: when :** 228: sql << 'exp(' 229: literal_append(sql, args[1]) 230: sql << ' * ln(' 231: literal_append(sql, args[0]) 232: sql << "))" 233: when :extract 234: sql << args.at(0).to_s << PAREN_OPEN 235: literal_append(sql, args.at(1)) 236: sql << PAREN_CLOSE 237: else 238: super 239: end 240: end