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

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

Overview

Instance methods for H2 Database objects accessed via JDBC.

Constant Summary collapse

PRIMARY_KEY_INDEX_RE =
/\Aprimary_key/i.freeze

Instance Method Summary collapse

Instance Method Details

#commit_prepared_transaction(transaction_id) ⇒ Object

Commit an existing prepared transaction with the given transaction identifier string.



11
12
13
# File 'lib/sequel/adapters/jdbc/h2.rb', line 11

def commit_prepared_transaction(transaction_id)
  run("COMMIT TRANSACTION #{transaction_id}")
end

#database_typeObject

H2 uses the :h2 database type.



16
17
18
# File 'lib/sequel/adapters/jdbc/h2.rb', line 16

def database_type
  :h2
end

#rollback_prepared_transaction(transaction_id) ⇒ Object

Rollback an existing prepared transaction with the given transaction identifier string.



22
23
24
# File 'lib/sequel/adapters/jdbc/h2.rb', line 22

def rollback_prepared_transaction(transaction_id)
  run("ROLLBACK TRANSACTION #{transaction_id}")
end

#serial_primary_key_optionsObject

H2 uses an IDENTITY type



27
28
29
# File 'lib/sequel/adapters/jdbc/h2.rb', line 27

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)


32
33
34
# File 'lib/sequel/adapters/jdbc/h2.rb', line 32

def supports_create_table_if_not_exists?
  true
end

#supports_prepared_transactions?Boolean

H2 supports prepared transactions

Returns:

  • (Boolean)


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

def supports_prepared_transactions?
  true
end

#supports_savepoints?Boolean

H2 supports savepoints

Returns:

  • (Boolean)


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

def supports_savepoints?
  true
end