module Sequel::JDBC::Derby::DatabaseMethods

  1. lib/sequel/adapters/jdbc/derby.rb

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  

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
27 def cast_type_literal(type)
28   (type == String) ? 'CHAR(254)' : super
29 end
database_type()
[show source]
   # File lib/sequel/adapters/jdbc/derby.rb
31 def database_type
32   :derby
33 end
freeze()
[show source]
   # File lib/sequel/adapters/jdbc/derby.rb
35 def freeze
36   svn_version
37   super
38 end
serial_primary_key_options()

Derby uses an IDENTITY sequence for autoincrementing columns.

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

Derby supports transactional DDL statements.

[show source]
   # File lib/sequel/adapters/jdbc/derby.rb
55 def supports_transactional_ddl?
56   true
57 end
svn_version()

The SVN version of the database.

[show source]
   # File lib/sequel/adapters/jdbc/derby.rb
46 def svn_version
47   @svn_version ||= begin
48     v = synchronize{|c| c.get_meta_data.get_database_product_version}
49     v =~ /\((\d+)\)\z/
50     $1.to_i
51   end
52 end