提交 6ee6b799 编写于 作者: C Charly

First Working Exasol Release


Former-commit-id: 62c3152a
上级 1c1841a1
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.jkiss.dbeaver.ext.exasol.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
bin.includes = feature.xml,\
feature.properties
featureName=DBeaver Exasol Extension
providerName=Karl Griesser
description=DBeaver Exasol Extension
copyright=2016, Karl Griesser
license=\
GNU GENERAL PUBLIC LICENSE\n\
Version 2, June 1991\n\
\n\
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n\
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n\
Everyone is permitted to copy and distribute verbatim copies\n\
of this license document, but changing it is not allowed.\n\
\n\
Preamble\n\
\n\
The licenses for most software are designed to take away your\n\
freedom to share and change it. By contrast, the GNU General Public\n\
License is intended to guarantee your freedom to share and change free\n\
software--to make sure the software is free for all its users. This\n\
General Public License applies to most of the Free Software\n\
Foundation's software and to any other program whose authors commit to\n\
using it. (Some other Free Software Foundation software is covered by\n\
the GNU Lesser General Public License instead.) You can apply it to\n\
your programs, too.\n\
\n\
When we speak of free software, we are referring to freedom, not\n\
price. Our General Public Licenses are designed to make sure that you\n\
have the freedom to distribute copies of free software (and charge for\n\
this service if you wish), that you receive source code or can get it\n\
if you want it, that you can change the software or use pieces of it\n\
in new free programs; and that you know you can do these things.\n\
\n\
To protect your rights, we need to make restrictions that forbid\n\
anyone to deny you these rights or to ask you to surrender the rights.\n\
These restrictions translate to certain responsibilities for you if you\n\
distribute copies of the software, or if you modify it.\n\
\n\
For example, if you distribute copies of such a program, whether\n\
gratis or for a fee, you must give the recipients all the rights that\n\
you have. You must make sure that they, too, receive or can get the\n\
source code. And you must show them these terms so they know their\n\
rights.\n\
\n\
We protect your rights with two steps: (1) copyright the software, and\n\
(2) offer you this license which gives you legal permission to copy,\n\
distribute and/or modify the software.\n\
\n\
Also, for each author's protection and ours, we want to make certain\n\
that everyone understands that there is no warranty for this free\n\
software. If the software is modified by someone else and passed on, we\n\
want its recipients to know that what they have is not the original, so\n\
that any problems introduced by others will not reflect on the original\n\
authors' reputations.\n\
\n\
Finally, any free program is threatened constantly by software\n\
patents. We wish to avoid the danger that redistributors of a free\n\
program will individually obtain patent licenses, in effect making the\n\
program proprietary. To prevent this, we have made it clear that any\n\
patent must be licensed for everyone's free use or not licensed at all.\n\
\n\
The precise terms and conditions for copying, distribution and\n\
modification follow.\n\
\n\
GNU GENERAL PUBLIC LICENSE\n\
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\
\n\
0. This License applies to any program or other work which contains\n\
a notice placed by the copyright holder saying it may be distributed\n\
under the terms of this General Public License. The "Program", below,\n\
refers to any such program or work, and a "work based on the Program"\n\
means either the Program or any derivative work under copyright law:\n\
that is to say, a work containing the Program or a portion of it,\n\
either verbatim or with modifications and/or translated into another\n\
language. (Hereinafter, translation is included without limitation in\n\
the term "modification".) Each licensee is addressed as "you".\n\
\n\
Activities other than copying, distribution and modification are not\n\
covered by this License; they are outside its scope. The act of\n\
running the Program is not restricted, and the output from the Program\n\
is covered only if its contents constitute a work based on the\n\
Program (independent of having been made by running the Program).\n\
Whether that is true depends on what the Program does.\n\
\n\
1. You may copy and distribute verbatim copies of the Program's\n\
source code as you receive it, in any medium, provided that you\n\
conspicuously and appropriately publish on each copy an appropriate\n\
copyright notice and disclaimer of warranty; keep intact all the\n\
notices that refer to this License and to the absence of any warranty;\n\
and give any other recipients of the Program a copy of this License\n\
along with the Program.\n\
\n\
You may charge a fee for the physical act of transferring a copy, and\n\
you may at your option offer warranty protection in exchange for a fee.\n\
\n\
2. You may modify your copy or copies of the Program or any portion\n\
of it, thus forming a work based on the Program, and copy and\n\
distribute such modifications or work under the terms of Section 1\n\
above, provided that you also meet all of these conditions:\n\
\n\
a) You must cause the modified files to carry prominent notices\n\
stating that you changed the files and the date of any change.\n\
\n\
b) You must cause any work that you distribute or publish, that in\n\
whole or in part contains or is derived from the Program or any\n\
part thereof, to be licensed as a whole at no charge to all third\n\
parties under the terms of this License.\n\
\n\
c) If the modified program normally reads commands interactively\n\
when run, you must cause it, when started running for such\n\
interactive use in the most ordinary way, to print or display an\n\
announcement including an appropriate copyright notice and a\n\
notice that there is no warranty (or else, saying that you provide\n\
a warranty) and that users may redistribute the program under\n\
these conditions, and telling the user how to view a copy of this\n\
License. (Exception: if the Program itself is interactive but\n\
does not normally print such an announcement, your work based on\n\
the Program is not required to print an announcement.)\n\
\n\
These requirements apply to the modified work as a whole. If\n\
identifiable sections of that work are not derived from the Program,\n\
and can be reasonably considered independent and separate works in\n\
themselves, then this License, and its terms, do not apply to those\n\
sections when you distribute them as separate works. But when you\n\
distribute the same sections as part of a whole which is a work based\n\
on the Program, the distribution of the whole must be on the terms of\n\
this License, whose permissions for other licensees extend to the\n\
entire whole, and thus to each and every part regardless of who wrote it.\n\
\n\
Thus, it is not the intent of this section to claim rights or contest\n\
your rights to work written entirely by you; rather, the intent is to\n\
exercise the right to control the distribution of derivative or\n\
collective works based on the Program.\n\
\n\
In addition, mere aggregation of another work not based on the Program\n\
with the Program (or with a work based on the Program) on a volume of\n\
a storage or distribution medium does not bring the other work under\n\
the scope of this License.\n\
\n\
3. You may copy and distribute the Program (or a work based on it,\n\
under Section 2) in object code or executable form under the terms of\n\
Sections 1 and 2 above provided that you also do one of the following:\n\
\n\
a) Accompany it with the complete corresponding machine-readable\n\
source code, which must be distributed under the terms of Sections\n\
1 and 2 above on a medium customarily used for software interchange; or,\n\
\n\
b) Accompany it with a written offer, valid for at least three\n\
years, to give any third party, for a charge no more than your\n\
cost of physically performing source distribution, a complete\n\
machine-readable copy of the corresponding source code, to be\n\
distributed under the terms of Sections 1 and 2 above on a medium\n\
customarily used for software interchange; or,\n\
\n\
c) Accompany it with the information you received as to the offer\n\
to distribute corresponding source code. (This alternative is\n\
allowed only for noncommercial distribution and only if you\n\
received the program in object code or executable form with such\n\
an offer, in accord with Subsection b above.)\n\
\n\
The source code for a work means the preferred form of the work for\n\
making modifications to it. For an executable work, complete source\n\
code means all the source code for all modules it contains, plus any\n\
associated interface definition files, plus the scripts used to\n\
control compilation and installation of the executable. However, as a\n\
special exception, the source code distributed need not include\n\
anything that is normally distributed (in either source or binary\n\
form) with the major components (compiler, kernel, and so on) of the\n\
operating system on which the executable runs, unless that component\n\
itself accompanies the executable.\n\
\n\
If distribution of executable or object code is made by offering\n\
access to copy from a designated place, then offering equivalent\n\
access to copy the source code from the same place counts as\n\
distribution of the source code, even though third parties are not\n\
compelled to copy the source along with the object code.\n\
\n\
4. You may not copy, modify, sublicense, or distribute the Program\n\
except as expressly provided under this License. Any attempt\n\
otherwise to copy, modify, sublicense or distribute the Program is\n\
void, and will automatically terminate your rights under this License.\n\
However, parties who have received copies, or rights, from you under\n\
this License will not have their licenses terminated so long as such\n\
parties remain in full compliance.\n\
\n\
5. You are not required to accept this License, since you have not\n\
signed it. However, nothing else grants you permission to modify or\n\
distribute the Program or its derivative works. These actions are\n\
prohibited by law if you do not accept this License. Therefore, by\n\
modifying or distributing the Program (or any work based on the\n\
Program), you indicate your acceptance of this License to do so, and\n\
all its terms and conditions for copying, distributing or modifying\n\
the Program or works based on it.\n\
\n\
6. Each time you redistribute the Program (or any work based on the\n\
Program), the recipient automatically receives a license from the\n\
original licensor to copy, distribute or modify the Program subject to\n\
these terms and conditions. You may not impose any further\n\
restrictions on the recipients' exercise of the rights granted herein.\n\
You are not responsible for enforcing compliance by third parties to\n\
this License.\n\
\n\
7. If, as a consequence of a court judgment or allegation of patent\n\
infringement or for any other reason (not limited to patent issues),\n\
conditions are imposed on you (whether by court order, agreement or\n\
otherwise) that contradict the conditions of this License, they do not\n\
excuse you from the conditions of this License. If you cannot\n\
distribute so as to satisfy simultaneously your obligations under this\n\
License and any other pertinent obligations, then as a consequence you\n\
may not distribute the Program at all. For example, if a patent\n\
license would not permit royalty-free redistribution of the Program by\n\
all those who receive copies directly or indirectly through you, then\n\
the only way you could satisfy both it and this License would be to\n\
refrain entirely from distribution of the Program.\n\
\n\
If any portion of this section is held invalid or unenforceable under\n\
any particular circumstance, the balance of the section is intended to\n\
apply and the section as a whole is intended to apply in other\n\
circumstances.\n\
\n\
It is not the purpose of this section to induce you to infringe any\n\
patents or other property right claims or to contest validity of any\n\
such claims; this section has the sole purpose of protecting the\n\
integrity of the free software distribution system, which is\n\
implemented by public license practices. Many people have made\n\
generous contributions to the wide range of software distributed\n\
through that system in reliance on consistent application of that\n\
system; it is up to the author/donor to decide if he or she is willing\n\
to distribute software through any other system and a licensee cannot\n\
impose that choice.\n\
\n\
This section is intended to make thoroughly clear what is believed to\n\
be a consequence of the rest of this License.\n\
\n\
8. If the distribution and/or use of the Program is restricted in\n\
certain countries either by patents or by copyrighted interfaces, the\n\
original copyright holder who places the Program under this License\n\
may add an explicit geographical distribution limitation excluding\n\
those countries, so that distribution is permitted only in or among\n\
countries not thus excluded. In such case, this License incorporates\n\
the limitation as if written in the body of this License.\n\
\n\
9. The Free Software Foundation may publish revised and/or new versions\n\
of the General Public License from time to time. Such new versions will\n\
be similar in spirit to the present version, but may differ in detail to\n\
address new problems or concerns.\n\
\n\
Each version is given a distinguishing version number. If the Program\n\
specifies a version number of this License which applies to it and "any\n\
later version", you have the option of following the terms and conditions\n\
either of that version or of any later version published by the Free\n\
Software Foundation. If the Program does not specify a version number of\n\
this License, you may choose any version ever published by the Free Software\n\
Foundation.\n\
\n\
10. If you wish to incorporate parts of the Program into other free\n\
programs whose distribution conditions are different, write to the author\n\
to ask for permission. For software which is copyrighted by the Free\n\
Software Foundation, write to the Free Software Foundation; we sometimes\n\
make exceptions for this. Our decision will be guided by the two goals\n\
of preserving the free status of all derivatives of our free software and\n\
of promoting the sharing and reuse of software generally.\n\
\n\
NO WARRANTY\n\
\n\
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n\
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n\
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n\
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n\
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n\
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n\
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n\
REPAIR OR CORRECTION.\n\
\n\
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n\
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n\
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n\
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n\
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n\
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n\
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n\
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n\
POSSIBILITY OF SUCH DAMAGES.\n\
\n\
END OF TERMS AND CONDITIONS
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.jkiss.dbeaver.ext.exasol.feature"
label="%featureName"
version="2.1.27"
provider-name="%providerName"
plugin="org.jkiss.dbeaver.ext.exasol">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<requires>
<import feature="org.jkiss.dbeaver.core.feature" version="1.0.0"/>
</requires>
<plugin
id="org.jkiss.dbeaver.ext.exasol"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.jkiss.dbeaver.ext.exasol</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Exasol Plug-in
Bundle-SymbolicName: org.jkiss.dbeaver.ext.exasol;singleton:=true
Bundle-Version: 0.0.1
Bundle-Activator: org.jkiss.dbeaver.ext.exasol.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.views,
org.eclipse.jface,
org.eclipse.jface.text,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.core,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.editors
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: JKISS
Bundle-ClassPath: .
Bundle-Localization: plugin
Import-Package: org.jkiss.dbeaver.ui.editors
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
plugin.xml,\
icons/
# DBeaver - Universal Database Manager
# Copyright (C) 2013-2016 Denis Forveille titou10.titou10@gmail.com
# Copyright (C) 2010-2016 Serge Rieder serge@jkiss.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2)
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
category.exasol.description=Exasol Tools
category.exasol.name=Exasol
tool.org.jkiss.dbeaver.ext.exasol.database.reorg.name=Reorganize Database...
tool.org.jkiss.dbeaver.ext.exasol.table.reorg.name=Reorg Table...
tool.org.jkiss.dbeaver.ext.exasol.table.reorgcheck.name=Reorg Check (Table)...
tool.org.jkiss.dbeaver.ext.exasol.table.reorgcheckix.name=Reorg Check (Indexes)...
tool.org.jkiss.dbeaver.ext.exasol.table.setintegrity.name=Set Integrity...
tool.org.jkiss.dbeaver.ext.exasol.table.runstats.name=Runstats...
tool.org.jkiss.dbeaver.ext.exasol.table.truncate.name=Truncate...
dialog.connection.header=Exasol Connection Settings
editor.source.declaration.name=Source
editor.source.declaration.description=Source
editor.source.ddl.name=DDL
editor.source.ddl.description=DDL
menu.tables.manage=Manage
tree.scripts.node.name=Scripts
tree.script.node.name=Script
tree.tables.node.name=Tables
tree.table.node.name=Table
tree.administer.node.name=Administer
tree.check_constraint_columns.node.name=Columns
tree.column.node.name=Column
tree.columns.node.name=Columns
tree.constraint.node.name=Unique Constraint
tree.constraint_columns.node.name=Constraint Columns
tree.constraints.node.name=Unique Constraints
tree.container.node.name=Container
tree.containers.node.name=Containers
tree.databaseauth.node.name=Database Authority
tree.foreign_key_columns.node.name=Foreign Key Columns
tree.foreign_key.node.name=Foreign Key
tree.foreign_keys.node.name=Foreign Keys
tree.function.node.name=Function
tree.functions.node.name=Functions
tree.functionsauths.node.name=Functions Privileges
tree.global_metadata.node.name=Global metadata
tree.procedure.node.name=Procedure
tree.procedures.node.name=Procedures
tree.proceduresauths.node.name=Procedures Privileges
tree.reference_key.node.name=Reference
tree.references.node.name=References
tree.remoteserver.node.name=Remote Server
tree.remoteservers.node.name=Remote Servers
tree.role.node.name=Role
tree.roleauth.node.name=Authorization
tree.roleauths.node.name=Authorizations
tree.roles.node.name=Roles
tree.schema.node.name=Schema
tree.schemas.node.name=Schemas
tree.schemasauths.node.name=Schemas Privileges
tree.userauth.node.name=Authorization
tree.userauths.node.name=Authorizations
tree.users.node.name=Users
tree.user.node.name=User
tree.view.node.name=View
tree.viewdep.node.name=Dependency
tree.viewdeps.node.name=Dependencies
tree.views.node.name=Views
tree.viewsauths.node.name=Views Privileges
tree.system_info.node.name=System information
tree.sessions.node.name=Sessions
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.name.name = Script Name
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.language.name = Programming Language
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.type.name = Script Type (Scalar, Set, Null)
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.schema.name Script Schema
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.resultType.name = Result type of the Script
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.description.name = Description
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolScript.createTime.name = Creation Time
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolSchema.name.name = Schema Name
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolSchema.owner.name = Owner of the Schema
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolSchema.createTime.name = Creation Time
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolSchema.description.name = Description
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolSchema.sql.name = Create SQL
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.dataType.name=Type
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.stringLength.name=String Length
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.keyseq.name=Key Sequence
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.isDistKey.name=Is Part of the Distribution Key
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.status.name=Status
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.description.name=Description
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.owner.name=Table
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.identityValue.name=Current Value of Identity Col
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.owner.name=Owner
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.name.name=Name
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.schema.name=Schema
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.compressedsize.name=Compressed Size
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.createTime.name=Table Creation Time
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.rawsize.name=Raw uncompressed Size
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase.deletePercentage.name=Percentage of deleted Rows
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.keySeq.name=Primary Key Seq
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.identity.name=Identity Value
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolUser.name.name=User Name
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolUser.description.name=User Description
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolView.owner.name=View Owner
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolView.text.name=SQL Definition
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.hasDistKey.name = Has Distribution Key
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.lastCommit.name = Last Commit Timestamp
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.rawsize.name = Raw Size
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.createTime.name = Created at
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.compressedsize.name = Compressed Size
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTable.deletePercentage.name = Delete Percentage
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableUniqueKey.owner.name = PK Owner
meta.org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraint.description.name = PK Description
meta.org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraint.constraintType.name = Type
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableUniqueKey.enabled.name = Is Enabled
meta.org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraint.description.name = Description
meta.org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraint.constraintType.name = Name
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.attribute.name = Column Name
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.ordinalPosition.name = Position
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey.referencedConstraint.name = Referenced Constraint
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey.referencedTable.name = Referenced Table
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey.enabled.name = Is Enabled
meta.org.jkiss.dbeaver.model.struct.rdb.DBSTableConstraintColumn.ordinalPosition.name = Position
meta.org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn.distKey.name = Is Part of Distribution Key
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.stmtId.name = Statement Id
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.commandClass.name = Command Class
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.partInfo.name = Part Info
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.objectSchema.name = Object Schema
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.objectRows.name = Object Name
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.outRows.name = Output Rows
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.cpu.name = CPU %
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.netTransfer.name = Net Transfer MB/s
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.detailInfo.name = Detail Info
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.hddWrite.name = HDD Write MB/s
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.duration.name = Duration in S
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.commandName.name = Command Name
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.partId.name = Part Id
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.partName.name = Part Name
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.objectName.name = Object Name
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.hddRead.name = HDD Read MB/s
meta.org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanNode.tempDbRamPeak.name = Temp DB Ram Peak MB
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.resources.name = Res %
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.priority.name = Priority
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.host.name = Hostname
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.queryTimeout.name = Query Timeout
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.status.name = Status
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.driver.name = Driver
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.userName.name = User Name
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.commandName.name = Command Name
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.duration.name = Duration
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.activity.name = Activity
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.client.name = Client Name
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.osUser.name = OS User
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.sqlText.name = SQL Text
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.nice.name = Nice Value
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.scopeSchema.name = Schema
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.loginTime.name = Login Time
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.stmtId.name = Stmt ID
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.tempDbRam.name = Temp Db Ram
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.encrypted.name = Encrypted
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.osName.name = OS Name
meta.org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession.sessionID.name = Session ID
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.jkiss.dbeaver.dataSourceProvider">
<datasource
class="org.jkiss.dbeaver.ext.exasol.ExasolDataSourceProvider"
description="Exasol Connector"
icon="icons/Exasol_icon.png"
id="exasol"
label="Exasol">
<tree
icon="icons/exasol_icon.png"
label="Exasol data source"
path="exasol">
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolSchema" label="%tree.schemas.node.name" icon="#folder_schemas" description="Schemas">
<items label="%tree.schema.node.name" path="schema" property="schemas" icon="#schema">
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolTable" label="%tree.tables.node.name" icon="#folder_table" description="Tables">
<items label="%tree.table.node.name" path="table" property="tables" icon="#table">
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn" label="%tree.columns.node.name" icon="#columns" description="Table columns">
<items label="%tree.column.node.name" path="attribute" property="attributes" icon="#column">
</items>
</folder>
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolTableUniqueKey" label="%tree.constraints.node.name" icon="#constraints" description="Table constraints">
<items label="%tree.constraint.node.name" path="constraint" property="constraints" icon="#unique-key">
<items label="%tree.constraint_columns.node.name" path="column" property="attributeReferences" navigable="false" inline="true">
</items>
</items>
</folder>
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey" label="%tree.foreign_keys.node.name" icon="#foreign-keys" description="Table foreign keys">
<items label="%tree.foreign_key.node.name" path="association" property="associations" icon="#foreign-key">
<items label="%tree.foreign_key_columns.node.name" itemLabel="%tree.column.node.name" path="column" property="attributeReferences" navigable="false" inline="true">
</items>
</items>
</folder>
</items>
</folder>
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolView" label="%tree.views.node.name" icon="#folder_view" description="Views">
<items label="%tree.view.node.name" path="view" property="views" icon="#view">
<items label="%tree.columns.node.name" itemLabel="%tree.column.node.name" path="column" property="attributes" icon="#column">
</items>
</items>
</folder>
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolScript" label="%tree.scripts.node.name" icon="#procedures" description="Scripts">
<items label="%tree.script.node.name" path="script" property="procedures" icon="#procedure">
<items label="Parameters" itemLabel="%tree.column.node.name" path="column" property="parameters" navigable="false" inline="true">
</items>
</items>
</folder>
</items>
</folder>
<folder type="org.jkiss.dbeaver.ext.exasol.model.ExasolUser" label="%tree.users.node.name" icon="#folder_user" description="Users">
<items label="%tree.user.node.name" path="user" property="users" icon="#user"/>
</folder>
<folder type="" label="%tree.administer.node.name" icon="#folder_admin" description="Maintenance/Settings">
<object type="org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession"
label="%tree.sessions.node.name"
icon="#admin"
description="Server Session manager"
editor="org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSessionEditor"
/>
</folder>
</tree>
<drivers managable="true">
<driver
id="exasol"
label="Exasol"
class="com.exasol.jdbc.EXADriver"
sampleURL="jdbc:exa:{host}[:{port}][;schema={database}]"
defaultPort="8563"
description="Exasol JDBC driver"
webURL="https://www.exasol.com/portal/display/DOWNLOAD/5.0">
<property name="querytimeout" value="600"/>
<property name="clientname" value="DBeaver"/>
<property name="connecttimeout" value="40" />
<property name="@dbeaver-default-dataformat.type.timestamp.pattern" value="yyyy-MM-dd-HH.mm.ss.ffffff"/>
<library path="C:\Program Files (x86)\EXASOL\EXASolution-5.0\JDBC\exajdbc.jar"/>
<fileSource url="https://www.exasol.com/portal/display/DOWNLOAD/5.0"
name="Exasol JDBC Drivers"
instruction="Download Exasol JDBC (JCC) client driver. Extract downloaded archive and copy exajdbc.jar in some directory. Then add exajdbc.jar as a library in DBeaver driver editor dialog.">
<file name="exajdbc.jar" description="JDBC driver"/>
</fileSource>
</driver>
</drivers>
<views>
<view
id="org.jkiss.dbeaver.ext.exasol.dataSourceWizardView"
targetID="org.jkiss.dbeaver.ext.ui.newConnectionWizard"
label="%dialog.connection.header"
class="org.jkiss.dbeaver.ext.exasol.views.ExasolConnectionPage"
icon="icons/Exasol_icon.png">
</view>
<view
id="org.jkiss.dbeaver.ext.exasol.dataSourceEditorView"
targetID="org.jkiss.dbeaver.ext.ui.editConnectionDialog"
label="%dialog.connection.header"
class="org.jkiss.dbeaver.ext.exasol.views.ExasolConnectionPage">
</view>
</views>
</datasource>
</extension>
<extension
point="org.jkiss.dbeaver.databaseEditor">
<editor id="source.declaration"
class="org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer"
label="%editor.source.declaration.name"
description="%editor.source.declaration.description"
icon="#sql_text"
position="additions_middle"
contributor="org.jkiss.dbeaver.ui.editors.sql.SQLEditorContributorNested"
type="folder"
embeddable="true">
<objectType
name="org.jkiss.dbeaver.ext.exasol.model.ExasolScript">
</objectType>
</editor>
<editor
class="org.jkiss.dbeaver.ui.editors.sql.SQLSourceViewer"
contributor="org.jkiss.dbeaver.ui.editors.sql.SQLEditorContributorNested"
description="%editor.source.ddl.description"
icon="#sql_text"
id="source.ddl"
label="%editor.source.ddl.name"
position="additions_middle"
type="folder">
</editor>
<manager
class="org.jkiss.dbeaver.ext.exasol.manager.ExasolTableManager"
objectType="org.jkiss.dbeaver.ext.exasol.model.ExasolTable">
</manager>
<manager
class="org.jkiss.dbeaver.ext.exasol.manager.ExasolTableColumnManager"
objectType="org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn">
</manager>
</extension>
<extension point="org.eclipse.ui.editors">
<editor
name="Application Manager"
icon="icons/compile.png"
class="org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSessionEditor"
id="org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSessionEditor">
</editor>
</extension>
</plugin>
package org.jkiss.dbeaver.ext.exasol;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jkiss.dbeaver.ext.exasol";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/**
* Returns an image descriptor for the image file at the given plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path)
{
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.data.DBDPseudoAttribute;
import org.jkiss.dbeaver.model.data.DBDPseudoAttributeType;
/**
* Exasol constants
*
* @author Karl Griesser
*
*/
public class ExasolConstants {
// Display Categories
public static final String CAT_AUTH = "Authorities";
public static final String CAT_BASEOBJECT = "Base Object";
public static final String CAT_DATETIME = "Date & Time";
public static final String CAT_OWNER = "Owner";
public static final String CAT_SOURCE = "Source";
public static final String CAT_PERFORMANCE = "Performance";
public static final String CAT_STATS = "Statistics";
public static final String DRV_CLIENT_NAME = "clientname";
public static final String DRV_CLIENT_VERSION = "clientversion";
public static final String DRV_QUERYTIMEOUT = "querytimeout";
public static final String DRV_CONNECT_TIMEOUT = "connecttimeout";
public static final String DRV_ENCRYPT = DBConstants.INTERNAL_PROP_PREFIX + "encrypt";
public static final String DRV_BACKUP_HOST_LIST = DBConstants.INTERNAL_PROP_PREFIX + "backupHostList";
public static final String DRV_USE_BACKUP_HOST_LIST = DBConstants.INTERNAL_PROP_PREFIX + "useBackupHostList";
public static final DBDPseudoAttribute PSEUDO_ATTR_RID_BIT = new DBDPseudoAttribute(DBDPseudoAttributeType.ROWID,
"ROWID", "ROWID", "row_id", "Unique physical row identifier", true);
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.exasol;
import java.util.HashMap;
import java.util.Map;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSourceProvider;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.utils.CommonUtils;
/**
* Exasol DataSource provider ddd
*/
public class ExasolDataSourceProvider extends JDBCDataSourceProvider {
private static Map<String, String> connectionsProps = new HashMap<>();
// ------------
// Constructors
// ------------
public ExasolDataSourceProvider()
{
}
public static Map<String, String> getConnectionsProps()
{
return connectionsProps;
}
@Override
protected String getConnectionPropertyDefaultValue(String name, String value)
{
String ovrValue = connectionsProps.get(name);
return ovrValue != null ? ovrValue : super.getConnectionPropertyDefaultValue(name, value);
}
@Override
public long getFeatures()
{
return FEATURE_SCHEMAS;
}
@Override
public String getConnectionURL(DBPDriver driver, DBPConnectionConfiguration connectionInfo)
{
//Default Port
String port = ":8563";
if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
port = ":" + connectionInfo.getHostPort();
}
Map<Object, Object> properties = connectionInfo.getProperties();
StringBuilder url = new StringBuilder(128);
url.append("jdbc:exa:").append(connectionInfo.getHostName()).append(port);
//check if we got an backup host list
Object backupHostList = properties.get(ExasolConstants.DRV_BACKUP_HOST_LIST);
if (backupHostList != null)
url.append(",").append(backupHostList).append(port);
if (! url.toString().toUpperCase().contains("CLIENTNAME"))
{
String clientName = "DBeaver";
Object propClientName = properties.get(ExasolConstants.DRV_CLIENT_NAME);
if (propClientName != null)
clientName = propClientName.toString();
url.append(";clientname=" + clientName);
}
Object querytimeout = properties.get(ExasolConstants.DRV_QUERYTIMEOUT);
if (querytimeout != null)
url.append(";").append(ExasolConstants.DRV_QUERYTIMEOUT).append("=").append(querytimeout);
Object connecttimeout = properties.get(ExasolConstants.DRV_CONNECT_TIMEOUT);
if (connecttimeout != null)
url.append(";").append(ExasolConstants.DRV_CONNECT_TIMEOUT).append("=").append(connecttimeout);
return url.toString();
}
@NotNull
@Override
public DBPDataSource openDataSource(@NotNull DBRProgressMonitor monitor, @NotNull DBPDataSourceContainer container)
throws DBException
{
return new ExasolDataSource(monitor, container);
}
}
package org.jkiss.dbeaver.ext.exasol;
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
* Copyright (C) 2011-2012 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import org.eclipse.osgi.util.NLS;
public class ExasolMessages extends NLS {
static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.exasol.ExasolResources"; //$NON-NLS-1$
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, ExasolMessages.class);
}
private ExasolMessages() {
}
public static String editors_exasol_session_editor_title_kill_session ;
public static String editors_exasol_session_editor_action_kill ;
public static String editors_exasol_session_editor_confirm_action ;
public static String editors_exasol_session_editor_title_kill_session_statement ;
public static String editors_exasol_session_editor_action_kill_statement ;
public static String dialog_connection_advanced_tab;
public static String dialog_connection_advanced_tab_tooltip;
public static String dialog_connection_general_tab;
public static String dialog_connection_general_tab_tooltip;
public static String dialog_connection_host;
public static String dialog_connection_backup_host;
public static String dialog_connection_database;
public static String dialog_connection_password;
public static String dialog_connection_port;
public static String dialog_connection_test_connection;
public static String dialog_connection_user_name;
public static String edit_catalog_manager_dialog_schema_name;
public static String edit_command_change_user_action_create_new_user;
public static String edit_command_change_user_action_update_user_record;
public static String edit_command_change_user_name;
public static String edit_command_grant_privilege_action_grant_privilege;
public static String edit_command_grant_privilege_name_revoke_privilege;
public static String edit_constraint_manager_title;
public static String edit_foreign_key_manager_title;
public static String edit_index_manager_title;
public static String edit_procedure_manager_body;
public static String edit_user_manager_command_create_user;
public static String edit_user_manager_command_drop_user;
public static String edit_user_manager_command_flush_privileges;
public static String edit_view_manager_definition;
public static String editors_session_editor_action_kill_Session;
public static String editors_session_editor_action_terminate_Query;
public static String editors_session_editor_confirm;
public static String editors_user_editor_abstract_load_grants;
public static String editors_user_editor_general_control_dba_privileges;
public static String editors_user_editor_general_group_limits;
public static String editors_user_editor_general_group_login;
public static String editors_user_editor_general_label_confirm;
public static String editors_user_editor_general_label_host;
public static String editors_user_editor_general_label_password;
public static String editors_user_editor_general_label_user_name;
public static String editors_user_editor_general_service_load_catalog_privileges;
public static String editors_user_editor_general_spinner_max_connections;
public static String editors_user_editor_general_spinner_max_queries;
public static String editors_user_editor_general_spinner_max_updates;
public static String editors_user_editor_general_spinner_max_user_connections;
public static String editors_user_editor_privileges_column_catalog;
public static String editors_user_editor_privileges_column_table;
public static String editors_user_editor_privileges_control_other_privileges;
public static String editors_user_editor_privileges_control_table_privileges;
public static String editors_user_editor_privileges_group_catalogs;
public static String editors_user_editor_privileges_group_tables;
public static String editors_user_editor_privileges_service_load_privileges;
public static String editors_user_editor_privileges_service_load_tables;
public static String tools_db_export_wizard_job_dump_log_reader;
public static String tools_db_export_wizard_message_export_completed;
public static String tools_db_export_wizard_monitor_bytes;
public static String tools_db_export_wizard_monitor_export_db;
public static String tools_db_export_wizard_page_settings_checkbox_add_drop;
public static String tools_db_export_wizard_page_settings_checkbox_addnl_comments;
public static String tools_db_export_wizard_page_settings_checkbox_remove_definer;
public static String tools_db_export_wizard_page_settings_checkbox_binary_hex;
public static String tools_db_export_wizard_page_settings_checkbox_disable_keys;
public static String tools_db_export_wizard_page_settings_checkbox_dump_events;
public static String tools_db_export_wizard_page_settings_checkbox_ext_inserts;
public static String tools_db_export_wizard_page_settings_checkbox_no_create;
public static String tools_db_export_wizard_page_settings_combo_item_lock_tables;
public static String tools_db_export_wizard_page_settings_combo_item_normal;
public static String tools_db_export_wizard_page_settings_combo_item_online_backup;
public static String tools_db_export_wizard_page_settings_file_selector_title;
public static String tools_db_export_wizard_page_settings_group_exe_method;
public static String tools_db_export_wizard_page_settings_group_objects;
public static String tools_db_export_wizard_page_settings_group_output;
public static String tools_db_export_wizard_page_settings_group_settings;
public static String tools_db_export_wizard_page_settings_label_out_text;
public static String tools_db_export_wizard_page_settings_page_description;
public static String tools_db_export_wizard_page_settings_page_name;
public static String tools_db_export_wizard_task_name;
public static String tools_db_export_wizard_title;
public static String tools_script_execute_wizard_db_import;
public static String tools_script_execute_wizard_execute_script;
public static String tools_script_execute_wizard_page_settings_group_input;
public static String tools_script_execute_wizard_page_settings_group_settings;
public static String tools_script_execute_wizard_page_settings_import_configuration;
public static String tools_script_execute_wizard_page_settings_label_input_file;
public static String tools_script_execute_wizard_page_settings_label_log_level;
public static String tools_script_execute_wizard_page_settings_script_configuration;
public static String tools_script_execute_wizard_page_settings_set_db_import_settings;
public static String tools_script_execute_wizard_page_settings_set_script_execution_settings;
}
# DBeaver - Universal Database Manager
# Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
# Copyright (C) 2012 Eugene Fradkin (eugene.fradkin@gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2)
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
dialog_connection_browse_button=Browse ...
dialog_connection_database_schema_label=Database/Schema:
dialog_connection_db_file_chooser_text=Choose database file
dialog_connection_db_folder_chooser_message=Choose folder with database files
dialog_connection_db_folder_chooser_text=Choose database folder
dialog_connection_edit_driver_button=Edit Driver Settings
dialog_connection_general_tab=General
dialog_connection_general_tab_tooltip=General connection properties
dialog_connection_host_label=Host(s):
dialog_connection_jdbc_url_=JDBC URL:
dialog_connection_password_label=Password:
dialog_connection_path_label=Path:
dialog_connection_port_label=Port:
dialog_connection_server_label=Server:
dialog_connection_test_connection_button=Test Connection ...
dialog_connection_user_name_label=User name:
dialog_connection_advanced_tab=Advanced
dialog_connection_advanced_tab_tooltip=Advanced/custom driver properties
dialog_connection_basic_tab=Basic
dialog_connection_connection_type_group=Connection Type
dialog_connection_custom_tab=Custom
dialog_connection_host=Host
dialog_connection_ora_home=Client
dialog_connection_os_authentication=OS Authentication
dialog_connection_password=Password
dialog_connection_port=Port
dialog_connection_role=Role
dialog_connection_security_group=Security
dialog_connection_select_ora_home_msg=Select Exasol home
dialog_connection_test_connection=Test Connection ...
dialog_connection_user_name=User name
dialog_connection_ver=v.
edit_exasol_constraint_manager_dialog_title=Create constraint
edit_exasol_foreign_key_manager_dialog_title=Create foreign key
edit_exasol_schema_manager_dialog_title=Schema name
editors_exasol_application_editor_title_kill_application=Kill Application
editors_kill_application_editor_action_kill=Kill
editors_kill_application_editor_confirm_action=Are you sure you want to "kill" application "{1}"?
dialog_table_tools_success_title=Success
dialog_table_tools_options=Options
dialog_table_tools_result=Result
dialog_table_tools_progress=Progress
dialog_table_tools_truncate_title=Truncate Table(s)
editors_exasol_session_editor_title_kill_session = Kill Session
editors_exasol_session_editor_action_kill = Kill Session
editors_exasol_session_editor_confirm_action = {0} "{1}". Are you sure?
editors_exasol_session_editor_title_kill_session_statement = Terminate Statementmt
editors_exasol_session_editor_action_kill_statement = Terminate Statement
package org.jkiss.dbeaver.ext.exasol;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect;
public class ExasolSQLDialect extends JDBCSQLDialect {
private static final Log LOG = Log.getLog(ExasolDataSource.class);
public static final String[] EXEC_KEYWORDS = new String[]{"execute script"};
public ExasolSQLDialect(JDBCDatabaseMetaData metaData)
{
super("Exasol", metaData);
try {
for (String kw : metaData.getSQLKeywords().split(",")) {
this.addSQLKeyword(kw);
}
} catch (SQLException e)
{
LOG.warn("Could not retrieve reserved keyword list from Exasol dictionary");
}
}
@NotNull
@Override
public MultiValueInsertMode getMultiValueInsertMode()
{
return MultiValueInsertMode.GROUP_ROWS;
}
@Override
public boolean supportsAliasInSelect() {
return true;
}
@NotNull
@Override
public String[] getExecuteKeywords()
{
return EXEC_KEYWORDS;
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
public class ColorManager {
protected Map fColorTable = new HashMap(10);
public void dispose() {
Iterator e = fColorTable.values().iterator();
while (e.hasNext())
((Color) e.next()).dispose();
}
public Color getColor(RGB rgb) {
Color color = (Color) fColorTable.get(rgb);
if (color == null) {
color = new Color(Display.getCurrent(), rgb);
fColorTable.put(rgb, color);
}
return color;
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.editors;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import java.util.ArrayList;
import java.util.List;
/**
* Provides a list of Exasol Table Column for Exasol Table editors
*
* @author Karl Griesser
*
*/
public class ExasolColumnDataTypeListProvider implements IPropertyValueListProvider<ExasolTableColumn> {
@Override
public boolean allowCustomValue()
{
return false;
}
@Override
public Object[] getPossibleValues(ExasolTableColumn column)
{
List<DBSDataType> dataTypes = new ArrayList<DBSDataType>(column.getTable().getDataSource().getLocalDataTypes());
if (!dataTypes.contains(column.getDataType())) {
dataTypes.add(column.getDataType());
}
return dataTypes.toArray(new DBSDataType[dataTypes.size()]);
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ext.exasol.editors;
import java.util.HashMap;
import java.util.Map;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.ext.exasol.model.ExasolSchema;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTable;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn;
import org.jkiss.dbeaver.ext.exasol.model.ExasolView;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectType;
public enum ExasolObjectType implements DBSObjectType {
COLUMN(DBIcon.TREE_COLUMN, ExasolTableColumn.class, new ObjectFinder() {
@Override
public ExasolTableColumn findObject(DBRProgressMonitor monitor, ExasolTable exasolTable,String objectName) throws DBException
{
return exasolTable.getAttribute(monitor, objectName);
}
}),
SCHEMA(DBIcon.TREE_SCHEMA, ExasolSchema.class,null),
TABLE(DBIcon.TREE_TABLE, ExasolTable.class, new ObjectFinder() {
@Override
public ExasolTable findObject(DBRProgressMonitor monitor, ExasolSchema schema, String objectname) throws DBException
{
return schema.getTableCache().getObject(monitor,schema,objectname);
}
}),
VIEW(DBIcon.TREE_VIEW, ExasolView.class, new ObjectFinder())
;
private final DBPImage image;
private final Class<? extends DBSObject> typeClass;
private final ObjectFinder finder;
// -----------
// Constructor
// -----------
<OBJECT_TYPE extends DBSObject> ExasolObjectType(DBPImage image, Class<OBJECT_TYPE> typeClass, ObjectFinder finder)
{
this.image = image;
this.typeClass = typeClass;
this.finder = finder;
}
@Override
public String getTypeName() {
return this.name();
}
public boolean isBrowsable()
{
return finder != null;
}
public DBSObject findObject(DBRProgressMonitor monitor, ExasolDataSource exasolDataSource, String objectName) throws DBException
{
if (finder != null) {
return finder.findObject(monitor, exasolDataSource, objectName);
} else {
return null;
}
}
public DBSObject findObject(DBRProgressMonitor monitor, ExasolSchema schema, String objectName) throws DBException
{
if (finder != null) {
return finder.findObject(monitor, schema, objectName);
} else {
return null;
}
}
public DBSObject findObject(DBRProgressMonitor monitor, ExasolTable exasolTable, String objectName) throws DBException
{
if (finder != null) {
return finder.findObject(monitor, exasolTable, objectName);
} else {
return null;
}
}
// ----------------
// Standard Getters
// ----------------
@Override
public String getDescription() {
return null;
}
@Override
public DBPImage getImage() {
return image;
}
@Override
public Class<? extends DBSObject> getTypeClass() {
return typeClass;
}
// ----------------
// Helpers
// ----------------
private static class ObjectFinder {
DBSObject findObject(DBRProgressMonitor monitor, ExasolDataSource exasolDataSource, String objectName) throws DBException
{
return null;
}
DBSObject findObject(DBRProgressMonitor monitor, ExasolSchema schema, String objectName) throws DBException
{
return null;
}
DBSObject findObject(DBRProgressMonitor monitor, ExasolTable exasolTable, String objectName) throws DBException
{
return null;
}
}
public static ExasolObjectType getByType(String typename)
{
return typeMap.get(typename);
}
// ---
// Init
// ---
private static Map<String, ExasolObjectType> typeMap = new HashMap<>();
static {
for (ExasolObjectType type : values()) {
typeMap.put(type.getTypeName(), type);
}
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.jkiss.dbeaver.model.DBPScriptObject;
public interface ExasolSourceObject extends DBPScriptObject, ExasolStatefulObject {
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.editors;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.ext.exasol.model.ExasolSchema;
import org.jkiss.dbeaver.model.DBPStatefulObject;
import org.jkiss.dbeaver.model.struct.DBSObject;
/**
* @author Karl
*
*/
public interface ExasolStatefulObject extends DBSObject, DBPStatefulObject {
@NotNull
@Override
ExasolDataSource getDataSource();
ExasolSchema getSchema();
}
package org.jkiss.dbeaver.ext.exasol.editors;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.exasol.editors.ExasolObjectType;
import org.jkiss.dbeaver.ext.exasol.model.ExasolSchema;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTable;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.struct.AbstractObjectReference;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectReference;
import org.jkiss.dbeaver.model.struct.DBSObjectType;
import org.jkiss.dbeaver.model.struct.DBSStructureAssistant;
import org.jkiss.utils.CommonUtils;
public class ExasolStructureAssistant implements DBSStructureAssistant {
private static final Log LOG = Log.getLog(ExasolStructureAssistant.class);
private static final DBSObjectType[] SUPP_OBJ_TYPES = {ExasolObjectType.TABLE, ExasolObjectType.COLUMN, ExasolObjectType.SCHEMA, ExasolObjectType.VIEW};
private static final DBSObjectType[] HYPER_LINKS_TYPES = {ExasolObjectType.TABLE, ExasolObjectType.VIEW, ExasolObjectType.SCHEMA};
private static final DBSObjectType[] AUTOC_OBJ_TYPES = {ExasolObjectType.TABLE, ExasolObjectType.VIEW, ExasolObjectType.SCHEMA};
private static final String SQL_TABLES_ALL = "SELECT ROOT_NAME,OBJECT_NAME,OBJECT_TYPE from EXA_ALL_OBJECTS WHERE OBJECT_NAME = ? AND TYPE IN (%s)";
private static final String SQL_TABLES_SCHEMA = "SELECT ROOT_NAME,OBJECT_NAME,OBJECT_TYPE from EXA_ALL_OBJECTS WHERE ROOT_NAME = ? AND OBJECT_NAME LIKE ? AND TYPE IN (%s)";
private static final String SQL_COLS_ALL = "SELECT COLUMN_SCHEMA,COLUMN_TABLE,COLUMN_NAME FROM EXA_ALL_COLUMNS WHERE COLUMN_NAME LIKE ?";
private static final String SQL_COLS_SCHEMA = "SELECT COLUMN_SCHEMA,COLUMN_TABLE,COLUMN_NAME FROM EXA_ALL_COLUMNS WHERE COLUMN_SCHEMA = ? and COLUMN_NAME LIKE ?";
private ExasolDataSource dataSource;
// -----------------
// Constructors
// -----------------
public ExasolStructureAssistant(ExasolDataSource dataSource)
{
this.dataSource = dataSource;
}
// -----------------
// Method Interface
// -----------------
@Override
public DBSObjectType[] getSupportedObjectTypes() {
return SUPP_OBJ_TYPES;
}
@Override
public DBSObjectType[] getHyperlinkObjectTypes() {
return HYPER_LINKS_TYPES;
}
@Override
public DBSObjectType[] getAutoCompleteObjectTypes() {
return AUTOC_OBJ_TYPES;
}
@Override
public Collection<DBSObjectReference> findObjectsByMask(DBRProgressMonitor monitor, DBSObject parentObject,
DBSObjectType[] objectTypes, String objectNameMask, boolean caseSensitive, boolean globalSearch,
int maxResults) throws DBException {
LOG.debug(objectNameMask);
List<ExasolObjectType> exasolObjectTypes = new ArrayList<>(objectTypes.length);
for (DBSObjectType dbsObjectType : objectTypes) {
exasolObjectTypes.add((ExasolObjectType) dbsObjectType);
}
ExasolSchema schema = parentObject instanceof ExasolSchema ? (ExasolSchema) parentObject : null;
try (JDBCSession session = DBUtils.openMetaSession(monitor, dataSource, "Find objects by name")) {
return searchAllObjects(session, schema, objectNameMask, exasolObjectTypes, caseSensitive, maxResults);
} catch (SQLException ex) {
throw new DBException(ex, dataSource);
}
}
// -----------------
// Helpers
// -----------------
private List<DBSObjectReference> searchAllObjects(final JDBCSession session, final ExasolSchema schema, String objectNameMask,
List<ExasolObjectType> exasolObjectTypes, boolean caseSensitive, int maxResults) throws SQLException, DBException
{
List<DBSObjectReference> objects = new ArrayList<>();
String searchObjectNameMask = objectNameMask;
if (!caseSensitive) {
searchObjectNameMask = searchObjectNameMask.toUpperCase();
}
int nbResults = 0;
// Tables, Views
if (( exasolObjectTypes.contains(ExasolObjectType.TABLE)) || (exasolObjectTypes.contains(ExasolObjectType.VIEW))) {
searchTables(session, schema, searchObjectNameMask, exasolObjectTypes, maxResults, objects, nbResults);
if (nbResults >= maxResults) {
return objects;
}
}
// Columns
if (exasolObjectTypes.contains(ExasolObjectType.COLUMN)) {
searchColumns(session, schema, searchObjectNameMask, exasolObjectTypes, maxResults, objects, nbResults);
}
return objects;
}
// --------------
// Helper Classes
// --------------
private void searchTables(JDBCSession session, ExasolSchema schema, String searchObjectNameMask,
List<ExasolObjectType> exasolObjectTypes, int maxResults, List<DBSObjectReference> objects, int nbResults) throws SQLException,
DBException
{
String baseSQL;
if (schema != null) {
baseSQL = SQL_TABLES_SCHEMA;
} else {
baseSQL = SQL_TABLES_ALL;
}
String sql = buildTableSQL(baseSQL, exasolObjectTypes);
int n = 1;
try (JDBCPreparedStatement dbStat = session.prepareStatement(sql)) {
if (schema != null) {
dbStat.setString(n++, schema.getName());
}
dbStat.setString(n++, searchObjectNameMask);
dbStat.setFetchSize(DBConstants.METADATA_FETCH_SIZE);
String schemaName;
String objectName;
ExasolSchema exasolSchema;
ExasolObjectType objectType;
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
if (session.getProgressMonitor().isCanceled()) {
break;
}
if (nbResults++ >= maxResults) {
break;
}
schemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "ROOT_NAME");
objectName = JDBCUtils.safeGetString(dbResult, "OBJECT_NAME");
exasolSchema = dataSource.getSchema(session.getProgressMonitor(), schemaName);
if (exasolSchema == null) {
LOG.debug("Schema '" + schemaName + "' not found. Probably was filtered");
continue;
}
objectType = ExasolObjectType.TABLE;
objects.add(new ExasolObjectReference(objectName, exasolSchema, objectType));
}
}
}
}
private void searchColumns(JDBCSession session, ExasolSchema schema, String searchObjectNameMask, List<ExasolObjectType> objectTypes,
int maxResults, List<DBSObjectReference> objects, int nbResults) throws SQLException, DBException
{
String sql;
if (schema != null) {
sql = SQL_COLS_SCHEMA;
} else {
sql = SQL_COLS_ALL;
}
int n = 1;
try (JDBCPreparedStatement dbStat = session.prepareStatement(sql)) {
if (schema != null) {
dbStat.setString(n++, schema.getName());
}
dbStat.setString(n++, searchObjectNameMask);
dbStat.setFetchSize(DBConstants.METADATA_FETCH_SIZE);
String tableSchemaName;
String tableOrViewName;
String columnName;
ExasolSchema exasolSchema;
ExasolTable exasolTable;
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
if (session.getProgressMonitor().isCanceled()) {
break;
}
if (nbResults++ >= maxResults) {
return;
}
tableSchemaName = JDBCUtils.safeGetStringTrimmed(dbResult, "COLUMN_SCHEMA");
tableOrViewName = JDBCUtils.safeGetString(dbResult, "COLUMN_TABLE");
columnName = JDBCUtils.safeGetString(dbResult, "COLUMN_NAME");
exasolSchema = dataSource.getSchema(session.getProgressMonitor(), tableSchemaName);
if (exasolSchema == null) {
LOG.debug("Schema '" + tableSchemaName + "' not found. Probably was filtered");
continue;
}
// Try with table, then view
exasolTable = exasolSchema.getTable(session.getProgressMonitor(), tableOrViewName);
if (exasolTable != null) {
objects.add(new ExasolObjectReference(columnName, exasolTable, ExasolObjectType.COLUMN));
}
}
}
}
}
private class ExasolObjectReference extends AbstractObjectReference {
private ExasolObjectReference(String objectName, ExasolSchema exasolSchema, ExasolObjectType objectType)
{
super(objectName, exasolSchema, null, ExasolSchema.class, objectType);
}
private ExasolObjectReference(String objectName, ExasolTable exasolTable, ExasolObjectType objectType)
{
super(objectName, exasolTable, null, ExasolTable.class, objectType);
}
@Override
public DBSObject resolveObject(DBRProgressMonitor monitor) throws DBException
{
ExasolObjectType exasolObjectType = (ExasolObjectType) getObjectType();
if (getContainer() instanceof ExasolSchema) {
ExasolSchema exasolSchema = (ExasolSchema) getContainer();
DBSObject object = exasolObjectType.findObject(monitor, exasolSchema, getName());
if (object == null) {
throw new DBException(exasolObjectType + " '" + getName() + "' not found in schema '" + exasolSchema.getName() + "'");
}
return object;
}
if (getContainer() instanceof ExasolTable) {
ExasolTable exasolTable = (ExasolTable) getContainer();
DBSObject object = exasolObjectType.findObject(monitor, exasolTable, getName());
if (object == null) {
throw new DBException(exasolObjectType + " '" + getName() + "' not found in table '" + exasolTable.getName() + "'");
}
return object;
}
return null;
}
}
private String buildTableSQL(String baseStatement, List<ExasolObjectType> objectTypes)
{
List<String> types = new ArrayList<>();
for (ExasolObjectType objectType : objectTypes) {
if (objectType.equals(ExasolObjectType.TABLE)) {
types.add("'" + ExasolObjectType.TABLE.name() + "'");
}
if (objectType.equals(ExasolObjectType.VIEW)) {
types.add( "'" + ExasolObjectType.VIEW.name() + "'");
}
}
return String.format(baseStatement, CommonUtils.joinStrings(",", types));
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.swt.graphics.RGB;
public interface IXMLColorConstants {
RGB XML_COMMENT = new RGB(128, 0, 0);
RGB PROC_INSTR = new RGB(128, 128, 128);
RGB STRING = new RGB(0, 128, 0);
RGB DEFAULT = new RGB(0, 0, 0);
RGB TAG = new RGB(0, 0, 128);
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.TextPresentation;
import org.eclipse.jface.text.presentation.IPresentationDamager;
import org.eclipse.jface.text.presentation.IPresentationRepairer;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.custom.StyleRange;
public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer {
/** The document this object works on */
protected IDocument fDocument;
/** The default text attribute if non is returned as data by the current token */
protected TextAttribute fDefaultTextAttribute;
public NonRuleBasedDamagerRepairer(TextAttribute defaultTextAttribute) {
Assert.isNotNull(defaultTextAttribute);
fDefaultTextAttribute = defaultTextAttribute;
}
@Override
public void setDocument(IDocument document) {
fDocument = document;
}
/**
* Returns the end offset of the line that contains the specified offset or
* if the offset is inside a line delimiter, the end offset of the next line.
*
* @param offset the offset whose line end offset must be computed
* @return the line end offset for the given offset
* @exception BadLocationException if offset is invalid in the current document
*/
protected int endOfLineOf(int offset) throws BadLocationException {
IRegion info = fDocument.getLineInformationOfOffset(offset);
if (offset <= info.getOffset() + info.getLength())
return info.getOffset() + info.getLength();
int line = fDocument.getLineOfOffset(offset);
try {
info = fDocument.getLineInformation(line + 1);
return info.getOffset() + info.getLength();
} catch (BadLocationException x) {
return fDocument.getLength();
}
}
@Override
public IRegion getDamageRegion(
ITypedRegion partition,
DocumentEvent event,
boolean documentPartitioningChanged) {
if (!documentPartitioningChanged) {
try {
IRegion info = fDocument.getLineInformationOfOffset(event.getOffset());
int start = Math.max(partition.getOffset(), info.getOffset());
int end =
event.getOffset()
+ (event.getText() == null
? event.getLength()
: event.getText().length());
if (info.getOffset() <= end
&& end <= info.getOffset() + info.getLength()) {
// optimize the case of the same line
end = info.getOffset() + info.getLength();
} else
end = endOfLineOf(end);
end =
Math.min(
partition.getOffset() + partition.getLength(),
end);
return new Region(start, end - start);
} catch (BadLocationException x) {
}
}
return partition;
}
@Override
public void createPresentation(TextPresentation presentation, ITypedRegion region) {
addRange(
presentation,
region.getOffset(),
region.getLength(),
fDefaultTextAttribute);
}
/**
* Adds style information to the given text presentation.
*
* @param presentation the text presentation to be extended
* @param offset the offset of the range to be styled
* @param length the length of the range to be styled
* @param attr the attribute describing the style of the range to be styled
*/
protected void addRange(
TextPresentation presentation,
int offset,
int length,
TextAttribute attr) {
if (attr != null)
presentation.addStyleRange(
new StyleRange(
offset,
length,
attr.getForeground(),
attr.getBackground(),
attr.getStyle()));
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.rules.*;
public class TagRule extends MultiLineRule {
public TagRule(IToken token) {
super("<", ">", token);
}
@Override
protected boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean eofAllowed) {
int c = scanner.read();
if (sequence[0] == '<') {
if (c == '?') {
// processing instruction - abort
scanner.unread();
return false;
}
if (c == '!') {
scanner.unread();
// comment - abort
return false;
}
} else if (sequence[0] == '>') {
scanner.unread();
}
return super.sequenceDetected(scanner, sequence, eofAllowed);
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextDoubleClickStrategy;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
public class XMLConfiguration extends SourceViewerConfiguration {
private XMLDoubleClickStrategy doubleClickStrategy;
private XMLTagScanner tagScanner;
private XMLScanner scanner;
private ColorManager colorManager;
public XMLConfiguration(ColorManager colorManager) {
this.colorManager = colorManager;
}
@Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] {
IDocument.DEFAULT_CONTENT_TYPE,
XMLPartitionScanner.XML_COMMENT,
XMLPartitionScanner.XML_TAG };
}
@Override
public ITextDoubleClickStrategy getDoubleClickStrategy(
ISourceViewer sourceViewer,
String contentType) {
if (doubleClickStrategy == null)
doubleClickStrategy = new XMLDoubleClickStrategy();
return doubleClickStrategy;
}
protected XMLScanner getXMLScanner() {
if (scanner == null) {
scanner = new XMLScanner(colorManager);
scanner.setDefaultReturnToken(
new Token(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.DEFAULT))));
}
return scanner;
}
protected XMLTagScanner getXMLTagScanner() {
if (tagScanner == null) {
tagScanner = new XMLTagScanner(colorManager);
tagScanner.setDefaultReturnToken(
new Token(
new TextAttribute(
colorManager.getColor(IXMLColorConstants.TAG))));
}
return tagScanner;
}
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner());
reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
dr = new DefaultDamagerRepairer(getXMLScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(
new TextAttribute(colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
return reconciler;
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.rules.FastPartitioner;
import org.eclipse.ui.editors.text.FileDocumentProvider;
public class XMLDocumentProvider extends FileDocumentProvider {
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(),
new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return document;
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.*;
public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy {
protected ITextViewer fText;
@Override
public void doubleClicked(ITextViewer part) {
int pos = part.getSelectedRange().x;
if (pos < 0)
return;
fText = part;
if (!selectComment(pos)) {
selectWord(pos);
}
}
protected boolean selectComment(int caretPos) {
IDocument doc = fText.getDocument();
int startPos, endPos;
try {
int pos = caretPos;
char c = ' ';
while (pos >= 0) {
c = doc.getChar(pos);
if (c == '\\') {
pos -= 2;
continue;
}
if (c == Character.LINE_SEPARATOR || c == '\"')
break;
--pos;
}
if (c != '\"')
return false;
startPos = pos;
pos = caretPos;
int length = doc.getLength();
c = ' ';
while (pos < length) {
c = doc.getChar(pos);
if (c == Character.LINE_SEPARATOR || c == '\"')
break;
++pos;
}
if (c != '\"')
return false;
endPos = pos;
int offset = startPos + 1;
int len = endPos - offset;
fText.setSelectedRange(offset, len);
return true;
} catch (BadLocationException x) {
}
return false;
}
protected boolean selectWord(int caretPos) {
IDocument doc = fText.getDocument();
int startPos, endPos;
try {
int pos = caretPos;
char c;
while (pos >= 0) {
c = doc.getChar(pos);
if (!Character.isJavaIdentifierPart(c))
break;
--pos;
}
startPos = pos;
pos = caretPos;
int length = doc.getLength();
while (pos < length) {
c = doc.getChar(pos);
if (!Character.isJavaIdentifierPart(c))
break;
++pos;
}
endPos = pos;
selectRange(startPos, endPos);
return true;
} catch (BadLocationException x) {
}
return false;
}
private void selectRange(int startPos, int stopPos) {
int offset = startPos + 1;
int length = stopPos - offset;
fText.setSelectedRange(offset, length);
}
}
\ No newline at end of file
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.rules.*;
public class XMLPartitionScanner extends RuleBasedPartitionScanner {
public final static String XML_COMMENT = "__xml_comment";
public final static String XML_TAG = "__xml_tag";
public XMLPartitionScanner() {
IToken xmlComment = new Token(XML_COMMENT);
IToken tag = new Token(XML_TAG);
IPredicateRule[] rules = new IPredicateRule[2];
rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
rules[1] = new TagRule(tag);
setPredicateRules(rules);
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.rules.*;
import org.eclipse.jface.text.*;
public class XMLScanner extends RuleBasedScanner {
public XMLScanner(ColorManager manager) {
IToken procInstr =
new Token(
new TextAttribute(
manager.getColor(IXMLColorConstants.PROC_INSTR)));
IRule[] rules = new IRule[2];
//Add rule for processing instructions
rules[0] = new SingleLineRule("<?", "?>", procInstr);
// Add generic whitespace rule.
rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
setRules(rules);
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.rules.*;
public class XMLTagScanner extends RuleBasedScanner {
public XMLTagScanner(ColorManager manager) {
IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
IRule[] rules = new IRule[3];
// Add rule for double quotes
rules[0] = new SingleLineRule("\"", "\"", string, '\\');
// Add a rule for single quotes
rules[1] = new SingleLineRule("'", "'", string, '\\');
// Add generic whitespace rule.
rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
setRules(rules);
}
}
package org.jkiss.dbeaver.ext.exasol.editors;
import org.eclipse.jface.text.rules.IWhitespaceDetector;
public class XMLWhitespaceDetector implements IWhitespaceDetector {
@Override
public boolean isWhitespace(char c) {
return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
}
}
package org.jkiss.dbeaver.ext.exasol.manager;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTable;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableBase;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.edit.DBEObjectRenamer;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.impl.DBSObjectCache;
import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import org.jkiss.dbeaver.model.impl.sql.edit.struct.SQLTableColumnManager;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.utils.CommonUtils;
import java.util.List;
/**
* Exasol Table Column Manager
*
* @author Karl Griesser
*
*/
public class ExasolTableColumnManager extends SQLTableColumnManager<ExasolTableColumn, ExasolTableBase> implements DBEObjectRenamer<ExasolTableColumn> {
private static final String SQL_ALTER = "ALTER TABLE %s MODIFY COLUMN %s ";
private static final String SQL_COMMENT = "COMMENT ON COLUMN %s.%s IS '%s'";
private static final String CMD_ALTER = "Alter Column";
private static final String CMD_COMMENT = "Comment on Column";
// -----------------
// Business Contract
// -----------------
@Nullable
@Override
public DBSObjectCache<? extends DBSObject, ExasolTableColumn> getObjectsCache(ExasolTableColumn object)
{
return object.getParentObject().getContainer().getTableCache().getChildrenCache((ExasolTable) object.getParentObject());
}
@Override
public boolean canEditObject(ExasolTableColumn object)
{
// Edit is only availabe for ExasolTable and not for other kinds of tables (View, MQTs, Nicknames..)
ExasolTableBase exasolTableBase = object.getParentObject();
if ((exasolTableBase != null) & (exasolTableBase.getClass().equals(ExasolTable.class))) {
return true;
} else {
return false;
}
}
// ------
// Create
// ------
@Override
protected ExasolTableColumn createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, ExasolTableBase parent,
Object copyFrom)
{
ExasolTableColumn column = new ExasolTableColumn(parent);
column.setName(getNewColumnName(monitor, context, parent));
return column;
}
// -----
// Alter
// -----
@Override
protected void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command)
{
ExasolTableColumn exasolColumn = command.getObject();
if (!command.getProperties().isEmpty()) {
final String deltaSQL = exasolColumn.getName() + " " + exasolColumn.getFormatType()
+ " " + (exasolColumn.getDefaultValue() == null ? "" : " DEFAULT " + exasolColumn.getDefaultValue())
+ " " + (exasolColumn.isIdentity() ? " IDENTITY " + exasolColumn.getIdentityValue().toString() : "")
+ " " + (exasolColumn.isRequired() ? "NOT NULL" : "NULL")
;
if (!deltaSQL.isEmpty()) {
String sqlAlterColumn = String.format(SQL_ALTER, exasolColumn.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL), deltaSQL);
actionList.add(new SQLDatabasePersistAction(CMD_ALTER, sqlAlterColumn));
}
}
// Comment
DBEPersistAction commentAction = buildCommentAction(exasolColumn);
if (commentAction != null) {
actionList.add(commentAction);
}
}
// -------
// Helpers
// -------
private DBEPersistAction buildCommentAction(ExasolTableColumn exasolColumn)
{
if (CommonUtils.isNotEmpty(exasolColumn.getDescription())) {
String tableName = exasolColumn.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL);
String columnName = exasolColumn.getName();
String comment = exasolColumn.getDescription();
String commentSQL = String.format(SQL_COMMENT, tableName, columnName, comment);
return new SQLDatabasePersistAction(CMD_COMMENT, commentSQL);
} else {
return null;
}
}
@Override
public void renameObject(DBECommandContext commandContext, ExasolTableColumn object, String newName) throws DBException {
processObjectRename(commandContext, object, newName);
}
@Override
protected void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command)
{
final ExasolTableColumn column = command.getObject();
actions.add(
new SQLDatabasePersistAction(
"Rename column",
"ALTER TABLE " + column.getTable().getFullyQualifiedName(DBPEvaluationContext.DDL) + " RENAME COLUMN " +
DBUtils.getQuotedIdentifier(column.getDataSource(), command.getOldName()) + " TO " + command.getNewName())
);
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.manager;
import java.util.List;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.model.ExasolSchema;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTable;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableColumn;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableForeignKey;
import org.jkiss.dbeaver.ext.exasol.model.ExasolTableUniqueKey;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.edit.DBEObjectRenamer;
import org.jkiss.dbeaver.model.edit.DBEPersistAction;
import org.jkiss.dbeaver.model.impl.DBSObjectCache;
import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction;
import org.jkiss.dbeaver.model.impl.sql.edit.struct.SQLTableManager;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.CommonUtils;
/**
* @author Karl
*
*/
public class ExasolTableManager extends SQLTableManager<ExasolTable, ExasolSchema> implements DBEObjectRenamer<ExasolTable> {
private static final String NEW_TABLE_NAME = "NEW_TABLE";
private static final String SQL_ALTER = "ALTER TABLE ";
private static final String SQL_RENAME_TABLE = "RENAME TABLE %s TO %s";
private static final String SQL_COMMENT = "COMMENT ON TABLE %s IS '%s'";
private static final String CMD_ALTER = "Alter Table";
private static final String CMD_COMMENT = "Comment on Table";
private static final String CMD_RENAME = "Rename Table";
private static final Class<?>[] CHILD_TYPES = { ExasolTableColumn.class, ExasolTableUniqueKey.class, ExasolTableForeignKey.class
};
// -----------------
// Business Contract
// -----------------
@NotNull
@Override
public Class<?>[] getChildTypes()
{
return CHILD_TYPES;
}
@Nullable
@Override
public DBSObjectCache<ExasolSchema, ExasolTable> getObjectsCache(ExasolTable object)
{
return object.getSchema().getTableCache();
}
// ------
// Create
// ------
@Override
public ExasolTable createDatabaseObject(DBRProgressMonitor monitor, DBECommandContext context, ExasolSchema exasolSchema,
Object copyFrom)
{
ExasolTable table = new ExasolTable(exasolSchema, NEW_TABLE_NAME);
try {
setTableName(monitor, exasolSchema, table);
} catch (DBException e) {
log.error(e);
}
return table;
}
@Override
@SuppressWarnings("rawtypes")
public void appendTableModifiers(ExasolTable exasolTable, NestedObjectCommand tableProps, StringBuilder ddl)
{
}
@Override
public void addStructObjectCreateActions(List<DBEPersistAction> actions, StructCreateCommand command)
{
super.addStructObjectCreateActions(actions, command);
// Eventually add Comment
DBEPersistAction commentAction = buildCommentAction(command.getObject());
if (commentAction != null) {
actions.add(commentAction);
}
}
// ------
// Alter
// ------
@Override
public void addObjectModifyActions(List<DBEPersistAction> actionList, ObjectChangeCommand command)
{
ExasolTable exasolTable = command.getObject();
if (command.getProperties().size() > 1) {
StringBuilder sb = new StringBuilder(128);
sb.append(SQL_ALTER);
sb.append(exasolTable.getFullyQualifiedName(DBPEvaluationContext.DDL));
sb.append(" ");
appendTableModifiers(command.getObject(), command, sb);
actionList.add(new SQLDatabasePersistAction(CMD_ALTER, sb.toString()));
}
DBEPersistAction commentAction = buildCommentAction(exasolTable);
if (commentAction != null) {
actionList.add(commentAction);
}
}
// ------
// Rename
// ------
@Override
public void addObjectRenameActions(List<DBEPersistAction> actions, ObjectRenameCommand command)
{
String sql = String.format(SQL_RENAME_TABLE, command.getObject().getFullyQualifiedName(DBPEvaluationContext.DDL), command.getNewName());
actions.add(
new SQLDatabasePersistAction(CMD_RENAME, sql)
);
}
@Override
public void renameObject(DBECommandContext commandContext, ExasolTable object, String newName) throws DBException
{
processObjectRename(commandContext, object, newName);
}
// -------
// Helpers
// -------
private DBEPersistAction buildCommentAction(ExasolTable exasolTable)
{
if (CommonUtils.isNotEmpty(exasolTable.getDescription())) {
String commentSQL = String.format(SQL_COMMENT, exasolTable.getFullyQualifiedName(DBPEvaluationContext.DDL), exasolTable.getDescription());
return new SQLDatabasePersistAction(CMD_COMMENT, commentSQL);
} else {
return null;
}
}
}
package org.jkiss.dbeaver.ext.exasol.model;
public class ExasolConnection {
}
package org.jkiss.dbeaver.ext.exasol.model;
public class ExasolCurrentUserPrivileges {
}
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.exasol.ExasolDataSourceProvider;
import org.jkiss.dbeaver.ext.exasol.ExasolSQLDialect;
import org.jkiss.dbeaver.ext.exasol.model.plan.ExasolPlanAnalyser;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBPDataSourceInfo;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCExecutionPurpose;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.exec.plan.DBCPlan;
import org.jkiss.dbeaver.model.exec.plan.DBCQueryPlanner;
import org.jkiss.dbeaver.model.impl.DBSObjectCache;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCObjectSimpleCache;
import org.jkiss.dbeaver.model.meta.Association;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.model.sql.SQLDialect;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectSelector;
import org.jkiss.dbeaver.model.struct.DBSStructureAssistant;
import org.jkiss.utils.CommonUtils;
public class ExasolDataSource extends JDBCDataSource implements DBSObjectSelector, DBCQueryPlanner, IAdaptable {
private static final Log LOG = Log.getLog(ExasolDataSource.class);
private static final String GET_CURRENT_USER = "SELECT CURRENT_USER";
private static final String GET_CURRENT_SCHEMA = "SELECT CURRENT_SCHEMA";
private static final String SET_CURRENT_SCHEMA = "OPEN SCHEMA \"%s\"";
private static final String C_SCHEMA = "select b.object_name,owner,created,object_comment from EXA_ALL_OBJECTS b where b.object_type = 'SCHEMA' "
+ "union all select distinct SCHEMA_NAME as \"OBJECT_NAME\", 'SYS' as owner, cast(null as timestamp) as created, '' as \"OBJECT_COMMENT\" from SYS.EXA_SYSCAT "
+ "order by b.object_name";
private static final String C_USERS = "select * from EXA_ALL_USERS";
private static final String C_DT = "SELECT * FROM EXA_SQL_TYPES";
private final DBSObjectCache<ExasolDataSource, ExasolSchema> schemaCache = new JDBCObjectSimpleCache<>(
ExasolSchema.class, C_SCHEMA);
private final DBSObjectCache<ExasolDataSource, ExasolUser> userCache = new JDBCObjectSimpleCache<>(ExasolUser.class, C_USERS);
private final DBSObjectCache<ExasolDataSource, ExasolDataType> dataTypeCache = new JDBCObjectSimpleCache<>(ExasolDataType.class, C_DT);
/* private final DBSObjectCache<ExasolDataSource, ExasolConnection> exasolconnection = new JDBCObjectSimpleCache<>(
ExasolConnection.class, C_SV); */
private String activeSchemaName;
// -----------------------
// Constructors
// -----------------------
public ExasolDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container) throws DBException
{
super(monitor, container);
}
@Override
protected boolean isConnectionReadOnlyBroken() {
return true;
}
// -----------------------
// Initialisation/Structure
// -----------------------
@Override
public void initialize(@NotNull DBRProgressMonitor monitor) throws DBException
{
super.initialize(monitor);
try (JDBCSession session = DBUtils.openMetaSession(monitor, this, "Load data source meta info")) {
// First try to get active schema from special register 'CURRENT SCHEMA'
this.activeSchemaName = determineActiveSchema(session);
} catch (SQLException e) {
LOG.warn("Error reading active schema", e);
}
try {
this.dataTypeCache.getAllObjects(monitor, this);
} catch (DBException e) {
LOG.warn("Error reading types info", e);
this.dataTypeCache.setCache(Collections.<ExasolDataType> emptyList());
}
}
protected void initializeContextState(@NotNull DBRProgressMonitor monitor, @NotNull JDBCExecutionContext context, boolean setActiveObject) throws DBCException {
if (setActiveObject) {
setCurrentSchema(monitor, context, getDefaultObject());
}
}
private String determineActiveSchema(JDBCSession session) throws SQLException {
// First try to get active schema from special register 'CURRENT SCHEMA'
String defSchema = JDBCUtils.queryString(session, GET_CURRENT_SCHEMA);
if (defSchema == null) {
return "";
}
return defSchema.trim();
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object getAdapter(Class adapter)
{
if (adapter == DBSStructureAssistant.class) {
return new ExasolStructureAssistant(this);
}
return super.getAdapter(adapter);
}
@Override
public void cacheStructure(@NotNull DBRProgressMonitor monitor, int scope) throws DBException
{
// TODO DF: No idea what to do with this method, what it is used for...
}
// -----------------------
// Connection related Info
// -----------------------
@Override
protected String getConnectionUserName(@NotNull DBPConnectionConfiguration connectionInfo)
{
return connectionInfo.getUserName();
}
@NotNull
@Override
public ExasolDataSource getDataSource()
{
return this;
}
@Override
protected DBPDataSourceInfo createDataSourceInfo(@NotNull JDBCDatabaseMetaData metaData)
{
final ExasolDataSourceInfo info = new ExasolDataSourceInfo(metaData);
info.setSupportsResultSetScroll(false);
return info;
}
@Override
protected SQLDialect createSQLDialect(@NotNull JDBCDatabaseMetaData metaData)
{
return new ExasolSQLDialect(metaData);
}
@Override
protected Map<String, String> getInternalConnectionProperties(DBRProgressMonitor monitor) throws DBCException
{
Map<String, String> props = new HashMap<>();
props.putAll(ExasolDataSourceProvider.getConnectionsProps());
return props;
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
super.refreshObject(monitor);
this.schemaCache.clearCache();
this.userCache.clearCache();
this.dataTypeCache.clearCache();
this.initialize(monitor);
return this;
}
// --------------------------
// Manage Children: ExasolSchema
// --------------------------
@Override
public boolean supportsDefaultChange()
{
return true;
}
@Override
public Class<? extends ExasolSchema> getChildType(@NotNull DBRProgressMonitor monitor) throws DBException
{
return ExasolSchema.class;
}
@Override
public Collection<ExasolSchema> getChildren(@NotNull DBRProgressMonitor monitor) throws DBException
{
return getSchemas(monitor);
}
@Override
public ExasolSchema getChild(@NotNull DBRProgressMonitor monitor, @NotNull String childName) throws DBException
{
return getSchema(monitor, childName);
}
@Override
public ExasolSchema getDefaultObject()
{
return activeSchemaName == null ? null : schemaCache.getCachedObject(activeSchemaName);
}
@Override
public void setDefaultObject(@NotNull DBRProgressMonitor monitor, @NotNull DBSObject object) throws DBException
{
final ExasolSchema oldSelectedEntity = getDefaultObject();
if (!(object instanceof ExasolSchema)) {
throw new IllegalArgumentException("Invalid object type: " + object);
}
for (JDBCExecutionContext context : getAllContexts()) {
setCurrentSchema(monitor, context, (ExasolSchema) object);
}
activeSchemaName = object.getName();
// Send notifications
if (oldSelectedEntity != null) {
DBUtils.fireObjectSelect(oldSelectedEntity, false);
}
if (this.activeSchemaName != null) {
DBUtils.fireObjectSelect(object, true);
}
}
@Override
public boolean refreshDefaultObject(@NotNull DBCSession session) throws DBException {
try {
final String newSchemaName = determineActiveSchema((JDBCSession) session);
if (!CommonUtils.equalObjects(newSchemaName, activeSchemaName)) {
final ExasolSchema newSchema = schemaCache.getCachedObject(newSchemaName);
if (newSchema != null) {
setDefaultObject(session.getProgressMonitor(), newSchema);
return true;
}
}
return false;
} catch (SQLException e) {
throw new DBException(e, this);
}
}
private void setCurrentSchema(DBRProgressMonitor monitor, JDBCExecutionContext executionContext, ExasolSchema object) throws DBCException {
if (object == null) {
LOG.debug("Null current schema");
return;
}
try (JDBCSession session = executionContext.openSession(monitor, DBCExecutionPurpose.UTIL, "Set active schema")) {
JDBCUtils.executeSQL(session, String.format(SET_CURRENT_SCHEMA, object.getName()));
} catch (SQLException e) {
throw new DBCException(e, this);
}
}
// --------------
// Associations
// --------------
@Association
public Collection<ExasolSchema> getSchemas(DBRProgressMonitor monitor) throws DBException
{
return schemaCache.getAllObjects(monitor, this);
}
public ExasolSchema getSchema(DBRProgressMonitor monitor, String name) throws DBException
{
return schemaCache.getObject(monitor, this, name);
}
public Collection<ExasolUser> getUsers(DBRProgressMonitor monitor) throws DBException
{
return userCache.getAllObjects(monitor, this);
}
public ExasolUser getUser(DBRProgressMonitor monitor, String name) throws DBException
{
return userCache.getObject(monitor, this, name);
}
@Association
public Collection<ExasolDataType> getDataTypes(DBRProgressMonitor monitor) throws DBException
{
return dataTypeCache.getAllObjects(monitor, this);
}
public ExasolDataType getDataType(DBRProgressMonitor monitor, String name) throws DBException
{
return dataTypeCache.getObject(monitor, this, name);
}
// -------------
// Dynamic Data
// -------------
// -------------------------
// Standards Getters
// -------------------------
public DBSObjectCache<ExasolDataSource, ExasolUser> getUserCache()
{
return userCache;
}
public DBSObjectCache<ExasolDataSource, ExasolSchema> getSchemaCache()
{
return schemaCache;
}
@Override
public Collection<? extends DBSDataType> getLocalDataTypes() {
try {
return getDataTypes(VoidProgressMonitor.INSTANCE);
} catch (DBException e) {
LOG.error("DBException occured when reading system dataTypes: ", e);
return null;
}
}
@Override
public DBSDataType getLocalDataType(String typeName) {
try {
return getDataType(VoidProgressMonitor.INSTANCE, typeName);
} catch (DBException e) {
LOG.error("DBException occured when reading system dataType: " + typeName, e);
return null;
}
}
@Override
public DBCPlan planQueryExecution(DBCSession session, String query) throws DBCException {
ExasolPlanAnalyser plan = new ExasolPlanAnalyser(this, query);
plan.explain(session);
return plan;
}
public DBSObjectCache<ExasolDataSource, ExasolDataType> getDataTypeCache()
{
return dataTypeCache;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSourceInfo;
class ExasolDataSourceInfo extends JDBCDataSourceInfo {
public ExasolDataSourceInfo(JDBCDatabaseMetaData metaData) {
super(metaData);
}
@Override
public boolean supportsMultipleResults() {
return false;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2013-2015 Denis Forveille (titou10.titou10@gmail.com)
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPQualifiedObject;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCLogicalOperator;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.sql.ResultSet;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
/**
* Exasol data types
*
* @author Karl Griesser
*/
public class ExasolDataType extends ExasolObject<DBSObject> implements DBSDataType, DBPQualifiedObject {
private static final Log LOG = Log.getLog(ExasolDataType.class);
private DBSObject parentNode; // see below
private ExasolSchema exasolSchema;
private TypeDesc typeDesc;
private Integer exasolTypeId;
private Integer length;
private Integer scale;
private ExasolDataSource exasolDataSource;
private String name;
// -----------------------
// Constructors
// -----------------------
protected ExasolDataType(DBSObject parent, String name, boolean persisted) {
super(parent, name, persisted);
exasolDataSource = (ExasolDataSource) parent.getDataSource();
}
public ExasolDataType(DBSObject owner, ResultSet dbResult) throws DBException
{
super(owner, JDBCUtils.safeGetString(dbResult, "TYPE_NAME"), true);
this.exasolDataSource = ((ExasolDataSource) owner).getDataSource();
this.exasolTypeId = JDBCUtils.safeGetInteger(dbResult, "TYPE_ID");
this.length = JDBCUtils.safeGetInteger(dbResult, "PRECISION");
this.scale = JDBCUtils.safeGetInteger(dbResult, "MINIMUM_SCALE");
TypeDesc tempTypeDesc = null;
this.name = JDBCUtils.safeGetString(dbResult, "TYPE_NAME");
switch (name) {
case "BIGINT":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.BIGINT, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "INTEGER":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.INTEGER, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "DECIMAL":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.DECIMAL, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "DOUBLE PRECISION":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.DOUBLE, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "FLOAT":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.FLOAT, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "INTERVAL DAY TO SECOND":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.INTEGER, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "INTERVAL YEAR TO MONTH":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.INTEGER, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "SMALLINT":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.SMALLINT, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "TINYINT":
tempTypeDesc = new TypeDesc(DBPDataKind.NUMERIC, Types.TINYINT, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "GEOMETRY":
tempTypeDesc = new TypeDesc(DBPDataKind.STRING, Types.VARCHAR, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "BOOLEAN":
tempTypeDesc = new TypeDesc(DBPDataKind.BOOLEAN, Types.BOOLEAN, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "CHAR":
tempTypeDesc = new TypeDesc(DBPDataKind.STRING, Types.CHAR, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "VARCHAR":
tempTypeDesc = new TypeDesc(DBPDataKind.STRING, Types.VARCHAR, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "LONG VARCHAR":
tempTypeDesc = new TypeDesc(DBPDataKind.STRING, Types.LONGNVARCHAR, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "DATE":
tempTypeDesc = new TypeDesc(DBPDataKind.DATETIME, Types.DATE, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "TIMESTAMP":
tempTypeDesc = new TypeDesc(DBPDataKind.DATETIME, Types.TIMESTAMP, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
case "TIMESTAMP WITH LOCAL TIME ZONE":
tempTypeDesc = new TypeDesc(DBPDataKind.DATETIME, Types.TIMESTAMP_WITH_TIMEZONE, JDBCUtils.safeGetInt(dbResult, "PRECISION"), JDBCUtils.safeGetInt(dbResult, "MINIMUM_SCALE"), JDBCUtils.safeGetInt(dbResult, "MAXIMUM_SCALE"), JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
break;
default:
LOG.error("DataType '" + name + "' is unknown to DBeaver" );
}
this.typeDesc = tempTypeDesc;
}
@Override
public DBSObject getParentObject()
{
return parentNode;
}
@Override
public String getTypeName()
{
return name;
}
public int getEquivalentSqlType()
{
return typeDesc.sqlType;
}
@Override
public int getPrecision()
{
if (typeDesc.precision != null) {
return typeDesc.precision;
} else {
return 0;
}
}
@Nullable
@Override
public DBSDataType getComponentType(@NotNull DBRProgressMonitor monitor) throws DBCException
{
return null;
}
@Override
public int getMinScale()
{
if (typeDesc.minScale != null) {
return typeDesc.minScale;
} else {
return 0;
}
}
@Override
public int getMaxScale()
{
if (typeDesc.maxScale != null) {
return typeDesc.maxScale;
} else {
return 0;
}
}
@Override
public DBCLogicalOperator[] getSupportedOperators() {
return DBUtils.getDefaultOperators(this);
}
// -----------------
// Properties
// -----------------
@NotNull
@Override
@Property(viewable = true, editable = false, valueTransformer = DBObjectNameCaseTransformer.class, order = 1)
public String getName()
{
return name;
}
@Property(viewable = true, editable = false, order = 2)
public ExasolSchema getSchema()
{
return exasolSchema;
}
@Override
@Property(viewable = true, editable = false, order = 4)
public DBPDataKind getDataKind()
{
return typeDesc == null ? DBPDataKind.UNKNOWN : typeDesc.dataKind;
}
@Override
@Property(viewable = true, editable = false, order = 5)
public long getMaxLength()
{
return length;
}
@Override
@Property(viewable = true, editable = false, order = 6)
public int getScale()
{
return scale;
}
@Override
@Property(viewable = false, editable = false, order = 10)
public int getTypeID()
{
return typeDesc.sqlType;
}
@Property(viewable = false, editable = false, order = 11)
public Integer getExasolTypeId()
{
return exasolTypeId;
}
@Nullable
@Override
@Property(viewable = false, editable = false)
public String getDescription()
{
return null;
}
// --------------
// Helper Objects
// --------------
private static final class TypeDesc {
private final DBPDataKind dataKind;
private final Integer sqlType;
private final Integer precision;
private final Integer minScale;
private final Integer maxScale;
private final String name;
private TypeDesc(DBPDataKind dataKind, Integer sqlType, Integer precision, Integer minScale, Integer maxScale, String name)
{
this.name = name;
this.dataKind = dataKind;
this.sqlType = sqlType;
this.precision = precision;
this.minScale = minScale;
this.maxScale = maxScale;
}
}
@Override
public boolean isPersisted() {
return true;
}
@Override
public Object geTypeExtension() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getFullyQualifiedName(DBPEvaluationContext context) {
return name;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPSaveableObject;
import org.jkiss.dbeaver.model.struct.DBSObject;
public class ExasolGlobalObject implements DBSObject, DBPSaveableObject {
private final ExasolDataSource dataSource;
private boolean persisted;
protected ExasolGlobalObject(ExasolDataSource dataSource, boolean persisted)
{
this.dataSource = dataSource;
this.persisted = persisted;
}
@Nullable
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isPersisted() {
// TODO Auto-generated method stub
return persisted;
}
@Override
public void setPersisted(boolean persisted) {
this.persisted = persisted;
}
@Override
public String getDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public DBSObject getParentObject() {
// TODO Auto-generated method stub
return dataSource.getContainer();
}
@Override
public DBPDataSource getDataSource() {
// TODO Auto-generated method stub
return dataSource;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
public class ExasolGranteeCache {
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log;
//import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.exasol.model.ExasolDataSource;
import org.jkiss.dbeaver.ext.exasol.model.ExasolObject;
import org.jkiss.dbeaver.model.DBPSaveableObject;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.struct.DBSObject;
public abstract class ExasolObject<PARENT extends DBSObject> implements DBSObject, DBPSaveableObject {
private static final Log log = Log.getLog(ExasolObject.class);
protected final PARENT parent;
protected String name;
private boolean persisted;
private long objectId;
protected ExasolObject(PARENT parent, String name, long objectId, boolean persisted)
{
this.parent = parent;
this.name = name;
this.objectId = objectId;
this.persisted = persisted;
}
protected ExasolObject(PARENT parent, String name, boolean persisted)
{
this.parent = parent;
this.name = name;
this.persisted = persisted;
}
@Nullable
@Override
public String getDescription()
{
return null;
}
@Override
public PARENT getParentObject()
{
return parent;
}
@NotNull
@Override
public ExasolDataSource getDataSource()
{
return (ExasolDataSource) parent.getDataSource();
}
@NotNull
@Override
@Property(viewable = true, editable = false, order = 1)
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public long getObjectId()
{
return objectId;
}
@Override
public boolean isPersisted()
{
return persisted;
}
@Override
public void setPersisted(boolean persisted)
{
this.persisted = persisted;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.access.DBARole;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.struct.DBSObject;
public class ExasolRole implements DBARole {
private static final Log log = Log.getLog(ExasolRole.class);
private String name;
private String description;
private ExasolDataSource dataSource;
private Boolean adminOption;
public ExasolRole(ExasolDataSource dataSource, ResultSet resultSet) {
this.name = JDBCUtils.safeGetString(resultSet, "ROLE_NAME");
this.description = JDBCUtils.safeGetStringTrimmed(resultSet, "ROLE_COMMENT");
adminOption = JDBCUtils.safeGetBoolean(resultSet, "ADMIN_OPTION");
this.dataSource = dataSource;
}
@NotNull
@Override
@Property(viewable = true, order = 1)
public String getName() {
return name;
}
@Property(viewable = true, order = 10)
public String getDescription()
{
return description;
}
@Override
public DBSObject getParentObject() {
// TODO Auto-generated method stub
return dataSource.getContainer();
}
@Override
public DBPDataSource getDataSource() {
return dataSource;
}
@Override
public boolean isPersisted() {
return true;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import java.util.Collection;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTableCache;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTableForeignKeyCache;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTableUniqueKeyCache;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolViewCache;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.DBPSystemObject;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.rdb.DBSProcedureContainer;
import org.jkiss.dbeaver.model.struct.rdb.DBSSchema;
import org.jkiss.dbeaver.model.impl.DBSObjectCache;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCObjectSimpleCache;
import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCStructCache;
import org.jkiss.dbeaver.model.meta.Association;
import org.jkiss.dbeaver.model.meta.Property;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ExasolSchema extends ExasolGlobalObject implements DBSSchema, DBPRefreshableObject, DBPSystemObject,DBSProcedureContainer {
private static final String C_SCRIPT = "select "
+ "script_name,script_owner,script_language,script_type,script_result_type,script_text,script_comment,b.created "
+ "from EXA_ALL_SCRIPTS a inner join EXA_ALL_OBJECTS b "
+ "on a.script_name = b.object_name and a.script_schema = b.root_name where a.script_schema = ? order by script_name";
private static final String C_VIEWS = "select * FROM EXA_ALL_VIEWS WHERE VIEW_SCHEMA = ?";
private static final List<String> SYSTEM_SCHEMA = Arrays.asList("SYS");
private String name;
private String owner;
private Timestamp createTime;
private String remarks;
// ExasolSchema's children
private DBSObjectCache<ExasolSchema,ExasolScript> scriptCache;
private ExasolViewCache viewCache = new ExasolViewCache();
private ExasolTableCache tableCache = new ExasolTableCache();
// ExasolTable's children
private final ExasolTableUniqueKeyCache constraintCache = new ExasolTableUniqueKeyCache(tableCache);
private final ExasolTableForeignKeyCache associationCache = new ExasolTableForeignKeyCache(tableCache);
public ExasolSchema(ExasolDataSource exasolDataSource, String name)
{
super(exasolDataSource, true);
this.name = name;
this.scriptCache = new JDBCObjectSimpleCache<>(ExasolScript.class, C_SCRIPT, name );
}
public ExasolSchema(ExasolDataSource exasolDataSource, ResultSet dbResult) throws DBException {
this(exasolDataSource, JDBCUtils.safeGetStringTrimmed(dbResult, "OBJECT_NAME"));
this.owner = JDBCUtils.safeGetString(dbResult, "OWNER");
this.createTime = JDBCUtils.safeGetTimestamp(dbResult, "CREATED");
this.remarks = JDBCUtils.safeGetString(dbResult, "OBJECT_COMMENT");
this.name = JDBCUtils.safeGetString(dbResult, "OBJECT_NAME");
}
@NotNull
@Override
@Property(viewable = true, editable = false, order = 1)
public String getName()
{
return this.name;
}
@Override
public Collection<ExasolTableBase> getChildren(DBRProgressMonitor monitor) throws DBException {
List<ExasolTableBase> allChildren = new ArrayList<>();
allChildren.addAll(tableCache.getAllObjects(monitor, this));
allChildren.addAll(viewCache.getAllObjects(monitor, this));
return allChildren;
}
@Override
public ExasolTableBase getChild(DBRProgressMonitor monitor, String childName) throws DBException {
ExasolTableBase child = tableCache.getObject(monitor, this, childName);
if (child == null) {
child = viewCache.getObject(monitor, this, childName);
}
return child;
}
@Override
public Class<? extends DBSObject> getChildType(DBRProgressMonitor monitor) throws DBException {
// TODO Auto-generated method stub
return null;
}
@Override
public void cacheStructure(DBRProgressMonitor monitor, int scope) throws DBException {
if (((scope & STRUCT_ENTITIES) != 0 ))
{
monitor.subTask("Cache tables");
tableCache.getAllObjects(monitor, this);
monitor.subTask("Cache Views");
viewCache.getAllObjects(monitor, this);
}
if (((scope & STRUCT_ATTRIBUTES) != 0 ))
{
monitor.subTask("Cache table columns");
tableCache.loadChildren(monitor, this, null);
monitor.subTask("Cache Views");
viewCache.loadChildren(monitor, this, null);
}
if ((scope & STRUCT_ASSOCIATIONS) != 0) {
monitor.subTask("Cache table unique keys");
constraintCache.getObjects(monitor, this, null);
monitor.subTask("Cache table foreign keys");
associationCache.getObjects(monitor, this, null);
}
}
// -----------------
// Associations
// -----------------
@Association
public Collection<ExasolTable> getTables(DBRProgressMonitor monitor) throws DBException
{
return tableCache.getTypedObjects(monitor, this, ExasolTable.class);
}
public ExasolTable getTable(DBRProgressMonitor monitor, String name) throws DBException
{
return tableCache.getObject(monitor, this, name, ExasolTable.class);
}
@Association
public Collection<ExasolView> getViews(DBRProgressMonitor monitor) throws DBException
{
return viewCache.getTypedObjects(monitor, this, ExasolView.class);
}
public ExasolView getView(DBRProgressMonitor monitor, String name) throws DBException
{
return viewCache.getObject(monitor, this, name, ExasolView.class);
}
@Override
public boolean isSystem() {
// TODO Auto-generated method stub
return SYSTEM_SCHEMA.contains(name);
}
@Override
public Collection<ExasolScript> getProcedures(DBRProgressMonitor monitor) throws DBException {
return scriptCache.getAllObjects(monitor, this);
}
@Override
public ExasolScript getProcedure(DBRProgressMonitor monitor, String uniqueName) throws DBException {
return scriptCache.getObject(monitor, this, uniqueName);
}
@Override
public DBSObject refreshObject(DBRProgressMonitor monitor) throws DBException {
scriptCache.clearCache();
tableCache.clearCache();
viewCache.clearCache();
constraintCache.clearCache();
associationCache.clearCache();
return this;
}
@Override
public String toString()
{
return "Schema "+ name;
}
@Property(viewable = true, editable = false, order = 2)
public Timestamp getCreateTime()
{
return createTime;
}
@Property(viewable = true, editable = false, order = 3)
public String getDescription()
{
return remarks;
}
@Property(viewable = true, editable = false, order = 4)
public String getOwner()
{
return owner;
}
public ExasolTableCache getTableCache() {
return tableCache;
}
public ExasolViewCache getViewCache()
{
return viewCache;
}
public ExasolTableUniqueKeyCache getConstraintCache()
{
return constraintCache;
}
public ExasolTableForeignKeyCache getAssociationCache()
{
return associationCache;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPQualifiedObject;
import org.jkiss.dbeaver.model.DBUtils;
public class ExasolSchemaObject extends ExasolObject<ExasolSchema> implements DBPQualifiedObject {
public ExasolSchemaObject(ExasolSchema schema, String name, boolean persisted) {
super(schema, name, persisted);
}
@NotNull
@Override
public String getFullyQualifiedName(DBPEvaluationContext context) {
return DBUtils.getFullQualifiedName(getDataSource(), getParentObject(),this);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2016-2016 Karl Griesser (fullref@gmail.com)
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.Collection;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.ExasolConstants;
import org.jkiss.dbeaver.ext.exasol.editors.ExasolSourceObject;
import org.jkiss.dbeaver.ext.exasol.model.dict.ExasolScriptLanguage;
import org.jkiss.dbeaver.ext.exasol.model.dict.ExasolScriptResultType;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectState;
import org.jkiss.dbeaver.model.struct.rdb.DBSProcedure;
import org.jkiss.dbeaver.model.struct.rdb.DBSProcedureParameter;
import org.jkiss.dbeaver.model.struct.rdb.DBSProcedureType;
import org.jkiss.utils.CommonUtils;
/**
* Exasol Scripts
*
* @author Karl Griesser
*/
public class ExasolScript extends ExasolObject<DBSObject> implements DBSProcedure, DBPRefreshableObject, ExasolSourceObject {
private String remarks;
private Timestamp createTime;
private String owner;
private ExasolScriptLanguage scriptLanguage;
private String scriptSQL;
private ExasolScriptResultType scriptReturnType;
private String script_type;
private ExasolSchema exasolSchema;
public ExasolScript(DBSObject owner, ResultSet dbResult)
{
super(owner, JDBCUtils.safeGetString(dbResult, "SCRIPT_NAME"), true);
this.owner = JDBCUtils.safeGetString(dbResult, "SCRIPT_OWNER");
this.createTime = JDBCUtils.safeGetTimestamp(dbResult, "CREATED");
this.remarks =JDBCUtils.safeGetString(dbResult, "SCRIPT_COMMENT");
this.scriptLanguage = CommonUtils.valueOf(ExasolScriptLanguage.class, JDBCUtils.safeGetString(dbResult, "SCRIPT_LANGUAGE"));
this.scriptReturnType = CommonUtils.valueOf(ExasolScriptResultType.class, JDBCUtils.safeGetString(dbResult, "SCRIPT_RESULT_TYPE"));
this.scriptSQL = JDBCUtils.safeGetString(dbResult, "SCRIPT_TEXT");
this.name = JDBCUtils.safeGetString(dbResult, "SCRIPT_NAME");
this.script_type = JDBCUtils.safeGetString(dbResult, "SCRIPT_TYPE");
exasolSchema = (ExasolSchema) owner;
}
// -----------------
// Business Contract
// -----------------
@NotNull
@Override
public DBSObjectState getObjectState()
{
return DBSObjectState.UNKNOWN;
}
@Override
public void refreshObjectState(@NotNull DBRProgressMonitor monitor) throws DBCException
{
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
return this;
}
// -----------------------
// Properties
// -----------------------
@NotNull
@Override
@Property(viewable = true, order = 1)
public String getName() {
return this.name;
}
@Property(viewable = true, order = 2)
public ExasolSchema getSchema()
{
return exasolSchema;
}
@Property(viewable = true, order = 5)
public ExasolScriptLanguage getLanguage()
{
return scriptLanguage;
}
@Property(viewable = false, order = 10)
public ExasolScriptResultType getResultType()
{
return scriptReturnType;
}
@Nullable
@Override
@Property(viewable = false, order = 11)
public String getDescription()
{
return this.remarks;
}
@Nullable
@Property(viewable = false, order = 12)
public String getType()
{
return this.script_type;
}
@NotNull
@Property(viewable = false, order = 15)
public String getSql()
{
return this.scriptSQL;
}
@NotNull
@Property(viewable= true, order = 6)
public Timestamp getCreationTime()
{
return this.createTime;
}
@Property(viewable = false, category = ExasolConstants.CAT_OWNER)
public String getOwner()
{
return owner;
}
@Override
public DBSObject getContainer() {
return exasolSchema;
}
@Override
public DBSProcedureType getProcedureType() {
return null;
}
@Override
public Collection<? extends DBSProcedureParameter> getParameters(DBRProgressMonitor monitor) throws DBException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getFullyQualifiedName(DBPEvaluationContext context) {
return name;
}
@Override
public String getObjectDefinitionText(DBRProgressMonitor monitor) throws DBException
{
return this.scriptSQL;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.struct.AbstractObjectReference;
import org.jkiss.dbeaver.model.impl.struct.RelationalObjectType;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectReference;
import org.jkiss.dbeaver.model.struct.DBSObjectType;
import org.jkiss.dbeaver.model.struct.DBSStructureAssistant;
import org.jkiss.utils.CommonUtils;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ExasolStructureAssistant implements DBSStructureAssistant {
private static final Log LOG = Log.getLog(ExasolStructureAssistant.class);
/**
* Exasol Structure Assistant
*
* @author Karl Griesser
*/
// TODO DF: Work in progess
private final ExasolDataSource dataSource;
// -----------------
// Constructors
// -----------------
public ExasolStructureAssistant(ExasolDataSource dataSource) {
this.dataSource = dataSource;
}
// -----------------
// Method Interface
// -----------------
public DBSObjectType[] getSupportedObjectTypes()
{
return new DBSObjectType[] {
RelationalObjectType.TYPE_TABLE,
RelationalObjectType.TYPE_PROCEDURE,
RelationalObjectType.TYPE_CONSTRAINT
};
}
public DBSObjectType[] getHyperlinkObjectTypes()
{
return getSupportedObjectTypes();
}
public DBSObjectType[] getAutoCompleteObjectTypes()
{
return getSupportedObjectTypes();
}
@Override
public Collection<DBSObjectReference> findObjectsByMask(DBRProgressMonitor monitor, DBSObject parentObject,
DBSObjectType[] objectTypes, String objectNameMask, boolean caseSensitive, boolean globalSearch,
int maxResults) throws DBException {
// TODO Auto-generated method stub
return null;
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.ExasolConstants;
import org.jkiss.dbeaver.ext.exasol.tools.ExasolUtils;
import org.jkiss.dbeaver.ext.exasol.editors.ExasolSourceObject;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.data.DBDPseudoAttribute;
import org.jkiss.dbeaver.model.data.DBDPseudoAttributeContainer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCStructCache;
import org.jkiss.dbeaver.model.meta.Association;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectState;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableForeignKey;
import java.sql.Timestamp;
import java.util.Collection;
/**
* @author Karl
*
*/
public class ExasolTable extends ExasolTableBase implements DBPRefreshableObject, DBPNamedObject2, DBDPseudoAttributeContainer, ExasolSourceObject {
private Boolean hasDistKey;
private Timestamp lastCommit;
private long sizeRaw;
private long sizeCompressed;
private float deletePercentage;
private Timestamp createTime;
public ExasolTable(DBRProgressMonitor monitor, ExasolSchema schema, ResultSet dbResult) {
super(monitor, schema, dbResult);
this.hasDistKey = JDBCUtils.safeGetBoolean(dbResult, "TABLE_HAS_DISTRIBUTION_KEY");
this.lastCommit = JDBCUtils.safeGetTimestamp(dbResult, "LAST_COMMIT");
this.sizeRaw = JDBCUtils.safeGetLong(dbResult, "RAW_OBJECT_SIZE");
this.sizeCompressed = JDBCUtils.safeGetLong(dbResult, "MEM_OBJECT_SIZE");
this.deletePercentage = JDBCUtils.safeGetFloat(dbResult, "DELETE_PERCENTAGE");
this.createTime = JDBCUtils.safeGetTimestamp(dbResult, "CREATED");
}
public ExasolTable(ExasolSchema schema, String name)
{
super(schema,name,false);
}
// -----------------
// Properties
// -----------------
@Property(viewable = false, editable = false, order = 90, category = ExasolConstants.CAT_BASEOBJECT)
public Boolean getHasDistKey()
{
return hasDistKey;
}
@Property(viewable = false, editable = false, order = 100, category = ExasolConstants.CAT_BASEOBJECT)
public Timestamp getLastCommit()
{
return lastCommit;
}
@Property(viewable = false, editable = false, order = 100, category = ExasolConstants.CAT_DATETIME)
public Timestamp getCreateTime()
{
return createTime;
}
@Property(viewable = false, editable = false, order = 150, category = ExasolConstants.CAT_STATS)
public String getRawsize()
{
return ExasolUtils.humanReadableByteCount(sizeRaw, true);
}
@Property(viewable = false, editable = false, order = 200, category = ExasolConstants.CAT_STATS)
public String getCompressedsize()
{
return ExasolUtils.humanReadableByteCount(sizeCompressed, true);
}
@Property(viewable = false, editable = false, order = 250, category = ExasolConstants.CAT_STATS)
public float getDeletePercentage()
{
return this.deletePercentage;
}
// -----------------
// Associations
// -----------------
@Nullable
@Override
@Association
public Collection<ExasolTableUniqueKey> getConstraints(@NotNull DBRProgressMonitor monitor) throws DBException
{
return getContainer().getConstraintCache().getObjects(monitor, getContainer(), this);
}
public ExasolTableUniqueKey getConstraint(DBRProgressMonitor monitor, String ukName) throws DBException
{
return getContainer().getConstraintCache().getObject(monitor, getContainer(), this, ukName);
}
@Override
@Association
public Collection<ExasolTableForeignKey> getAssociations(@NotNull DBRProgressMonitor monitor) throws DBException
{
return getContainer().getAssociationCache().getObjects(monitor, getContainer(), this);
}
public DBSTableForeignKey getAssociation(DBRProgressMonitor monitor, String ukName) throws DBException
{
return getContainer().getAssociationCache().getObject(monitor, getContainer(), this, ukName);
}
// -----------------
// Business Contract
// -----------------
@Override
public boolean isView()
{
return false;
}
@Override
public JDBCStructCache<ExasolSchema, ExasolTable, ExasolTableColumn> getCache()
{
return getContainer().getTableCache();
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
super.refreshObject(monitor);
getContainer().getTableCache().clearChildrenCache(this);
getContainer().getConstraintCache().clearObjectCache(this);
getContainer().getAssociationCache().clearObjectCache(this);
return this;
}
@Override
public String getObjectDefinitionText(DBRProgressMonitor monitor) throws DBException {
return ExasolUtils.generateDDLforTable(monitor, this.getDataSource(), this);
}
@Override
public DBSObjectState getObjectState() {
// table can only be in state normal
return DBSObjectState.NORMAL;
}
@Override
public DBDPseudoAttribute[] getPseudoAttributes() throws DBException {
return new DBDPseudoAttribute[] {ExasolConstants.PSEUDO_ATTR_RID_BIT};
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Collections;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.editors.ExasolStatefulObject;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAssociation;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex;
/**
* @author Karl Griesser
*
*/
public abstract class ExasolTableBase extends JDBCTable<ExasolDataSource, ExasolSchema> implements DBPNamedObject2, DBPRefreshableObject, ExasolStatefulObject {
private String owner;
private String remarks;
private String objectType;
public ExasolTableBase(ExasolSchema schema, String name,boolean persisted) {
super(schema, name, persisted);
}
public ExasolTableBase(DBRProgressMonitor monitor, ExasolSchema schema, ResultSet dbResult)
{
super(schema,true);
setName(JDBCUtils.safeGetString(dbResult, "TABLE_NAME"));
this.owner = JDBCUtils.safeGetString(dbResult, "TABLE_OWNER");
this.remarks = JDBCUtils.safeGetString(dbResult, "TABLE_COMMENT");
this.objectType = JDBCUtils.safeGetString(dbResult, "OBJECT_TYPE");
}
@Override
public String getDescription() {
return remarks;
}
@Override
public boolean isView() {
if (objectType.equals("VIEW"))
return true;
else
return false;
}
// -----------------
// Business Contract
// -----------------
@Override
public void refreshObjectState(@NotNull DBRProgressMonitor monitor) throws DBCException
{
}
@NotNull
@Override
public String getFullyQualifiedName(DBPEvaluationContext context)
{
return DBUtils.getFullQualifiedName(getDataSource(), getSchema(), this);
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
return this;
}
// -----------------
// Columns
// -----------------
@Override
public Collection<ExasolTableColumn> getAttributes(@NotNull DBRProgressMonitor monitor) throws DBException
{
if (this instanceof ExasolTable)
return getContainer().getTableCache().getChildren(monitor, getContainer(), (ExasolTable) this);
if (this instanceof ExasolView)
return getContainer().getViewCache().getChildren(monitor, getContainer(), (ExasolView) this);
throw new DBException("Unknow object with columns encountered");
}
@Override
public ExasolTableColumn getAttribute(@NotNull DBRProgressMonitor monitor, @NotNull String attributeName) throws DBException
{
if (this instanceof ExasolTable) {
return getContainer().getTableCache().getChild(monitor, getContainer(), (ExasolTable) this, attributeName);
}
// Other kinds don't have columns..
throw new DBException("Unknown object with columns encountered");
}
// -----------------
// Properties
// -----------------
@NotNull
@Override
@Property(viewable = true, editable = false, valueTransformer = DBObjectNameCaseTransformer.class, order = 1)
public String getName()
{
return super.getName();
}
@Override
@Property(viewable = true, editable = false, order = 2)
public ExasolSchema getSchema()
{
return super.getContainer();
}
@Property(viewable = true, editable = false, order = 3)
public String getOwner()
{
return owner;
}
// -----------------
// Associations (Imposed from DBSTable). In Exasol, Most of objects "derived"
// from Tables don't have those..
// -----------------
@Override
public Collection<? extends DBSEntityAssociation> getReferences(DBRProgressMonitor monitor) throws DBException {
return Collections.emptyList();
}
@Nullable
@Override
public Collection<ExasolTableUniqueKey> getConstraints(DBRProgressMonitor monitor) throws DBException {
return Collections.emptyList();
}
@Override
public Collection<ExasolTableForeignKey> getAssociations(DBRProgressMonitor monitor) throws DBException {
return Collections.emptyList();
}
@Override
public Collection<? extends DBSTableIndex> getIndexes(DBRProgressMonitor monitor) throws DBException {
// No Indexes in Exasol
return Collections.emptyList();
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.time.format.FormatStyle;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.editors.ExasolColumnDataTypeListProvider;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPHiddenObject;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.impl.DBPositiveNumberTransformer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTableColumn;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSTypedObjectEx;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn;
/**
* @author Karl Griesser
*
*/
public class ExasolTableColumn extends JDBCTableColumn<ExasolTableBase>
implements DBSTableColumn, DBSTypedObjectEx, DBPHiddenObject, DBPNamedObject2 {
private ExasolDataType dataType;
private Boolean identity;
private BigDecimal identityValue;
private Integer keySeq;
private String remarks;
private Boolean isInDistKey;
private String formatType;
private Boolean changed = false;
// -----------------
// Constructors
// -----------------
public ExasolTableColumn(DBRProgressMonitor monitor, ExasolTableBase tableBase, ResultSet dbResult)
throws DBException {
super(tableBase, true);
this.formatType = JDBCUtils.safeGetString(dbResult, "COLUMN_TYPE");
setName(JDBCUtils.safeGetString(dbResult, "COLUMN_NAME"));
setOrdinalPosition(JDBCUtils.safeGetInt(dbResult, "ORDINAL_POSITION"));
setRequired(JDBCUtils.safeGetBoolean(dbResult, "COLUMN_IS_NULLABLE"));
setDefaultValue(JDBCUtils.safeGetString(dbResult, "COLUMN_DEF"));
setMaxLength(JDBCUtils.safeGetInt(dbResult, "COLUMN_SIZE"));
setScale(JDBCUtils.safeGetInt(dbResult, "DECIMAL_DIGITS"));
this.isInDistKey = JDBCUtils.safeGetBoolean(dbResult, "COLUMN_IS_DISTRIBUTION_KEY");
this.identity = JDBCUtils.safeGetInteger(dbResult, "COLUMN_IDENTITY") == null ? false : true;
if (identity)
this.identityValue = JDBCUtils.safeGetBigDecimal(dbResult, "COLUMN_IDENTITY");
this.remarks = JDBCUtils.safeGetString(dbResult, "COLUMN_COMMENT");
this.dataType = tableBase.getDataSource().getDataType(monitor, JDBCUtils.safeGetString(dbResult, "TYPE_NAME"));
this.keySeq = JDBCUtils.safeGetInteger(dbResult, "KEY_SEQ");
this.changed = true;
}
public ExasolTableColumn(ExasolTableBase tableBase) {
super(tableBase, false);
setMaxLength(50L);
setOrdinalPosition(-1);
this.dataType = tableBase.getDataSource().getDataTypeCache().getCachedObject("VARCHAR");
setTypeName(dataType.getFullyQualifiedName(DBPEvaluationContext.DML));
setRequired(true);
}
// -----------------
// Business Contract
// -----------------
@NotNull
@Override
public ExasolDataSource getDataSource() {
return getTable().getDataSource();
}
@Override
public DBPDataKind getDataKind() {
return dataType.getDataKind();
}
@Override
public String getTypeName() {
return this.dataType.getName();
}
// -----------------
// Properties
// -----------------
@Property(viewable = true, editable = false, order = 19)
public ExasolTableBase getOwner() {
return getTable();
}
@Nullable
@Property(viewable = true, editable = true, updatable = true, order = 21, listProvider = ExasolColumnDataTypeListProvider.class)
public DBSDataType getDataType() {
return dataType;
}
public void setDataType(ExasolDataType dataType) {
if (! this.dataType.getTypeName().equals(dataType))
this.changed = true;
this.dataType = dataType;
}
@Override
@Property(viewable = true,editable = true, updatable = true, order = 38)
public long getMaxLength() {
return super.getMaxLength();
}
public void setMaxLength(long maxLength) {
if (this.maxLength != maxLength)
this.changed = true;
super.setMaxLength(maxLength);
}
@Override
@Property(viewable = true, editable = true, updatable = true,valueRenderer = DBPositiveNumberTransformer.class, order = 39)
public int getScale() {
return super.getScale();
}
public void setScale(int scale) {
if ( this.scale != scale)
this.changed = true;
super.setScale(scale);
}
@Property(viewable = true, editable = true, updatable =true, order = 46)
@Nullable
public BigDecimal getIdentityValue() {
return this.identityValue;
}
public void setIdentityValue(BigDecimal identityValue) {
this.identityValue = identityValue;
}
@Property(viewable = false, order = 40)
public String getStringLength() {
return "";
}
@Override
@Property(viewable = false, editable = true, updatable = true, valueRenderer = DBPositiveNumberTransformer.class, order = 42)
public int getPrecision() {
return super.getPrecision();
}
public void setPrecision(int precision) {
if (this.precision != precision)
this.changed = true;
super.precision = precision;
this.precision = precision;
}
@Override
@Property(viewable = true, order = 43, editable = true, updatable = true)
public boolean isRequired() {
return super.isRequired();
}
public void setRequired(boolean required) {
super.setRequired(required);
}
@Override
@Property(viewable = true, order = 44, editable = true, updatable = true)
public String getDefaultValue() {
return super.getDefaultValue();
}
public void setDefaultValue(String defaultValue) {
super.setDefaultValue(defaultValue);
}
@Property(viewable = true,editable = true, updatable = true, order = 45)
public Boolean isIdentity() {
return identity;
}
public void setIdentity(Boolean identity) {
this.identity = identity;
}
@Nullable
@Override
@Property(viewable = true, order = 999, editable = true, updatable = true)
public String getDescription() {
return remarks;
}
public void setDescription(String remarks) {
this.remarks = remarks;
}
@Property(viewable = false, order = 120)
public Integer getKeySeq() {
return keySeq;
}
@Property(viewable = false, order = 121)
public Boolean isDistKey() {
return isInDistKey;
}
// no hidden columns supported in exasol
@Override
public boolean isHidden() {
return false;
}
public String getFormatType() {
if (changed) {
switch(this.dataType.getTypeName()) {
case "VARCHAR":
case "CHAR":
this.scale = 0;
return dataType.getTypeName() + "(" + Long.toString(this.maxLength) + ")";
case "DECIMAL":
return dataType.getTypeName() + "(" + Long.toString(this.maxLength) + "," + Long.toString(this.scale) + ")";
default:
return dataType.getTypeName();
}
}
return this.formatType;
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import java.util.List;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.tools.ExasolUtils;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTableConstraint;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAttributeRef;
import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType;
import org.jkiss.dbeaver.model.struct.rdb.DBSForeignKeyModifyRule;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableForeignKey;
/**
* @author Karl
*
*/
public class ExasolTableForeignKey extends JDBCTableConstraint<ExasolTable> implements DBSTableForeignKey {
private ExasolTable refTable;
private Boolean enabled;
private List<ExasolTableKeyColumn> columns;
private ExasolTableUniqueKey referencedKey;
// -----------------
// Constructor
// -----------------
public ExasolTableForeignKey(DBRProgressMonitor monitor, ExasolTable exasolTable, ResultSet dbResult) throws DBException
{
super(exasolTable,JDBCUtils.safeGetString(dbResult, "CONSTRAINT_NAME"), null, DBSEntityConstraintType.FOREIGN_KEY, true );
String refSchemaName = JDBCUtils.safeGetString(dbResult, "REFERENCED_SCHEMA");
String refTableName = JDBCUtils.safeGetString(dbResult, "REFERENCED_TABLE");
String constName = JDBCUtils.safeGetString(dbResult, "REF_PK_NAME");
refTable = ExasolUtils.findTableBySchemaNameAndName(monitor, exasolTable.getDataSource(), refSchemaName, refTableName );
enabled = JDBCUtils.safeGetBoolean(dbResult, "CONSTRAINT_ENABLED");
referencedKey = refTable.getConstraint(monitor, constName);
}
public ExasolTableForeignKey(ExasolTable exasolTable, ExasolTableUniqueKey referencedKey, Boolean enabled)
{
super(exasolTable, null, null, DBSEntityConstraintType.FOREIGN_KEY, true);
this.referencedKey = referencedKey;
this.enabled = enabled;
}
// -----------------
// Business Contract
// -----------------
@NotNull
@Override
public DBPDataSource getDataSource()
{
return getTable().getDataSource();
}
@Override
public ExasolTable getAssociatedEntity()
{
return refTable;
}
@NotNull
@Override
public String getFullyQualifiedName(DBPEvaluationContext context)
{
return DBUtils.getFullQualifiedName(getDataSource(), getTable().getContainer(), getTable(), this);
}
@NotNull
@Override
public DBSForeignKeyModifyRule getUpdateRule()
{
if (this.enabled) {
return DBSForeignKeyModifyRule.RESTRICT;
}
else
{
return DBSForeignKeyModifyRule.NO_ACTION;
}
}
@NotNull
@Override
public DBSForeignKeyModifyRule getDeleteRule()
{
if (this.enabled) {
return DBSForeignKeyModifyRule.RESTRICT;
}
else
{
return DBSForeignKeyModifyRule.NO_ACTION;
}
}
// -----------------
// Columns
// -----------------
@Override
public List<? extends DBSEntityAttributeRef> getAttributeReferences(DBRProgressMonitor monitor) throws DBException
{
return columns;
}
public void setColumns(List<ExasolTableKeyColumn> columns)
{
this.columns = columns;
}
// -----------------
// Properties
// -----------------
@Property(viewable = true, order = 3)
public ExasolTable getReferencedTable()
{
return refTable;
}
@Nullable
@NotNull
@Override
@Property(id = "reference", viewable = false)
public ExasolTableUniqueKey getReferencedConstraint()
{
return referencedKey;
}
@Property(viewable = true, editable = true)
public Boolean getEnabled()
{
return this.enabled;
}
public void setEnabled(Boolean enabled)
{
this.enabled = enabled;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraint;
import org.jkiss.dbeaver.model.impl.struct.AbstractTableConstraintColumn;
import org.jkiss.dbeaver.model.meta.Property;
/**
* @author Karl Griesser
*
*/
public class ExasolTableKeyColumn extends AbstractTableConstraintColumn {
private AbstractTableConstraint<ExasolTable> constraint;
private ExasolTableColumn tableColumn;
private Integer ordinalPosition;
// -----------------
// Constructors
// -----------------
public ExasolTableKeyColumn(AbstractTableConstraint<ExasolTable> constraint, ExasolTableColumn tableColumn, Integer ordinalPosition) {
this.constraint = constraint;
this.tableColumn = tableColumn;
this.ordinalPosition = ordinalPosition;
}
@Override
public AbstractTableConstraint<ExasolTable> getParentObject() {
return constraint;
}
@Override
@NotNull
public DBPDataSource getDataSource() {
return constraint.getTable().getDataSource();
}
// -----------------
// Properties
// -----------------
@NotNull
@Override
public String getName()
{
return tableColumn.getName();
}
@NotNull
@Override
@Property(id = "name", viewable = true, order = 1)
public ExasolTableColumn getAttribute()
{
return tableColumn;
}
@Override
@Property(viewable = true, editable = false, order = 3)
public int getOrdinalPosition()
{
return ordinalPosition;
}
@Nullable
@Override
public String getDescription()
{
return tableColumn.getDescription();
}
}
/**
*
*/
package org.jkiss.dbeaver.ext.exasol.model;
import java.sql.ResultSet;
import java.util.List;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTableConstraint;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.ExasolConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAttributeRef;
import org.jkiss.dbeaver.model.struct.DBSEntityConstraintType;
/**
* @author Karl Griesser
*
*/
public class ExasolTableUniqueKey extends JDBCTableConstraint<ExasolTable> {
private String owner;
private Boolean enabled;
private List<ExasolTableKeyColumn> columns;
// CONSTRUCTOR
public ExasolTableUniqueKey(DBRProgressMonitor monitor, ExasolTable table, ResultSet dbResult, DBSEntityConstraintType type)
throws DBException
{
super(table,JDBCUtils.safeGetString(dbResult, "CONSTRAINT_NAME"),null,type,true);
this.owner = JDBCUtils.safeGetString(dbResult, "CONSTRAINT_OWNER");
this.enabled = JDBCUtils.safeGetBoolean(dbResult, "CONSTRAINT_ENABLED");
}
public ExasolTableUniqueKey(ExasolTable exasolTable, DBSEntityConstraintType constraintType)
{
super(exasolTable,null,null,constraintType,false);
}
// -----------------
// Business Contract
// -----------------
@NotNull
@Override
public String getFullyQualifiedName(DBPEvaluationContext context)
{
return DBUtils.getFullQualifiedName(getDataSource(), getTable().getContainer(), getTable(), this);
}
@NotNull
@Override
public DBPDataSource getDataSource()
{
return getTable().getDataSource();
}
// -----------------
// Columns
// -----------------
@Override
public List<? extends DBSEntityAttributeRef> getAttributeReferences(DBRProgressMonitor monitor) throws DBException
{
return columns;
}
public void setColumns(List<ExasolTableKeyColumn> columns)
{
this.columns = columns;
}
// -----------------
// Properties
// -----------------
@Override
@Property(viewable = true, editable = false, order = 2)
public ExasolTable getTable()
{
return super.getTable();
}
@NotNull
@Override
@Property(viewable = true, editable = false, order = 3)
public DBSEntityConstraintType getConstraintType()
{
return super.getConstraintType();
}
@Nullable
@Override
@Property(viewable = false, editable = false, order = 4)
public String getDescription()
{
return null;
}
@Property(viewable = false, editable = false, category = ExasolConstants.CAT_OWNER)
public String getOwner()
{
return owner;
}
@Property(viewable = false, editable = false)
public Boolean getEnabled()
{
return enabled;
}
}
package org.jkiss.dbeaver.ext.exasol.model;
public class ExasolXMLString {
}
package org.jkiss.dbeaver.ext.exasol.model.dict;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.DBPNamedObject;
public enum ExasolScriptLanguage implements DBPNamedObject {
R("R"),
LUA("LUA"),
JAVA("JAVA");
private String name;
private ExasolScriptLanguage(String name) {
this.name = name;
}
@Override
public String toString()
{
return name;
}
@Override
@NotNull
public String getName() {
return name;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册