Module Sequel::Cubrid::DatabaseMethods
In: lib/sequel/adapters/shared/cubrid.rb

Methods

Included Modules

Sequel::Database::SplitAlterTable

Constants

AUTOINCREMENT = 'AUTO_INCREMENT'.freeze
COLUMN_DEFINITION_ORDER = [:auto_increment, :default, :null, :unique, :primary_key, :references]
DATABASE_ERROR_REGEXPS = { /Operation would have caused one or more unique constraint violations/ => UniqueConstraintViolation, /The constraint of the foreign key .+ is invalid|Update\/Delete operations are restricted by the foreign key/ => ForeignKeyConstraintViolation, /cannot be made NULL/ => NotNullConstraintViolation, /Your transaction .+ has been unilaterally aborted by the system/ => SerializationFailure, }.freeze

Public Instance methods

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 13
13:       def database_type
14:         :cubrid
15:       end

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 17
17:       def indexes(table, opts=OPTS)
18:         m = output_identifier_meth
19:         m2 = input_identifier_meth
20:         indexes = {}
21:         metadata_dataset.
22:           from(:db_index___i).
23:           join(:db_index_key___k, :index_name=>:index_name, :class_name=>:class_name).
24:           where(:i__class_name=>m2.call(table), :is_primary_key=>'NO').
25:           order(:k__key_order).
26:           select(:i__index_name, :k__key_attr_name___column, :is_unique).
27:           each do |row|
28:             index = indexes[m.call(row[:index_name])] ||= {:columns=>[], :unique=>row[:is_unique]=='YES'}
29:             index[:columns] << m.call(row[:column])
30:           end
31:         indexes
32:       end

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 38
38:       def schema_parse_table(table_name, opts)
39:         m = output_identifier_meth(opts[:dataset])
40:         m2 = input_identifier_meth(opts[:dataset])
41: 
42:         pks = metadata_dataset.
43:           from(:db_index___i).
44:           join(:db_index_key___k, :index_name=>:index_name, :class_name=>:class_name).
45:           where(:i__class_name=>m2.call(table_name), :is_primary_key=>'YES').
46:           order(:k__key_order).
47:           select_map(:k__key_attr_name).
48:           map{|c| m.call(c)}
49: 
50:         metadata_dataset.
51:           from(:db_attribute).
52:           where(:class_name=>m2.call(table_name)).
53:           order(:def_order).
54:           select(:attr_name, :data_type___db_type, :default_value___default, :is_nullable___allow_null).
55:           map do |row|
56:             name = m.call(row.delete(:attr_name))
57:             row[:allow_null] = row[:allow_null] == 'YES'
58:             row[:primary_key] = pks.include?(name)
59:             row[:type] = schema_column_type(row[:db_type])
60:             [name, row]
61:           end
62:       end

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 34
34:       def supports_savepoints?
35:         false
36:       end

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 64
64:       def tables(opts=OPTS)
65:         _tables('CLASS')
66:       end

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 68
68:       def views(opts=OPTS)
69:         _tables('VCLASS')
70:       end

[Validate]