Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/io/r2dbc/gaussdb/ConnectionResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ final class ConnectionResources {

private final GaussDBConnection connection;

private final PostgresqlConnectionConfiguration configuration;
private final GaussDBConnectionConfiguration configuration;

private final StatementCache statementCache;

private final PortalNameSupplier portalNameSupplier;

ConnectionResources(Client client, Codecs codecs, GaussDBConnection connection, PostgresqlConnectionConfiguration configuration, PortalNameSupplier portalNameSupplier,
ConnectionResources(Client client, Codecs codecs, GaussDBConnection connection, GaussDBConnectionConfiguration configuration, PortalNameSupplier portalNameSupplier,
StatementCache statementCache) {
this.client = client;
this.codecs = codecs;
Expand All @@ -61,7 +61,7 @@ public GaussDBConnection getConnection() {
return this.connection;
}

public PostgresqlConnectionConfiguration getConfiguration() {
public GaussDBConnectionConfiguration getConfiguration() {
return this.configuration;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/r2dbc/gaussdb/ConnectionStrategyFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
final class ConnectionStrategyFactory {

/**
* Create a {@link ConnectionStrategy} that is able to connect to the specified {@link PostgresqlConnectionConfiguration configuration}.
* Create a {@link ConnectionStrategy} that is able to connect to the specified {@link GaussDBConnectionConfiguration configuration}.
*
* @param connectionFunction the raw connection function to use to create a {@link Client}. The connection function is enhanced during the connect phase to perform a handshake with the database.
* @param configuration the configuration object
* @return the connection strategy to use.
*/
public static ConnectionStrategy getConnectionStrategy(ConnectionFunction connectionFunction, PostgresqlConnectionConfiguration configuration, ConnectionSettings connectionSettings) {
public static ConnectionStrategy getConnectionStrategy(ConnectionFunction connectionFunction, GaussDBConnectionConfiguration configuration, ConnectionSettings connectionSettings) {
return doGetConnectionStrategy(new SingleHostConnectionFunction(connectionFunction, configuration), configuration, connectionSettings);
}

private static ConnectionStrategy doGetConnectionStrategy(ConnectionFunction connectionFunction, PostgresqlConnectionConfiguration configuration, ConnectionSettings connectionSettings) {
private static ConnectionStrategy doGetConnectionStrategy(ConnectionFunction connectionFunction, GaussDBConnectionConfiguration configuration, ConnectionSettings connectionSettings) {

SSLConfig sslConfig = configuration.getSslConfig();
if (!SSLMode.DISABLE.equals(sslConfig.getSslMode())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
import java.util.List;

/**
* An implementation of {@link Batch} for executing a collection of statements in a batch against a PostgreSQL database.
* An implementation of {@link Batch} for executing a collection of statements in a batch against a GaussDB database.
*/
final class PostgresqlBatch implements io.r2dbc.gaussdb.api.PostgresqlBatch {
final class GaussDBBatch implements io.r2dbc.gaussdb.api.GaussDBBatch {

private final ConnectionResources context;

private final List<String> statements = new ArrayList<>();

PostgresqlBatch(ConnectionResources context) {
GaussDBBatch(ConnectionResources context) {
this.context = Assert.requireNonNull(context, "context must not be null");
}

@Override
public PostgresqlBatch add(String sql) {
public GaussDBBatch add(String sql) {
Assert.requireNonNull(sql, "sql must not be null");

if (!(PostgresqlSqlParser.parse(sql).getParameterCount() == 0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* An implementation of {@link ColumnMetadata} for a PostgreSQL database.
*/
final class PostgresqlColumnMetadata implements io.r2dbc.gaussdb.api.PostgresqlColumnMetadata {
final class GaussDBColumnMetadata implements io.r2dbc.gaussdb.api.GaussDBColumnMetadata {

private final Codecs codecs;

Expand All @@ -41,15 +41,15 @@ final class PostgresqlColumnMetadata implements io.r2dbc.gaussdb.api.PostgresqlC

private final short precision;

PostgresqlColumnMetadata(Codecs codecs, String name, int nativeType, short precision) {
GaussDBColumnMetadata(Codecs codecs, String name, int nativeType, short precision) {
this.codecs = codecs;
this.format = Format.FORMAT_TEXT;
this.name = name;
this.nativeType = nativeType;
this.precision = precision;
}

PostgresqlColumnMetadata(Codecs codecs, Field field) {
GaussDBColumnMetadata(Codecs codecs, Field field) {
this.codecs = Assert.requireNonNull(codecs, "codecs must not be null");
Assert.requireNonNull(field, "field must not be null");
this.format = field.getFormat();
Expand All @@ -63,10 +63,10 @@ public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof PostgresqlColumnMetadata)) {
if (!(o instanceof GaussDBColumnMetadata)) {
return false;
}
PostgresqlColumnMetadata that = (PostgresqlColumnMetadata) o;
GaussDBColumnMetadata that = (GaussDBColumnMetadata) o;
return
this.name.equals(that.name) &&
this.nativeType == that.nativeType &&
Expand Down Expand Up @@ -117,8 +117,8 @@ public String toString() {
'}';
}

static PostgresqlColumnMetadata toColumnMetadata(Codecs codecs, Field field) {
return new PostgresqlColumnMetadata(codecs, field);
static GaussDBColumnMetadata toColumnMetadata(Codecs codecs, Field field) {
return new GaussDBColumnMetadata(codecs, field);
}

static class OidType implements Type {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/r2dbc/gaussdb/GaussDBConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ final class GaussDBConnection implements io.r2dbc.gaussdb.api.GaussDBConnection,
private volatile IsolationLevel previousIsolationLevel;

GaussDBConnection(Client client, Codecs codecs, PortalNameSupplier portalNameSupplier, StatementCache statementCache, IsolationLevel isolationLevel,
PostgresqlConnectionConfiguration configuration) {
GaussDBConnectionConfiguration configuration) {
this.client = Assert.requireNonNull(client, "client must not be null");
this.resources = new ConnectionResources(client, codecs, this, configuration, portalNameSupplier, statementCache);
this.connectionContext = client.getContext();
Expand Down Expand Up @@ -228,8 +228,8 @@ public CopyInBuilder copyIn(String sql) {
}

@Override
public PostgresqlBatch createBatch() {
return new PostgresqlBatch(this.resources);
public GaussDBBatch createBatch() {
return new GaussDBBatch(this.resources);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
import static io.r2dbc.gaussdb.message.frontend.Execute.NO_LIMIT;

/**
* Connection configuration information for connecting to a PostgreSQL database.
* Connection configuration information for connecting to a GaussDB database.
*/
public final class PostgresqlConnectionConfiguration {
public final class GaussDBConnectionConfiguration {

/**
* Default PostgreSQL port.
* Default GaussDB port.
*/
public static final int DEFAULT_PORT = 5432;
public static final int DEFAULT_PORT = 8000;

private final String applicationName;

Expand Down Expand Up @@ -134,12 +134,12 @@ public final class PostgresqlConnectionConfiguration {

private final Publisher<String> username;

private PostgresqlConnectionConfiguration(String applicationName, boolean autodetectExtensions, @Nullable boolean compatibilityMode, @Nullable Duration connectTimeout, @Nullable String database
private GaussDBConnectionConfiguration(String applicationName, boolean autodetectExtensions, @Nullable boolean compatibilityMode, @Nullable Duration connectTimeout, @Nullable String database
, LogLevel errorResponseLogLevel, List<Extension> extensions, ToIntFunction<String> fetchSize, boolean forceBinary, @Nullable Duration lockWaitTimeout,
@Nullable LoopResources loopResources, @Nullable MultiHostConfiguration multiHostConfiguration, LogLevel noticeLogLevel,
@Nullable Map<String, String> options, @Nullable Publisher<CharSequence> password, boolean preferAttachedBuffers, int preparedStatementCacheQueries,
@Nullable String schema, @Nullable SingleHostConfiguration singleHostConfiguration, SSLConfig sslConfig, @Nullable Duration statementTimeout,
boolean tcpKeepAlive, boolean tcpNoDelay, TimeZone timeZone, Publisher<String> username) {
@Nullable LoopResources loopResources, @Nullable MultiHostConfiguration multiHostConfiguration, LogLevel noticeLogLevel,
@Nullable Map<String, String> options, @Nullable Publisher<CharSequence> password, boolean preferAttachedBuffers, int preparedStatementCacheQueries,
@Nullable String schema, @Nullable SingleHostConfiguration singleHostConfiguration, SSLConfig sslConfig, @Nullable Duration statementTimeout,
boolean tcpKeepAlive, boolean tcpNoDelay, TimeZone timeZone, Publisher<String> username) {
this.applicationName = Assert.requireNonNull(applicationName, "applicationName must not be null");
this.autodetectExtensions = autodetectExtensions;
this.compatibilityMode = compatibilityMode;
Expand Down Expand Up @@ -190,7 +190,7 @@ public static Builder builder() {

@Override
public String toString() {
return "PostgresqlConnectionConfiguration{" +
return "GaussDBConnectionConfiguration{" +
"applicationName='" + this.applicationName + '\'' +
", autodetectExtensions='" + this.autodetectExtensions + '\'' +
", compatibilityMode=" + this.compatibilityMode +
Expand Down Expand Up @@ -347,7 +347,7 @@ private static String obfuscate(int length) {
}

/**
* A builder for {@link PostgresqlConnectionConfiguration} instances.
* A builder for {@link GaussDBConnectionConfiguration} instances.
* <p>
* <i>This class is not threadsafe</i>
*/
Expand Down Expand Up @@ -462,11 +462,11 @@ public Builder autodetectExtensions(boolean autodetectExtensions) {
}

/**
* Returns a configured {@link PostgresqlConnectionConfiguration}.
* Returns a configured {@link GaussDBConnectionConfiguration}.
*
* @return a configured {@link PostgresqlConnectionConfiguration}
* @return a configured {@link GaussDBConnectionConfiguration}
*/
public PostgresqlConnectionConfiguration build() {
public GaussDBConnectionConfiguration build() {

SingleHostConfiguration singleHostConfiguration = this.singleHostConfiguration != null
? this.singleHostConfiguration.build()
Expand All @@ -484,7 +484,7 @@ public PostgresqlConnectionConfiguration build() {
throw new IllegalArgumentException("username must not be null");
}

return new PostgresqlConnectionConfiguration(this.applicationName, this.autodetectExtensions, this.compatibilityMode, this.connectTimeout, this.database, this.errorResponseLogLevel,
return new GaussDBConnectionConfiguration(this.applicationName, this.autodetectExtensions, this.compatibilityMode, this.connectTimeout, this.database, this.errorResponseLogLevel,
this.extensions, this.fetchSize, this.forceBinary, this.lockWaitTimeout, this.loopResources, multiHostConfiguration,
this.noticeLogLevel, this.options, this.password, this.preferAttachedBuffers,
this.preparedStatementCacheQueries, this.schema, singleHostConfiguration,
Expand Down Expand Up @@ -598,7 +598,7 @@ public Builder fetchSize(ToIntFunction<String> fetchSizeFunction) {
}

/**
* Force binary results (<a href="https://wiki.postgresql.org/wiki/JDBC-BinaryTransfer">Binary Transfer</a>). Defaults to false.
* Force binary results. Defaults to false.
*
* @param forceBinary whether to force binary transfer
* @return this {@link Builder}
Expand Down Expand Up @@ -688,8 +688,6 @@ public Builder loadBalanceHosts(boolean loadBalanceHosts) {
* <p>
* This parameter is applied once after creating a new connection.
* If lockTimeout is already set using {@link #options(Map)}, it will be overridden.
* <a href="https://www.postgresql.org/docs/current/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT">Lock Timeout</a>
*
* @param lockWaitTimeout the lock timeout
* @return this {@link Builder}
* @since 0.8.9
Expand All @@ -716,7 +714,6 @@ public Builder loopResources(LoopResources loopResources) {
*
* @param noticeLogLevel the log level to use.
* @return this {@link Builder}
* @since 0.9
*/
public Builder noticeLogLevel(LogLevel noticeLogLevel) {
this.noticeLogLevel = Assert.requireNonNull(noticeLogLevel, "noticeLogLevel must not be null");
Expand All @@ -727,7 +724,6 @@ public Builder noticeLogLevel(LogLevel noticeLogLevel) {
* Configure connection initialization parameters.
* <p>
* These parameters are applied once after creating a new connection. This is useful for setting up client-specific
* <a href="https://www.postgresql.org/docs/current/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT">runtime parameters</a>
* like statement timeouts, time zones etc.
*
* @param options the options
Expand Down Expand Up @@ -782,7 +778,7 @@ public Builder password(Supplier<CharSequence> password) {
}

/**
* Configure the port. Defaults to {@code 5432}. Calling this method prepares single-node configuration. This method can be only used if the builder was not configured with a multi-host
* Configure the port. Defaults to {@code 8000}. Calling this method prepares single-node configuration. This method can be only used if the builder was not configured with a multi-host
* configuration.
*
* @param port the port
Expand Down Expand Up @@ -1009,11 +1005,8 @@ public Builder sslRootCert(URL sslRootCert) {
* <p>
* This parameter is applied once after creating a new connection.
* If statementTimeout is already set using {@link #options(Map)}, it will be overridden.
* <a href="https://www.postgresql.org/docs/current/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT">Statement Timeout</a>
*
* @param statementTimeout the statement timeout
* @return this {@link Builder}
* @since 0.8.9
*/
public Builder statementTimeout(Duration statementTimeout) {
this.statementTimeout = Assert.requireNonNull(statementTimeout, "Statement timeout");
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/r2dbc/gaussdb/GaussDBConnectionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final class GaussDBConnectionFactory implements ConnectionFactory {

private final ConnectionFunction connectionFunction;

private final PostgresqlConnectionConfiguration configuration;
private final GaussDBConnectionConfiguration configuration;

private final Extensions extensions;

Expand All @@ -68,7 +68,7 @@ public final class GaussDBConnectionFactory implements ConnectionFactory {
* @param configuration the configuration to use
* @throws IllegalArgumentException if {@code configuration} is {@code null}
*/
public GaussDBConnectionFactory(PostgresqlConnectionConfiguration configuration) {
public GaussDBConnectionFactory(GaussDBConnectionConfiguration configuration) {
this(DEFAULT_CONNECTION_FUNCTION, configuration);
}

Expand All @@ -79,13 +79,13 @@ public GaussDBConnectionFactory(PostgresqlConnectionConfiguration configuration)
* @param configuration the configuration to use
* @throws IllegalArgumentException if {@code configuration} is {@code null}
*/
GaussDBConnectionFactory(ConnectionFunction connectionFunction, PostgresqlConnectionConfiguration configuration) {
GaussDBConnectionFactory(ConnectionFunction connectionFunction, GaussDBConnectionConfiguration configuration) {
this.connectionFunction = Assert.requireNonNull(connectionFunction, "connectionFunction must not be null");
this.configuration = Assert.requireNonNull(configuration, "configuration must not be null");
this.extensions = getExtensions(configuration);
}

private static Extensions getExtensions(PostgresqlConnectionConfiguration configuration) {
private static Extensions getExtensions(GaussDBConnectionConfiguration configuration) {
Extensions extensions = Extensions.from(configuration.getExtensions());

if (configuration.isAutodetectExtensions()) {
Expand Down Expand Up @@ -190,10 +190,10 @@ private Throwable cannotConnect(Throwable throwable, ConnectionStrategy strategy

@Override
public ConnectionFactoryMetadata getMetadata() {
return PostgresqlConnectionFactoryMetadata.INSTANCE;
return GaussDBConnectionFactoryMetadata.INSTANCE;
}

PostgresqlConnectionConfiguration getConfiguration() {
GaussDBConnectionConfiguration getConfiguration() {
return this.configuration;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
import io.r2dbc.spi.ConnectionFactoryMetadata;

/**
* An implementation of {@link ConnectionFactoryMetadata} for a PostgreSQL database.
* An implementation of {@link ConnectionFactoryMetadata} for a GaussDB database.
*/
final class PostgresqlConnectionFactoryMetadata implements ConnectionFactoryMetadata {
final class GaussDBConnectionFactoryMetadata implements ConnectionFactoryMetadata {

/**
* The name of the PostgreSQL database product.
* The name of the GaussDB database product.
*/
public static final String NAME = "PostgreSQL";
public static final String NAME = "GaussDB";

static final PostgresqlConnectionFactoryMetadata INSTANCE = new PostgresqlConnectionFactoryMetadata();
static final GaussDBConnectionFactoryMetadata INSTANCE = new GaussDBConnectionFactoryMetadata();

private PostgresqlConnectionFactoryMetadata() {
private GaussDBConnectionFactoryMetadata() {
}

@Override
Expand Down
Loading