Class: Oraora::Meta::Sequence

Inherits:
Object
  • Object
show all
Defined in:
lib/oraora/meta/sequence.rb

Instance Method Summary collapse

Methods inherited from Object

from_oci, #initialize

Constructor Details

This class inherits a constructor from Oraora::Meta::Object

Instance Method Details

#describe(options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/oraora/meta/sequence.rb', line 18

def describe(options = {})
  <<-HERE.reset_indentation
    Sequence #{@schema}.#{@name}
    Min value:    #{@min.to_i}
    Max value:    #{@max.to_i}
    Increment by: #{@inc.to_i}
    Last value:   #{@last.to_i}
  HERE
end

#list(options = {}, filter = nil) ⇒ Object

Raises:



28
29
30
# File 'lib/oraora/meta/sequence.rb', line 28

def list(options = {}, filter = nil)
  raise NotApplicable, "Nothing to list for sequence"
end

#load_from_oci(oci) ⇒ Object

Raises:



10
11
12
13
14
15
16
# File 'lib/oraora/meta/sequence.rb', line 10

def load_from_oci(oci)
  @min, @max, @inc, @last = oci.select_one("SELECT min_value, max_value, increment_by, last_number
                                              FROM all_sequences
                                             WHERE sequence_owner = :schema AND sequence_name = :name", @schema, @name)
  raise NotExists if !@min
  self
end

#typeObject



6
7
8
# File 'lib/oraora/meta/sequence.rb', line 6

def type
  'SEQUENCE'
end