class Sequel::JDBC::HSQLDB::Dataset
Constants
- APOS
- BITCOMP_CLOSE
- BITCOMP_OPEN
- BITWISE_METHOD_MAP
- BLOB_OPEN
- BOOL_FALSE
- BOOL_TRUE
- DEFAULT_FROM
- HSTAR
- SELECT_CLAUSE_METHODS
HSQLDB does support common table expressions, but the support is broken. CTEs operate more like temprorary tables or views, lasting longer than the duration of the expression. CTEs in earlier queries might take precedence over CTEs with the same name in later queries. Also, if any CTE is recursive, all CTEs must be recursive. If you want to use CTEs with HSQLDB, you'll have to manually modify the dataset to allow it.
- SQL_WITH_RECURSIVE
- TIME_FORMAT
Public Instance Methods
Handle HSQLDB specific case insensitive LIKE and bitwise operator support.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 126 def complex_expression_sql_append(sql, op, args) case op when :ILIKE, :"NOT ILIKE" super(sql, (op == :ILIKE ? :LIKE : :"NOT LIKE"), args.map{|v| SQL::Function.new(:ucase, v)}) when :&, :|, :^ op = BITWISE_METHOD_MAP[op] sql << complex_expression_arg_pairs(args){|a, b| literal(SQL::Function.new(op, a, b))} when :<< sql << complex_expression_arg_pairs(args){|a, b| "(#{literal(a)} * POWER(2, #{literal(b)}))"} when :>> sql << complex_expression_arg_pairs(args){|a, b| "(#{literal(a)} / POWER(2, #{literal(b)}))"} when :% sql << complex_expression_arg_pairs(args){|a, b| "MOD(#{literal(a)}, #{literal(b)})"} when :'B~' sql << BITCOMP_OPEN literal_append(sql, args.at(0)) sql << BITCOMP_CLOSE else super end end
HSQLDB requires recursive CTEs to have column aliases.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 149 def recursive_cte_requires_column_aliases? true end
HSQLDB does not support IS TRUE.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 159 def supports_is_true? false end
Private Instance Methods
Use string in hex format for blob data.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 166 def literal_blob_append(sql, v) sql << BLOB_OPEN << v.unpack(HSTAR).first << APOS end
HSQLDB uses FALSE for false values.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 171 def literal_false BOOL_FALSE end
HSQLDB handles fractional seconds in timestamps, but not in times
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 176 def literal_sqltime(v) v.strftime(TIME_FORMAT) end
HSQLDB uses TRUE for true values.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 181 def literal_true BOOL_TRUE end
Use a default FROM table if the dataset does not contain a FROM table.
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 191 def select_from_sql(sql) if @opts[:from] super else sql << DEFAULT_FROM end end
Use WITH RECURSIVE instead of WITH if any of the CTEs is recursive
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 200 def select_with_sql_base opts[:with].any?{|w| w[:recursive]} ? SQL_WITH_RECURSIVE : super end