Module: PuppetX::EnterpriseModules::Oracle::FunctionHandling
- Defined in:
- lib/puppet_x/enterprisemodules/oracle/function_handling.rb
Overview
This module handles Oracle function definitions and their processing.
Provides methods to manage and manipulate Oracle function definitions within Puppet configurations.
Instance Method Summary collapse
-
#change_to_s(currentvalue, _newvalue) ⇒ String
Converts the current value of a function definition to a string.
-
#compilation_errors ⇒ Integer
Checks for compilation errors in the function definition.
-
#current_content ⇒ String
Retrieves the current content of the function definition.
-
#process_content(content) ⇒ String
Processes the content of the function definition by removing unnecessary characters and formatting it.
Instance Method Details
#change_to_s(currentvalue, _newvalue) ⇒ String
Converts the current value of a function definition to a string.
22 23 24 25 26 27 28 |
# File 'lib/puppet_x/enterprisemodules/oracle/function_handling.rb', line 22 def change_to_s(currentvalue, _newvalue) if currentvalue.to_s == 'absent' 'created function definition' else 'changed to new function definition' end end |
#compilation_errors ⇒ Integer
Checks for compilation errors in the function definition.
58 59 60 61 |
# File 'lib/puppet_x/enterprisemodules/oracle/function_handling.rb', line 58 def compilation_errors results = sql template('ora_config/ora_function/function_errors.sql.erb', binding), :sid => resource.sid results.first['ERRORS'].to_i end |
#current_content ⇒ String
Retrieves the current content of the function definition.
33 34 35 |
# File 'lib/puppet_x/enterprisemodules/oracle/function_handling.rb', line 33 def current_content @current_content ||= process_content(sql(template('ora_config/ora_function/function_definition.sql.erb', binding), :sid => resource.sid, :parse => false)) end |
#process_content(content) ⇒ String
Processes the content of the function definition by removing unnecessary characters and formatting it.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet_x/enterprisemodules/oracle/function_handling.rb', line 42 def process_content(content) new_content = content.gsub(/CONTENT\s*\n-*\s*\n/, ''). gsub(/--.*\n/, ''). gsub(%r{^/\s*$}, ''). gsub(/\s|\s|"|'/, ''). delete("\n").upcase if resource[:editionable].to_s == 'false' new_content.gsub(/(?:non)?editionable/i, '') else new_content end end |