Skip to content

Commit

Permalink
#986: Added environment variable for new ScriptOptionsLine parser in …
Browse files Browse the repository at this point in the history
…UDF client (#463)

related to exasol/script-languages-release#986
  • Loading branch information
tomuben authored Oct 22, 2024
1 parent 684d0ef commit 3a1531d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions exaudfclient/base/javacontainer/javacontainer_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace SWIGVMContainers {
JavaContainerBuilder::JavaContainerBuilder()
: m_useCtpgParser(false) {}

JavaContainerBuilder& JavaContainerBuilder::useCtpgParser(const bool useCtpgParser) {
m_useCtpgParser = useCtpgParser;
JavaContainerBuilder& JavaContainerBuilder::useCtpgParser() {
m_useCtpgParser = true;
return *this;
}

Expand Down
2 changes: 1 addition & 1 deletion exaudfclient/base/javacontainer/javacontainer_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class JavaContainerBuilder {
public:
JavaContainerBuilder();

JavaContainerBuilder& useCtpgParser(const bool value);
JavaContainerBuilder& useCtpgParser();

JavaVMach* build();

Expand Down
9 changes: 8 additions & 1 deletion exaudfclient/exaudfclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ int main(int argc, char **argv) {
cerr << "Usage: " << argv[0] << " <socket> lang=python|lang=r|lang=java|lang=streaming|lang=benchmark" << endl;
return 1;
}
const char* script_options_parser_env_val = ::getenv("SCRIPT_OPTIONS_PARSER_VERSION");
const bool useCtpgScriptOptionsParser = script_options_parser_env_val != nullptr &&
::strcmp(script_options_parser_env_val, "2") == 0;
#endif

if (::setenv("HOME", "/tmp", 1) == -1)
Expand Down Expand Up @@ -160,7 +163,11 @@ int main(int argc, char **argv) {
} else if (strcmp(argv[2], "lang=java")==0)
{
#ifdef ENABLE_JAVA_VM
vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build();};
if (useCtpgScriptOptionsParser) {
vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().useCtpgParser().build();};
} else {
vmMaker = [&](){return SWIGVMContainers::JavaContainerBuilder().build();};
}
#else
throw SWIGVM::exception("this exaudfclient has been compilied without Java support");
#endif
Expand Down

0 comments on commit 3a1531d

Please sign in to comment.