Open daliboris opened 1 year ago
@daliboris looks like a windows issue to me. On linux double quoted strings will be subject to variable replacement.
xst run "$a + $a" -b '{"a": 1}'
will not work on unix/linux/macOS shells as "$a" is replaced before xst gets to see it.
@daliboris Which shell are you using?
What happens on windows with the following?
xst execute 'xmldb:reindex("/db/apps/" || $project || "-data")' --bind '{ "project": "mordigital" }' --config admin.xstrc
There seems to be a lot to take into account when it comes to double quotes on windows (see https://stackoverflow.com/questions/562038/escaping-double-quotes-in-batch-script)
Which shell are you using?
I'm using cmd.exe
shell.
In PowerShell 5.1, the error (for xst execute 'xmldb:reindex("/db/apps/mordigital-data/data/dictionaries")' --config admin.xstrc
) looks more sophisticated:
XPathException:
err:XPTY0004 checking function parameter 1 in call xmldb:reindex(untyped-value-check[xs:string, [root-node]/child::{}db/child::{}apps/child::{}mordigital-data/child::{}data/child::{}dictionaries]): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: xmldb:reindex($collection-uri as xs:string) xs:boolean. Expected cardinality: exactly one, got 0. [at line 1, column 1, source: String/7292787417532134543]
Running xst run "$a + $a" -b '{"a": 1}'
also fails in CMD and PowerShell:
xst run "$a + $a" -b '{"a": 1}'
Problem with a provided Argument:
Error parsing argument bind! Reason: Unexpected token ' in JSON at position 0
What happens on windows with the following?
xst execute 'xmldb:reindex("/db/apps/" || $project || "-data")' --bind '{ "project": "mordigital" }' --config admin.xstrc
Error executing your query
Failed to invoke method executeQuery in class org.exist.xmlrpc.RpcConnection: org.exist.xquery.StaticXQueryException: exerr:ERROR expecting ''', found '/' [at line 1, column 24]
'$project' is not recognized as an internal or external command,
operable program or batch file.
'"-data")'' is not recognized as an internal or external command,
operable program or batch file.
OK, so the readme should point out which combination of quotes works on Linux and windows.
@daliboris does this command work on windows?
xst execute "xmldb:reindex('/db/apps/' || $project || '-data')" --bind "{ \"project\": \"mordigital\" }" --config admin.xstrc
Hi @line-o , here are some results (I changed the project name):
xst execute "xmldb:reindex('/db/apps/' || $project || '-data')" --bind "{ \"project\": \"lediir\" }" --config admin.xstrc
true
xst execute "xmldb:reindex('/db/apps/' || $project || '-data')" --bind "{ \"project\": \"lediir\" }" --config admin.xstrc
Problem with a provided Argument:
Error parsing argument bind! Reason: Unexpected token : in JSON at position 12
--bind '{ \"project\": \"lediir\" }'
xst execute "xmldb:reindex('/db/apps/' || $project || '-data')" --bind '{ \"project\": \"lediir\" }' --config admin.xstrc
XPathException:
err:XPST0003 unexpected token: || [at line 1, column 31]
--bind "{ \'project\': \'lediir\' }"
xst execute "xmldb:reindex('/db/apps/' || $project || '-data')" --bind "{ \'project\': \'lediir\' }" --config admin.xstrc
Problem with a provided Argument:
Error parsing argument bind! Reason: Unexpected token \ in JSON at position 2
What happened?
When calling
execute
command with parameter that expect string, only combination of single quotes inside double quoted text ("... '..' ... "
) works.The opposit case (
'... ".." ... '
) doesn't work: double quotes are ommited.Combination of single quotes inside double quotes is used in the readme help.
System Information
Relevant shell output