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 17
17:       def database_type
18:         :cubrid
19:       end

[Source]

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

[Source]

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

[Source]

    # File lib/sequel/adapters/shared/cubrid.rb, line 38
38:       def supports_savepoints?
39:         false
40:       end

[Source]

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

[Source]

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

[Validate]