module Sequel::JDBC::Derby::DatabaseMethods

  1. lib/sequel/adapters/jdbc/derby.rb
Parent: Derby

Instance methods for Derby Database objects accessed via JDBC.

Included modules

  1. ::Sequel::JDBC::Transactions

Constants

DATABASE_ERROR_REGEXPS = { /The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index/ => UniqueConstraintViolation, /violation of foreign key constraint/ => ForeignKeyConstraintViolation, /The check constraint .+ was violated/ => CheckConstraintViolation, /cannot accept a NULL value/ => NotNullConstraintViolation, /A lock could not be obtained due to a deadlock/ => SerializationFailure, }.freeze  
PRIMARY_KEY_INDEX_RE = /\Asql\d+\z/i.freeze  

Public Instance methods

cast_type_literal (type)

Derby doesn't support casting integer to varchar, only integer to char, and char(254) appears to have the widest support (with char(255) failing). This does add a bunch of extra spaces at the end, but those will be trimmed elsewhere.

[show source]
# File lib/sequel/adapters/jdbc/derby.rb, line 18
def cast_type_literal(type)
  (type == String) ? 'CHAR(254)' : super
end
database_type ()

Derby uses the :derby database type.

[show source]
# File lib/sequel/adapters/jdbc/derby.rb, line 23
def database_type
  :derby
end
serial_primary_key_options ()

Derby uses an IDENTITY sequence for autoincrementing columns.

[show source]
# File lib/sequel/adapters/jdbc/derby.rb, line 28
def serial_primary_key_options
  {:primary_key => true, :type => :integer, :identity=>true, :start_with=>1}
end
supports_transactional_ddl? ()

Derby supports transaction DDL statements.

[show source]
# File lib/sequel/adapters/jdbc/derby.rb, line 42
def supports_transactional_ddl?
  true
end
svn_version ()

The SVN version of the database.

[show source]
# File lib/sequel/adapters/jdbc/derby.rb, line 33
def svn_version
  @svn_version ||= begin
    v = synchronize{|c| c.get_meta_data.get_database_product_version}
    v =~ /\((\d+)\)\z/
    $1.to_i
  end
end