class Sequel::JDBC::HSQLDB::Dataset

Dataset class for HSQLDB datasets accessed via JDBC.

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

complex_expression_sql_append(sql, op, args) click to toggle source

Handle HSQLDB specific case insensitive LIKE and bitwise operator support.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 125
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
recursive_cte_requires_column_aliases?() click to toggle source

HSQLDB requires recursive CTEs to have column aliases.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 148
def recursive_cte_requires_column_aliases?
  true
end
requires_sql_standard_datetimes?() click to toggle source

HSQLDB requires SQL standard datetimes in some places.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 153
def requires_sql_standard_datetimes?
  true
end
supports_is_true?() click to toggle source

HSQLDB does not support IS TRUE.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 158
def supports_is_true?
  false
end

Private Instance Methods

literal_blob_append(sql, v) click to toggle source

Use string in hex format for blob data.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 165
def literal_blob_append(sql, v)
  sql << BLOB_OPEN << v.unpack(HSTAR).first << APOS
end
literal_false() click to toggle source

HSQLDB uses FALSE for false values.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 170
def literal_false
  BOOL_FALSE
end
literal_sqltime(v) click to toggle source

HSQLDB handles fractional seconds in timestamps, but not in times

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 175
def literal_sqltime(v)
  v.strftime(TIME_FORMAT)
end
literal_true() click to toggle source

HSQLDB uses TRUE for true values.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 180
def literal_true
  BOOL_TRUE
end
select_clause_methods() click to toggle source

HSQLDB does not support CTEs well enough for Sequel to enable support for them.

# File lib/sequel/adapters/jdbc/hsqldb.rb, line 185
def select_clause_methods
  SELECT_CLAUSE_METHODS
end
select_from_sql(sql) click to toggle source

Use a default FROM table if the dataset does not contain a FROM table.

Calls superclass method Sequel::Dataset#select_from_sql
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 190
def select_from_sql(sql)
  if @opts[:from]
    super
  else
    sql << DEFAULT_FROM
  end
end
select_with_sql_base() click to toggle source

Use WITH RECURSIVE instead of WITH if any of the CTEs is recursive

Calls superclass method Sequel::Dataset#select_with_sql_base
# File lib/sequel/adapters/jdbc/hsqldb.rb, line 199
def select_with_sql_base
  opts[:with].any?{|w| w[:recursive]} ? SQL_WITH_RECURSIVE : super
end