Module: Sequel::JDBC::H2::DatabaseMethods

Includes:
AutoCastDateAndTime
Defined in:
lib/sequel/adapters/jdbc/h2.rb

Instance Method Summary collapse

Methods included from AutoCastDateAndTime

#requires_sql_standard_datetimes?

Instance Method Details

#commit_prepared_transaction(transaction_id, opts = OPTS) ⇒ Object



20
21
22
# File 'lib/sequel/adapters/jdbc/h2.rb', line 20

def commit_prepared_transaction(transaction_id, opts=OPTS)
  run("COMMIT TRANSACTION #{transaction_id}", opts)
end

#database_typeObject



24
25
26
# File 'lib/sequel/adapters/jdbc/h2.rb', line 24

def database_type
  :h2
end

#freezeObject



28
29
30
31
32
# File 'lib/sequel/adapters/jdbc/h2.rb', line 28

def freeze
  h2_version
  version2?
  super
end

#h2_versionObject



34
35
36
# File 'lib/sequel/adapters/jdbc/h2.rb', line 34

def h2_version
  @h2_version ||= get(Sequel.function(:H2VERSION))
end

#rollback_prepared_transaction(transaction_id, opts = OPTS) ⇒ Object



38
39
40
# File 'lib/sequel/adapters/jdbc/h2.rb', line 38

def rollback_prepared_transaction(transaction_id, opts=OPTS)
  run("ROLLBACK TRANSACTION #{transaction_id}", opts)
end

#serial_primary_key_optionsObject

H2 uses an IDENTITY type for primary keys



43
44
45
# File 'lib/sequel/adapters/jdbc/h2.rb', line 43

def serial_primary_key_options
  {:primary_key => true, :type => :identity, :identity=>true}
end

#supports_create_table_if_not_exists?Boolean

H2 supports CREATE TABLE IF NOT EXISTS syntax

Returns:

  • (Boolean)


48
49
50
# File 'lib/sequel/adapters/jdbc/h2.rb', line 48

def supports_create_table_if_not_exists?
  true
end

#supports_prepared_transactions?Boolean

H2 supports prepared transactions

Returns:

  • (Boolean)


53
54
55
# File 'lib/sequel/adapters/jdbc/h2.rb', line 53

def supports_prepared_transactions?
  true
end

#supports_savepoints?Boolean

H2 supports savepoints

Returns:

  • (Boolean)


58
59
60
# File 'lib/sequel/adapters/jdbc/h2.rb', line 58

def supports_savepoints?
  true
end