Module: PuppetX::EnterpriseModules::Oracle::ProcedureHandling
- Defined in:
- lib/puppet_x/enterprisemodules/oracle/procedure_handling.rb
Overview
Module for handling Oracle procedure definitions.
This module provides methods to manage and process Oracle procedure definitions within Puppet.
Instance Method Summary collapse
-
#change_to_s(currentvalue, _newvalue) ⇒ String
Converts the current value to a string representation.
-
#compilation_errors ⇒ Integer
Retrieves the compilation errors from the procedure.
-
#current_content ⇒ String
Retrieves the current content of the procedure definition.
-
#process_content(content) ⇒ String
Processes the content of the procedure definition.
Instance Method Details
#change_to_s(currentvalue, _newvalue) ⇒ String
Converts the current value to a string representation.
20 21 22 23 24 25 26 |
# File 'lib/puppet_x/enterprisemodules/oracle/procedure_handling.rb', line 20 def change_to_s(currentvalue, _newvalue) if currentvalue.to_s == 'absent' 'created procedure definition' else 'changed to new procedure definition' end end |
#compilation_errors ⇒ Integer
Retrieves the compilation errors from the procedure.
55 56 57 58 |
# File 'lib/puppet_x/enterprisemodules/oracle/procedure_handling.rb', line 55 def compilation_errors results = sql template('ora_config/ora_procedure/procedure_errors.sql.erb', binding), :sid => resource.sid results.first['ERRORS'].to_i end |
#current_content ⇒ String
Retrieves the current content of the procedure definition.
31 32 33 |
# File 'lib/puppet_x/enterprisemodules/oracle/procedure_handling.rb', line 31 def current_content @current_content ||= process_content(sql(template('ora_config/ora_procedure/procedure_definition.sql.erb', binding), :sid => resource.sid, :parse => false)) end |
#process_content(content) ⇒ String
Processes the content of the procedure definition.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/puppet_x/enterprisemodules/oracle/procedure_handling.rb', line 39 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 |