Module: Sequel::JDBC::Derby::DatabaseMethods
- Includes:
- Transactions
- Defined in:
- lib/sequel/adapters/jdbc/derby.rb
Instance Method Summary collapse
-
#cast_type_literal(type) ⇒ Object
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).
- #database_type ⇒ Object
- #freeze ⇒ Object
-
#serial_primary_key_options ⇒ Object
Derby uses an IDENTITY sequence for autoincrementing columns.
-
#supports_transactional_ddl? ⇒ Boolean
Derby supports transactional DDL statements.
-
#svn_version ⇒ Object
The SVN version of the database.
Methods included from Transactions
#supports_savepoints?, #supports_transaction_isolation_levels?
Instance Method Details
#cast_type_literal(type) ⇒ Object
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.
25 26 27 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 25 def cast_type_literal(type) (type == String) ? 'CHAR(254)' : super end |
#database_type ⇒ Object
29 30 31 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 29 def database_type :derby end |
#freeze ⇒ Object
33 34 35 36 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 33 def freeze svn_version super end |
#serial_primary_key_options ⇒ Object
Derby uses an IDENTITY sequence for autoincrementing columns.
39 40 41 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 39 def {:primary_key => true, :type => Integer, :identity=>true, :start_with=>1} end |
#supports_transactional_ddl? ⇒ Boolean
Derby supports transactional DDL statements.
53 54 55 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 53 def supports_transactional_ddl? true end |
#svn_version ⇒ Object
The SVN version of the database.
44 45 46 47 48 49 50 |
# File 'lib/sequel/adapters/jdbc/derby.rb', line 44 def svn_version @svn_version ||= begin v = synchronize{|c| c..get_database_product_version} v =~ /\((\d+)\)\z/ $1.to_i end end |