Class: DbMeta::Oracle::Base
- Inherits:
-
Object
- Object
- DbMeta::Oracle::Base
- Includes:
- Helper
- Defined in:
- lib/db_meta/oracle/base.rb
Direct Known Subclasses
Constraint, DatabaseLink, Function, Grant, Index, Job, Lob, MaterializedView, Package, PackageBody, Procedure, Queue, Sequence, Synonym, Table, Trigger, Type, TypeBody, View
Constant Summary collapse
- TYPES =
{}
Instance Attribute Summary collapse
-
#extract_type ⇒ Object
Returns the value of attribute extract_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#system_object ⇒ Object
Returns the value of attribute system_object.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #ddl_drop ⇒ Object
- #extract(args = {}) ⇒ Object
- #fetch ⇒ Object
-
#initialize(args = {}) ⇒ Base
constructor
A new instance of Base.
- #system_object? ⇒ Boolean
Methods included from Helper
#block, #create_folder, #pluralize, #remove_folder, #type_sequence, #write_buffer_to_file
Constructor Details
#initialize(args = {}) ⇒ Base
Returns a new instance of Base.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/db_meta/oracle/base.rb', line 25 def initialize(args = {}) @type = args["OBJECT_TYPE"] @name = args["OBJECT_NAME"] @status = :unknown @status = args["STATUS"].downcase.to_sym if args["STATUS"] @extract_type = :default # :default, :embedded, :merged @system_object = /\$/i.match?(@name) # true if there is a '$' in the object name end |
Instance Attribute Details
#extract_type ⇒ Object
Returns the value of attribute extract_type.
8 9 10 |
# File 'lib/db_meta/oracle/base.rb', line 8 def extract_type @extract_type end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/db_meta/oracle/base.rb', line 8 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/db_meta/oracle/base.rb', line 8 def status @status end |
#system_object ⇒ Object
Returns the value of attribute system_object.
8 9 10 |
# File 'lib/db_meta/oracle/base.rb', line 8 def system_object @system_object end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/db_meta/oracle/base.rb', line 8 def type @type end |
Class Method Details
.from_type(args = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/db_meta/oracle/base.rb', line 14 def self.from_type(args = {}) type = args["OBJECT_TYPE"] # return instance of known type return TYPES[type].new(args) if TYPES.key?(type) # There is no implementation for this type yet. Let's just use Base Log.warn("Don't know how to handle oracle type [#{type}] yet") Base.new(args) end |
.register_type(type) ⇒ Object
10 11 12 |
# File 'lib/db_meta/oracle/base.rb', line 10 def self.register_type(type) TYPES[type] = self end |
Instance Method Details
#ddl_drop ⇒ Object
44 45 46 |
# File 'lib/db_meta/oracle/base.rb', line 44 def ddl_drop "DROP #{@type} #{@name};" end |
#extract(args = {}) ⇒ Object
40 41 42 |
# File 'lib/db_meta/oracle/base.rb', line 40 def extract(args = {}) "-- class/method needs to be implemented" end |
#fetch ⇒ Object
37 38 |
# File 'lib/db_meta/oracle/base.rb', line 37 def fetch end |
#system_object? ⇒ Boolean
48 49 50 |
# File 'lib/db_meta/oracle/base.rb', line 48 def system_object? @system_object end |