Class: DbMeta::Oracle::Package
- Defined in:
- lib/db_meta/oracle/types/package.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
Attributes inherited from Base
#extract_type, #name, #status, #system_object, #type
Instance Method Summary collapse
Methods inherited from Base
#ddl_drop, from_type, #initialize, register_type, #system_object?
Methods included from Helper
#block, #create_folder, #pluralize, #remove_folder, #type_sequence, #write_buffer_to_file
Constructor Details
This class inherits a constructor from DbMeta::Oracle::Base
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/db_meta/oracle/types/package.rb', line 6 def body @body end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
6 7 8 |
# File 'lib/db_meta/oracle/types/package.rb', line 6 def header @header end |
Instance Method Details
#extract(args = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# 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 ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |