mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/pro#6229 execute sql via cli (#3721)
* dbeaver/pro#6229 execute sql via cli * dbeaver/pro#6229 review fix * dbeaver/pro#6229 update run scripts --------- Co-authored-by: MashaKorax <84867187+MashaKorax@users.noreply.github.com>
This commit is contained in:
co-authored by
MashaKorax
parent
37b8716aee
commit
97d179a103
@@ -36,6 +36,6 @@ exec java ${JAVA_OPTS} \
|
||||
-jar ${launcherJar} \
|
||||
-product io.cloudbeaver.product.ce.product \
|
||||
-web-config conf/cloudbeaver.conf \
|
||||
${CLI_OPTS} \
|
||||
"$@" \
|
||||
-nl en \
|
||||
-registryMultiLanguage
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -Eeo pipefail
|
||||
CLI_OPTS="$@"
|
||||
if [[ $# -eq 0 ]] ;
|
||||
then
|
||||
CLI_OPTS='-help'
|
||||
set -- "$@" -help
|
||||
fi
|
||||
source run-server.sh
|
||||
set -- "$@" -cli-mode
|
||||
|
||||
source run-server.sh "$@"
|
||||
+3
-3
@@ -20,7 +20,7 @@ import org.apache.commons.cli.CommandLine;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.model.cli.ApplicationInstanceController;
|
||||
import org.jkiss.dbeaver.model.cli.ApplicationInstanceServer;
|
||||
import org.jkiss.dbeaver.model.cli.CliProcessResult;
|
||||
import org.jkiss.dbeaver.model.cli.CLIProcessResult;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CloudBeaverInstanceServer extends ApplicationInstanceServer<Applica
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CliProcessResult handleCommandLine(@NotNull String[] args) {
|
||||
public CLIProcessResult handleCommandLine(@NotNull String[] args) {
|
||||
CommandLine cmd = CloudBeaverCommandLine.getInstance().getCommandLine(args);
|
||||
try {
|
||||
return CloudBeaverCommandLine.getInstance().executeCommandLineCommands(
|
||||
@@ -40,7 +40,7 @@ public class CloudBeaverInstanceServer extends ApplicationInstanceServer<Applica
|
||||
false
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return new CliProcessResult(CliProcessResult.PostAction.ERROR, "Error executing command: " + e.getMessage());
|
||||
return new CLIProcessResult(CLIProcessResult.PostAction.ERROR, "Error executing command: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public class WebDataTransferStreamProcessor {
|
||||
|
||||
@Property
|
||||
public String getFileExtension() {
|
||||
return WebDataTransferUtils.getProcessorFileExtension(processor);
|
||||
return processor.getProcessorFileExtension();
|
||||
}
|
||||
|
||||
@Property
|
||||
|
||||
+3
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* DBeaver - Universal Database Manager
|
||||
* Copyright (C) 2010-2024 DBeaver Corp and others
|
||||
* Copyright (C) 2010-2025 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,6 @@ package io.cloudbeaver.service.data.transfer.impl;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
|
||||
import org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
@@ -32,9 +31,7 @@ class WebDataTransferUtils {
|
||||
|
||||
|
||||
public static String getProcessorFileExtension(DataTransferProcessorDescriptor processor) {
|
||||
DBPPropertyDescriptor extProperty = processor.getProperty("extension");
|
||||
String ext = extProperty == null ? processor.getAppFileExtension() : CommonUtils.toString(extProperty.getDefaultValue(), null);
|
||||
return CommonUtils.isEmpty(ext) ? "data" : ext;
|
||||
return processor.getProcessorFileExtension();
|
||||
}
|
||||
|
||||
public static String getProcessorFileExtension(DataTransferProcessorDescriptor processor, Map<String, Object> processorProperties) {
|
||||
@@ -42,7 +39,7 @@ class WebDataTransferUtils {
|
||||
return CommonUtils.toString(processorProperties.get(EXTENSION), "data");
|
||||
}
|
||||
|
||||
return getProcessorFileExtension(processor);
|
||||
return processor.getProcessorFileExtension();
|
||||
}
|
||||
|
||||
public static String normalizeFileName(
|
||||
|
||||
Reference in New Issue
Block a user