Class: OpenehrRails::Aql::QueryValidator
- Inherits:
-
Object
- Object
- OpenehrRails::Aql::QueryValidator
- Defined in:
- lib/openehr_rails/aql/query_validator.rb
Overview
Pre-validates an AQL query against the openehr gem's known execution gaps (parses fine, raises OpenEHR::AQL::ExecutionError or silently misbehaves at run time), so callers (Model.aql, the REST endpoint, the admin console) can surface a specific, actionable error instead of a raw engine failure. See the openehr gem's own README/CHANGELOG for the authoritative, up-to-date list of what the engine can execute.
Constant Summary collapse
- VERSION_CLASS_NAMES =
%w[VERSION LATEST_VERSION ALL_VERSIONS VERSIONED_COMPOSITION].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(aql_string) ⇒ QueryValidator
constructor
A new instance of QueryValidator.
- #validate! ⇒ Object
Constructor Details
#initialize(aql_string) ⇒ QueryValidator
Returns a new instance of QueryValidator.
20 21 22 |
# File 'lib/openehr_rails/aql/query_validator.rb', line 20 def initialize(aql_string) @aql_string = aql_string end |
Class Method Details
.validate!(aql_string) ⇒ Object
16 17 18 |
# File 'lib/openehr_rails/aql/query_validator.rb', line 16 def self.validate!(aql_string) new(aql_string).validate! end |
Instance Method Details
#validate! ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/openehr_rails/aql/query_validator.rb', line 24 def validate! query = parse check_from_clause(query.from_clause) check_select_clause(query.select_clause) check_where_clause(query.where_clause) query end |