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

#dataset(opts = nil) ⇒ Object

Return Sequel::JDBC::H2::Dataset object with the given opts.



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

def dataset(opts=nil)
  Sequel::JDBC::H2::Dataset.new(self, opts)
end

#rollback_prepared_transaction(transaction_id) ⇒ Object

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



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

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

#serial_primary_key_optionsObject

H2 uses an IDENTITY type



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

def serial_primary_key_options
  {:primary_key => true, :type => :identity}
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