This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Description
I changed execute_query_8 as shown below, and that allows me to at least invoke modules of current project with for instance:
def replace_addresses
country = find_arg(["--country"]) || "NL"
lang = find_arg(["--language"]) || "Dutch"
logger.info "Replacing customer addresses with #{country}/#{lang}.."
r = execute_query(
%Q{
xquery version "1.0-ml";
xdmp:invoke('/task/replace-addresses.xqy', (xs:QName("country"), "#{country}", xs:QName("lang"), "#{lang}"))
},
{ :app_name => @properties["ml.app-name"] }
)
r.body = parse_body(r.body)
logger.info r.body
end
Patch for server_config.rb:
def execute_query_8(query, properties = {})
if properties[:app_name] != nil && properties[:app_name] != @properties["ml.app-name"]
raise ExitException.new("Executing queries with an app_name (currently) not supported with ML8+")
end
headers = {
"Content-Type" => "application/x-www-form-urlencoded"
}
params = {
:xquery => query,
:locale => LOCALE,
:tzoffset => "-18000"
}
port = @qconsole_port
if properties[:app_name] != nil
port = @properties["ml.app-port"]
end
if properties[:db_name] != nil
params[:database] = properties[:db_name]
end
r = go "#{@protocol}://#{@hostname}:#{port}/v1/eval", "post", headers, params
raise ExitException.new(JSON.pretty_generate(JSON.parse(r.body))) if r.body.match(/\{"error"/)
r
end