class DbMeta::Oracle::Sequence
Attributes
cache_size[R]
cycle_flag[R]
increment_by[R]
last_number[R]
max_value[R]
min_value[R]
order_flag[R]
Public Instance Methods
extract(args = {})
click to toggle source
# File lib/db_meta/oracle/types/sequence.rb, line 25 def extract(args = {}) buffer = [block(@name)] buffer << "CREATE SEQUENCE #{@name}" buffer << " START WITH #{@last_number}" buffer << " MAXVALUE #{@max_value}" buffer << " MINVALUE #{@min_value}" buffer << (@cycle_flag == "N" ? " NOCYCLE" : " CYCLE") buffer << (@cache_size == 0 ? " NOCACHE" : " CACHE #{@cache_size}") buffer << (@order_flag == "N" ? " NOORDER" : " ORDER") buffer << ";" buffer << nil buffer.join("\n") end
fetch()
click to toggle source
# File lib/db_meta/oracle/types/sequence.rb, line 8 def fetch connection = Connection.instance.get cursor = connection.exec("select to_char(min_value), to_char(max_value), to_char(increment_by), cycle_flag, order_flag, to_char(cache_size), to_char(last_number) from user_sequences where sequence_name = '#{@name}'") while (row = cursor.fetch) @min_value = row[0].to_i @max_value = row[1].to_i @increment_by = row[2].to_i @cycle_flag = row[3].to_s @order_flag = row[4].to_s @cache_size = row[5].to_i @last_number = row[6].to_i end cursor.close ensure connection.logoff end