class DbMeta::Oracle::Package

Attributes

body[R]
header[R]

Public Instance Methods

extract(args = {}) click to toggle source
# File lib/db_meta/oracle/types/package.rb, line 27
def extract(args = {})
  buffer = [block(@name)]
  buffer << "CREATE OR REPLACE #{@header.strip}"
  buffer << "/"
  buffer << nil

  buffer << "CREATE OR REPLACE #{@body.strip}"
  buffer << "/"
  buffer << nil

  buffer.join("\n")
end
fetch() click to toggle source
# File lib/db_meta/oracle/types/package.rb, line 8
def fetch
  @header = ""
  cursor = Connection.instance.get.exec("select text from user_source where type = 'PACKAGE' and name = '#{@name}' order by line")
  while (row = cursor.fetch)
    @header << row[0].to_s
  end
  cursor.close

  @body = ""
  connection = Connection.instance.get
  cursor = connection.exec("select text from user_source where type = 'PACKAGE BODY' and name = '#{@name}' order by line")
  while (row = cursor.fetch)
    @body << row[0].to_s
  end
  cursor.close
ensure
  connection.logoff
end