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.



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

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

#database_typeObject

H2 uses the :h2 database type.



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

def database_type
  :h2
end

#rollback_prepared_transaction(transaction_id, opts = OPTS) ⇒ Object

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



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

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

#serial_primary_key_optionsObject

H2 uses an IDENTITY type



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

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)


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

def supports_create_table_if_not_exists?
  true
end

#supports_prepared_transactions?Boolean

H2 supports prepared transactions

Returns:

  • (Boolean)


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

def supports_prepared_transactions?
  true
end

#supports_savepoints?Boolean

H2 supports savepoints

Returns:

  • (Boolean)


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

def supports_savepoints?
  true
end