Class: DbMeta::Oracle::DatabaseLink
- Defined in:
- lib/db_meta/oracle/types/database_link.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/db_meta/oracle/types/database_link.rb', line 6 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/db_meta/oracle/types/database_link.rb', line 6 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/db_meta/oracle/types/database_link.rb', line 6 def username @username end |
Instance Method Details
#extract(args = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/db_meta/oracle/types/database_link.rb', line 22 def extract(args = {}) buffer = [] buffer << "CREATE DATABASE LINK #{@name}" buffer << " CONNECT TO #{@username}" buffer << " IDENTIFIED BY :1" buffer << " USING '#{@host}';" buffer << nil buffer.join("\n") end |
#fetch(args = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/db_meta/oracle/types/database_link.rb', line 8 def fetch(args = {}) connection_class = args[:connection_class] || Connection connection = connection_class.instance.get cursor = connection.exec("select username, password, host from user_db_links where db_link = '#{@name}'") while (row = cursor.fetch) @username = row[0].to_s @password = row[1].to_s @host = row[2].to_s end cursor.close ensure connection.logoff end |