Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Altibase: add tasks for Table, View, MView, Procedure, Function, Package #34213

Merged
merged 17 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.jkiss.dbeaver.ui.editors.data,
org.jkiss.dbeaver.ui.navigator,
org.jkiss.dbeaver.ext.altibase,
org.jkiss.dbeaver.ui.editors.session
org.jkiss.dbeaver.ui.editors.session,
org.jkiss.dbeaver.tasks.native.ui,
org.jkiss.dbeaver.tasks.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Vendor: %Bundle-Vendor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bundle-Vendor = JKISS
Bundle-Vendor = Altibase
Bundle-Name = DBeaver Altibase Support UI

altibase.dialog.connection.header = Altibase Connection Settings
Expand All @@ -11,4 +11,10 @@ editor.source.name = Source
tree.ddl.node.tip = Table DDL


page.org.jkiss.dbeaver.preferences.altibase.main.name=Altibase settings
page.org.jkiss.dbeaver.preferences.altibase.main.name=Altibase settings

tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolMViewRefresh.label = Refresh materialized view
tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolTruncateTable.label = Truncate table
tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseViewCompile.label = Compile view
tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibasePackageCompile.label = Compile package
tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseProcedureCompile.label = Compile procedure/function
3 changes: 2 additions & 1 deletion plugins/org.jkiss.dbeaver.ext.altibase.ui/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ output.. = target/classes/
bin.includes = .,\
META-INF/,\
OSGI-INF/,\
plugin.xml
plugin.xml,\
icons/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions plugins/org.jkiss.dbeaver.ext.altibase.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,55 @@
<supports dataSource="altibase"/>
</editorContribution>
</extension>

<extension point="org.jkiss.dbeaver.tools">
<tools>
<tool
description="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolMViewRefresh.label"
group="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance"
icon="#refresh"
id="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolMViewRefresh"
label="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolMViewRefresh.label"
singleton="false">
<task id="altibaseToolMViewRefresh"/>
</tool>
<tool
description="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolTruncateTable.label"
group="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance"
icon="#clean"
id="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolTableTruncate"
label="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolTruncateTable.label"
singleton="false">
<task id="altibaseToolTableTruncate"/>
</tool>
<tool
description="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseViewCompile.label"
group="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance"
icon="icons/compile.png"
ShadelessFox marked this conversation as resolved.
Show resolved Hide resolved
id="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolViewCompile"
label="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseViewCompile.label"
singleton="false">
<task id="altibaseToolViewCompile"/>
</tool>
<tool
description="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseProcedureCompile.label"
group="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance"
icon="icons/compile.png"
id="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolProcedureCompile"
label="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseProcedureCompile.label"
singleton="false">
<task id="altibaseToolProcedureCompile"/>
</tool>
<tool
description="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibasePackageCompile.label"
group="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance"
icon="icons/compile.png"
id="org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibaseToolPackageCompile"
label="%tool.org.jkiss.dbeaver.ext.altibase.ui.tools.maintenance.AltibasePackageCompile.label"
singleton="false">
<task id="altibaseToolPackageCompile"/>
</tool>
</tools>
</extension>

