Skip to content

Commit

Permalink
Merge branch 'devel' into ci/skip-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider authored Nov 15, 2024
2 parents a270194 + 2558094 commit 4d5bcfe
Show file tree
Hide file tree
Showing 25 changed files with 626 additions and 160 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# DBeaver Common
[![CI](https://github.com/dbeaver/dbeaver-common/actions/workflows/push-pr-devel.yml/badge.svg)](https://github.com/dbeaver/dbeaver-jdbc-libsql/actions/workflows/push-pr-devel.yml)
[![Apache 2.0](https://img.shields.io/github/license/cronn-de/jira-sync.svg)](http://www.apache.org/licenses/LICENSE-2.0)

Common utils and dependencies for all [DBeaver](https://github.com/dbeaver) projects

Expand All @@ -11,3 +13,45 @@ It must be checked out in the same directory where the main repository is locate
What is inside:
- root: root Maven module for all projects. Defines base properties and dependencies (such as Tycho)
- modules: base Java utilities

## Modules:

### [org.jkiss.utils](modules%2Forg.jkiss.utils)

Various utilities (similar to Apache Commons and Google Guava).
#### Maven:
```xml
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>org.jkiss.utils</artifactId>
<version>2.2.0</version>
</dependency>
```

### [com.dbeaver.jdbc.api](modules%2Fcom.dbeaver.jdbc.api)

Base module for custom JDBC drivers development.
Contains utility classes and classes implementing JDBC interfaces for
driver, connection, statements, result sets and metadata read.

#### Maven:
```xml
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.jdbc.api</artifactId>
<version>2.2.0</version>
</dependency>
```

### [com.dbeaver.rpc](modules%2Fcom.dbeaver.rpc)

Simple RPC client-server implementation.

#### Maven:
```xml
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.rpc</artifactId>
<version>2.2.0</version>
</dependency>
```
2 changes: 1 addition & 1 deletion modules/com.dbeaver.jdbc.api/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: DBeaver JDBC API Extensions
Bundle-Vendor: DBeaver Corp
Bundle-SymbolicName: com.dbeaver.jdbc.api
Bundle-Version: 2.2.0.qualifier
Bundle-Version: 2.3.1.qualifier
Bundle-Release-Date: 20240205
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.jkiss.utils
Expand Down
75 changes: 52 additions & 23 deletions modules/com.dbeaver.jdbc.api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.common.modules</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.dbeaver.jdbc.api</artifactId>
<name>JDBC framework</name>
<packaging>eclipse-plugin</packaging>

<dependencies>
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>org.jkiss.utils</artifactId>
</dependency>
</dependencies>

<build>
<sourceDirectory>${project.basedir}/src/</sourceDirectory>
</build>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.common.modules</artifactId>
<version>2.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.dbeaver.jdbc.api</artifactId>
<packaging>eclipse-plugin</packaging>

<name>JDBC framework</name>
<description>Framework for JDBC drivers development.</description>
<url>https://github.com/dbeaver/dbeaver-common</url>

<dependencies>
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>org.jkiss.utils</artifactId>
</dependency>
</dependencies>


<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Serge Rider</name>
<email>[email protected]</email>
<url>https://github.com/serge-rider</url>
<organization>DBeaver Corp</organization>
<organizationUrl>https://github.com/dbeaver</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:[email protected]:dbeaver/dbeaver-common.git</connection>
<developerConnection>scm:git:[email protected]:dbeaver/dbeaver-common.git</developerConnection>
<url>[email protected]:dbeaver/dbeaver-common.git</url>
</scm>

<build>
<sourceDirectory>${project.basedir}/src/</sourceDirectory>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

public abstract class AbstractJdbcConnection implements Connection {

public static final String APPLICATION_NAME_CLIENT_PROPERTY = "ApplicationName";

protected int holdability = ResultSet.HOLD_CURSORS_OVER_COMMIT;
private final Properties clientInfo = new Properties();

public AbstractJdbcConnection() {
}
Expand Down Expand Up @@ -170,22 +173,31 @@ public boolean isValid(int timeout) throws SQLException {

@Override
public void setClientInfo(String name, String value) {
// unsupported
clientInfo.setProperty(name, value);
}

@Override
public void setClientInfo(Properties properties) {
// unsupported
clientInfo.clear();
clientInfo.putAll(properties);
}

public String getClientApplicationName() {
String appName = getClientInfo(APPLICATION_NAME_CLIENT_PROPERTY);
if (appName == null) {
appName = "JDBC Driver " + getClass().getSimpleName();
}
return appName;
}

@Override
public String getClientInfo(String name) throws SQLException {
throw new SQLFeatureNotSupportedException();
public String getClientInfo(String name) {
return this.clientInfo.getProperty(name);
}

@Override
public Properties getClientInfo() throws SQLException {
throw new SQLFeatureNotSupportedException();
public Properties getClientInfo() {
return this.clientInfo;
}

@Override
Expand All @@ -204,7 +216,7 @@ public void setSchema(String schema) throws SQLException {
}

@Override
public String getSchema() {
public String getSchema() throws SQLException {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,11 @@ public Reader getCharacterStream(int columnIndex) throws SQLException {
@Override
public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
final String value = getString(columnIndex);
return value != null ? new BigDecimal(value) : null;
if (value == null || value.isBlank()) {
return null;
}

return new BigDecimal(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class AbstractJdbcStatement<CON extends AbstractJdbcConnection>
protected int fetchSize;
protected long maxRows;
protected String cursorName;
private int maxFieldSize;
protected int maxFieldSize;

public AbstractJdbcStatement(@NotNull CON connection) throws SQLException {
this.connection = connection;
Expand Down
2 changes: 1 addition & 1 deletion modules/com.dbeaver.rpc/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: DBeaver RPC
Bundle-Vendor: DBeaver Corp
Bundle-SymbolicName: com.dbeaver.rpc
Bundle-Version: 2.2.0.qualifier
Bundle-Version: 2.3.1.qualifier
Bundle-Release-Date: 20240205
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.jkiss.utils,
Expand Down
83 changes: 56 additions & 27 deletions modules/com.dbeaver.rpc/pom.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.common.modules</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.dbeaver.rpc</artifactId>
<name>RPC framework</name>
<packaging>eclipse-plugin</packaging>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>org.jkiss.utils</artifactId>
</dependency>
</dependencies>

<build>
<sourceDirectory>${project.basedir}/src/</sourceDirectory>
</build>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.dbeaver.common</groupId>
<artifactId>com.dbeaver.common.modules</artifactId>
<version>2.3.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>com.dbeaver.rpc</artifactId>
<packaging>eclipse-plugin</packaging>

<name>RPC framework</name>
<description>RPC over HTTP.</description>
<url>https://github.com/dbeaver/dbeaver-common</url>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.dbeaver.common</groupId>
<artifactId>org.jkiss.utils</artifactId>
</dependency>
</dependencies>


<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>Serge Rider</name>
<email>[email protected]</email>
<url>https://github.com/serge-rider</url>
<organization>DBeaver Corp</organization>
<organizationUrl>https://github.com/dbeaver</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:[email protected]:dbeaver/dbeaver-common.git</connection>
<developerConnection>scm:git:[email protected]:dbeaver/dbeaver-common.git</developerConnection>
<url>[email protected]:dbeaver/dbeaver-common.git</url>
</scm>

<build>
<sourceDirectory>${project.basedir}/src/</sourceDirectory>
</build>

</project>
6 changes: 4 additions & 2 deletions modules/org.jkiss.utils/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ Bundle-ManifestVersion: 2
Bundle-Name: DBeaver Utils
Bundle-Vendor: DBeaver Corp
Bundle-SymbolicName: org.jkiss.utils
Bundle-Version: 2.2.0.qualifier
Bundle-Version: 2.3.1.qualifier
Bundle-Release-Date: 20240205
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: com.google.gson
Export-Package: org.jkiss.api,
org.jkiss.api.verification,
org.jkiss.code,
org.jkiss.utils,
org.jkiss.utils.csv,
org.jkiss.utils.io,
org.jkiss.utils.rest,
org.jkiss.utils.time,
org.jkiss.utils.xml
org.jkiss.utils.xml,
org.jkiss.utils.function
Automatic-Module-Name: org.jkiss.utils
Loading

0 comments on commit 4d5bcfe

Please sign in to comment.