Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

#21583 support StarRocks database connector #22754

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions plugins/org.jkiss.dbeaver.ext.mysql/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,35 @@
<!--<property name="@dbeaver-default-resultset.format.datetime.native" value="true"/>-->
<parameter name="krb5.enabled" value="true"/>
</driver>
<driver
id="starRocks"
label="StarRocks"
icon="icons/starRocks_icon.png"
iconBig="icons/starRocks_icon_big.png"
logoImage="icons/starRocks_logo.png"
class="com.mysql.cj.jdbc.Driver"
sampleURL="jdbc:mysql://{host}[:{port}]/[{database}]"
useURL="false"
defaultPort="9030"
defaultUser="root"
webURL="https://docs.starrocks.io/docs/quick_start/shared-nothing/"
description="Driver for MySQL 8 and StarRocks"
categories="sql">

<file type="jar" path="maven:/com.mysql:mysql-connector-j:RELEASE[8.3.0]" bundle="!drivers.mysql"/>
<file type="license" path="https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt" bundle="!drivers.mysql"/>
<file type="license" path="drivers/mysql/LICENSE.txt" bundle="drivers.mysql"/>
<file type="jar" path="drivers/mysql/mysql8" bundle="drivers.mysql"/>
<property name="connectTimeout" value="20000"/>
<parameter name="supports-partitions" value="false"/>
<parameter name="supports-references" value="false"/>
<parameter name="supports-triggers" value="false"/>
<parameter name="supports-events" value="false"/>
<parameter name="supports-users" value="false"/>
<parameter name="supports-charsets" value="false"/>
<parameter name="supports-collations" value="false"/>
<parameter name="supportsClients" value="false"/>
</driver>
<provider-properties drivers="*">
<propertyGroup label="Advanced">
<property id="@dbeaver-serverTimezone@" label="Server Time Zone" type="string"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,23 @@ protected void addStructObjectCreateActions(DBRProgressMonitor monitor, DBCExecu

@Override
protected void appendTableModifiers(DBRProgressMonitor monitor, MySQLTableBase tableBase, NestedObjectCommand tableProps, StringBuilder ddl, boolean alter) {
if (tableBase instanceof MySQLTable) {
MySQLTable table = (MySQLTable) tableBase;
if (tableBase instanceof MySQLTable table) {
try {
final MySQLDataSource dataSource = table.getDataSource();
final MySQLTable.AdditionalInfo additionalInfo = table.getAdditionalInfo(monitor);
if ((!table.isPersisted() || tableProps.getProperty("engine") != null) && additionalInfo.getEngine() != null) { //$NON-NLS-1$
ddl.append("\nENGINE=").append(additionalInfo.getEngine().getName()); //$NON-NLS-1$
}
if ((!table.isPersisted() || tableProps.getProperty("charset") != null) && additionalInfo.getCharset() != null) { //$NON-NLS-1$
if (dataSource.supportsCharsets() &&
(!table.isPersisted() || tableProps.getProperty("charset") != null) && //$NON-NLS-1$
additionalInfo.getCharset() != null
) {
ddl.append("\nDEFAULT CHARSET=").append(additionalInfo.getCharset().getName()); //$NON-NLS-1$
}
if ((!table.isPersisted() || tableProps.getProperty("collation") != null) && additionalInfo.getCollation() != null) { //$NON-NLS-1$
if (dataSource.supportsCollations() &&
(!table.isPersisted() || tableProps.getProperty("collation") != null) && //$NON-NLS-1$
additionalInfo.getCollation() != null
) {
ddl.append("\nCOLLATE=").append(additionalInfo.getCollation().getName()); //$NON-NLS-1$
}
if ((!table.isPersisted() || tableProps.getProperty(DBConstants.PROP_ID_DESCRIPTION) != null) && table.getDescription() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,22 @@ public boolean supportsTriggers() {
return CommonUtils.getBoolean(getContainer().getDriver().getDriverParameter("supports-triggers"), true);
}

/**
* Returns true if the charsets information is supported. Ex. for table creation.
*/
@Association
public boolean supportsCharsets() {
return CommonUtils.getBoolean(getContainer().getDriver().getDriverParameter("supports-charsets"), true);
}

/**
* Returns true if the collation information is supported. Ex. for table creation.
*/
@Association
public boolean supportsCollations() {
return CommonUtils.getBoolean(getContainer().getDriver().getDriverParameter("supports-collations"), true);
}

/**
* Returns true if local clients using is supported.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public enum Status {
DISABLED,
DELETING,
DELETED,
UNKNOWN
UNKNOWN,
INSTALLED // StarRocks
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public class MySQLTableColumn extends JDBCTableColumn<MySQLTableBase> implements
public enum KeyType implements JDBCColumnKeyType {
PRI,
UNI,
MUL;
MUL,
DUP, AGG; // StarRocks

@Override
public boolean isInUniqueKey()
Expand Down