</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected AltibaseProcedureStandAlone runTask() {
procedure.setProcedureType(procedureType);

procedure.setObjectDefinitionText(
"CREATE OR REPLACE " + procedureType.name() + " " + procedureName +
(procedureType == DBSProcedureType.FUNCTION ? "() RETURN NUMBER" : "") + GeneralUtils.getDefaultLineSeparator() +
"CREATE OR REPLACE " + procedureType.name() + " " + procedureName +
(procedureType == DBSProcedureType.FUNCTION ? "() RETURN NUMBER" : "") + GeneralUtils.getDefaultLineSeparator() +
"IS" + GeneralUtils.getDefaultLineSeparator() +
"BEGIN" + GeneralUtils.getDefaultLineSeparator() +
(procedureType == DBSProcedureType.FUNCTION ? "\tRETURN 1;" : "") +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected Control createPageContents(Composite parent) {
name = nameText.getText().trim();
updatePageState();
});

propsGroup.setTabList(ArrayUtils.remove(Control.class, propsGroup.getTabList(), containerText));

return propsGroup;
Expand Down
41 changes: 21 additions & 20 deletions plugins/org.jkiss.dbeaver.ext.altibase/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.ext.altibase;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Release-Date: 20231117
Require-Bundle: org.eclipse.core.runtime,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.ext.generic,
org.jkiss.dbeaver.data.gis,
org.jkiss.dbeaver.model.sql,
com.google.gson
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Vendor: %Bundle-Vendor
Bundle-ClassPath: .
Automatic-Module-Name: org.jkiss.dbeaver.ext.altibase
Export-Package: org.jkiss.dbeaver.ext.altibase,
org.jkiss.dbeaver.ext.altibase.model,
org.jkiss.dbeaver.ext.altibase.model.session
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.ext.altibase;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Release-Date: 20231117
Require-Bundle: org.eclipse.core.runtime,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.ext.generic,
org.jkiss.dbeaver.data.gis,
org.jkiss.dbeaver.model.sql,
com.google.gson,
org.jkiss.dbeaver.tasks.native
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Vendor: %Bundle-Vendor
Bundle-ClassPath: .
Automatic-Module-Name: org.jkiss.dbeaver.ext.altibase
Export-Package: org.jkiss.dbeaver.ext.altibase,
org.jkiss.dbeaver.ext.altibase.model,
org.jkiss.dbeaver.ext.altibase.model.session
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

Bundle-Name = DBeaver Altibase Support

Bundle-Vendor = Altibase

meta.org.jkiss.dbeaver.ext.altibase.model.AltibaseConstraint.checkConstraintDefinition.name = Condition
Expand Down Expand Up @@ -285,3 +283,18 @@ tree.uni_keys.node.name = Keys
tree.uni_keys.node.tip = Table keys
tree.user.node.name = User
tree.users.node.name = Users

org.jkiss.dbeaver.task.category.altibase.description = Altibase database task
org.jkiss.dbeaver.task.category.altibaseTool.description = Altibase database tools
org.jkiss.dbeaver.task.category.altibaseTool.name = Tools

tasks.mview.refresh.node.description = Refresh materialized view(s)
tasks.mview.refresh.node.name = Refresh materialized view
tasks.package.compile.node.description= Compile package(s)
tasks.package.compile.node.name = Compile package
tasks.procedure.compile.node.description= Compile procedure(s)/function(s)
tasks.procedure.compile.node.name = Compile procedure/function
tasks.table.truncate.node.description = Truncate table(s)
tasks.table.truncate.node.name = Truncate table
tasks.view.compile.node.description = Compile view(s)
tasks.view.compile.node.name = Compile view
35 changes: 35 additions & 0 deletions plugins/org.jkiss.dbeaver.ext.altibase/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,5 +318,40 @@
<dialect id="altibase" parent="basic" class="org.jkiss.dbeaver.ext.altibase.model.AltibaseSQLDialect" label="Altibase" description="Altibase SQL dialect." icon="icons/altibase_icon.png">
</dialect>
</extension>

<extension point="org.jkiss.dbeaver.task">
<category id="altibase" name="Altibase" description="%org.jkiss.dbeaver.task.category.altibase.description" icon="icons/altibase_icon.png"/>
<category id="altibaseTool" parent="altibase"
name="Tools"
description="%org.jkiss.dbeaver.task.category.altibaseTool.description"
icon="icons/altibase_icon.png"/>

<!-- SQL tools -->
<task id="altibaseToolTableTruncate" name="%tasks.table.truncate.node.name" description="%tasks.table.truncate.node.description"
type="altibaseTool" handler="org.jkiss.dbeaver.ext.altibase.tasks.AltibaseToolTableTruncate">
<datasource id="altibase"/>
<objectType name="org.jkiss.dbeaver.ext.altibase.model.AltibaseTable"/>
</task>
<task id="altibaseToolMViewRefresh" name="%tasks.mview.refresh.node.name" description="%tasks.mview.refresh.node.description"
type="altibaseTool" handler="org.jkiss.dbeaver.ext.altibase.tasks.AltibaseToolMViewRefresh">
<datasource id="altibase"/>
<objectType name="org.jkiss.dbeaver.ext.altibase.model.AltibaseMaterializedView"/>
</task>
<task id="altibaseToolViewCompile" name="%tasks.view.compile.node.name" description="%tasks.view.compile.node.description"
type="altibaseTool" handler="org.jkiss.dbeaver.ext.altibase.tasks.AltibaseToolViewCompile">
<datasource id="altibase"/>
<objectType name="org.jkiss.dbeaver.ext.altibase.model.AltibaseView"/>
</task>
<task id="altibaseToolProcedureCompile" name="%tasks.procedure.compile.node.name" description="%tasks.procedure.compile.node.description"
type="altibaseTool" handler="org.jkiss.dbeaver.ext.altibase.tasks.AltibaseToolProcedureCompile">
<datasource id="altibase"/>
<objectType name="org.jkiss.dbeaver.ext.altibase.model.AltibaseProcedureStandAlone"/>
</task>
<task id="altibaseToolPackageCompile" name="%tasks.package.compile.node.name" description="%tasks.package.compile.node.description"
type="altibaseTool" handler="org.jkiss.dbeaver.ext.altibase.tasks.AltibaseToolPackageCompile">
<datasource id="altibase"/>
<objectType name="org.jkiss.dbeaver.ext.altibase.model.AltibasePackage"/>
</task>
</extension>

</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ public static ExplainPlan getByIndex(int idx) throws ArrayIndexOutOfBoundsExcept
public static final String RESULT_Y_VALUE = "Y";
public static final String RESULT_1_VALUE = "1";

/*
* PSM Type: SYS_PROCEDURES_ (OBJECT_TYPE)
*/
public static final int PSM_TYPE_PROCEDURE = 0;
public static final int PSM_TYPE_FUNCTION = 1;
public static final int PSM_TYPE_TYPESET = 3;

/*
* V$PROPERTY attributes
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ protected GenericProcedure createDatabaseObject(
Object from, Map<String, Object> options) {
return new AltibaseTypeset(
(GenericStructContainer) container,
"NEW_TYPESET");
"NEW_TYPESET",
true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ public DBSObject findSynonymTargetObject(DBRProgressMonitor monitor, @Nullable S
throws DBException {
DBSObject refObj = null;
AltibaseSchema refSchema = (AltibaseSchema) this.getSchema(refSchemaName);

if (refSchema != null)
{

if (refSchema != null) {
// No object type from database metadata, so need to find it one by one.
if (refObj == null) {
refObj = refSchema.getTable(monitor, refObjName);
Expand All @@ -255,7 +254,7 @@ public DBSObject findSynonymTargetObject(DBRProgressMonitor monitor, @Nullable S
refObj = refSchema.getTableTrigger(monitor, refObjName);
}
} else {
/**
/*
* Though Public synonym does not have its own schema, but SYSTEM_.SYS_SYONYMS_.OBJECT_OWNER_NAME returns
* the object creator as owner like Oracle.
* So, first look for it in the owner's private schema, and if it is not found, then try to find it at public schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package org.jkiss.dbeaver.ext.altibase.model;

import org.jkiss.dbeaver.ext.generic.model.GenericStructContainer;
import org.jkiss.dbeaver.ext.generic.model.GenericView;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;

public class AltibaseMaterializedView extends GenericView {
public class AltibaseMaterializedView extends AltibaseViewAbs {

public AltibaseMaterializedView(GenericStructContainer container, String tableName, String tableType,
public AltibaseMaterializedView(JDBCSession session, GenericStructContainer container, String tableName, String tableType,
JDBCResultSet dbResult) {
super(container, tableName, tableType, dbResult);
super(session, container, tableName, tableType, dbResult);
}
}
Loading
Loading