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

Extended by:
Database::ResetIdentifierMangling
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

Methods included from Database::ResetIdentifierMangling

extended

Instance Method Details

#commit_prepared_transaction(transaction_id, opts = OPTS) ⇒ Object

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



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

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

#database_typeObject

H2 uses the :h2 database type.



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

def database_type
  :h2
end

#rollback_prepared_transaction(transaction_id, opts = OPTS) ⇒ Object

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



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

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

#serial_primary_key_optionsObject

H2 uses an IDENTITY type



40
41
42
# File 'lib/sequel/adapters/jdbc/h2.rb', line 40

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)


45
46
47
# File 'lib/sequel/adapters/jdbc/h2.rb', line 45

def supports_create_table_if_not_exists?
  true
end

#supports_prepared_transactions?Boolean

H2 supports prepared transactions

Returns:

  • (Boolean)


50
51
52
# File 'lib/sequel/adapters/jdbc/h2.rb', line 50

def supports_prepared_transactions?
  true
end

#supports_savepoints?Boolean

H2 supports savepoints

Returns:

  • (Boolean)


55
56
57
# File 'lib/sequel/adapters/jdbc/h2.rb', line 55

def supports_savepoints?
  true
end