Class: DbMeta::Oracle::Type
- Defined in:
- lib/db_meta/oracle/types/type.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
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 Method Details
#extract(args = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/db_meta/oracle/types/type.rb', line 26 def extract(args = {}) buffer = [block(@name)] buffer << "CREATE OR REPLACE #{@source.strip}" buffer << "/" buffer << nil if @body.size > 0 buffer << "CREATE OR REPLACE #{@body.strip}" buffer << "/" buffer << nil end buffer.join("\n") end |
#fetch ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/db_meta/oracle/types/type.rb', line 6 def fetch @source = "" @body = "" connection = Connection.instance.get cursor = connection.exec("select text from user_source where type = 'TYPE' and name = '#{@name}' order by line") while (row = cursor.fetch) @source << row[0].to_s end cursor.close # check for type body cursor = connection.exec("select text from user_source where type = 'TYPE BODY' and name = '#{@name}' order by line") while (row = cursor.fetch) @body << row[0].to_s end cursor.close ensure connection.logoff end |