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

Polishing and fix typo #235

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/io/asyncer/r2dbc/mysql/Capability.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ public boolean isProtocol41() {
}

/**
* Checks if can use var-integer sized bytes to encode client authentication.
* Checks if allow to use var-integer sized bytes to encode client authentication.
*
* @return if can use var-integer sized authentication.
* @return if allow to use var-integer sized authentication.
*/
public boolean isVarIntSizedAuthAllowed() {
return (bitmap & VAR_INT_SIZED_AUTH) != 0;
Expand All @@ -236,7 +236,7 @@ public boolean isPluginAuthAllowed() {
/**
* Checks if the connection contains connection attributes.
*
* @return if has connection attributes.
* @return if connection attributes exists.
*/
public boolean isConnectionAttributesAllowed() {
return (bitmap & CONNECT_ATTRS) != 0;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/asyncer/r2dbc/mysql/ColumnDefinition.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean isNotNull() {
/**
* Checks if value is an unsigned number. e.g. INT UNSIGNED, BIGINT UNSIGNED.
* <p>
* Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not supports it in MySQL 8.0+. When creating a
* Note: IEEE-754 floating types (e.g. DOUBLE/FLOAT) do not support it in MySQL 8.0+. When creating a
* column as an unsigned floating type, the server may report a warning.
*
* @return if value is an unsigned number.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/asyncer/r2dbc/mysql/ConnectionContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
/**
* The MySQL connection context considers the behavior of server or client.
* <p>
* WARNING: Do NOT change any data outside of this project, try configure {@code ConnectionFactoryOptions} or
* {@code MySqlConnectionConfiguration} to control connection context and client behavior.
* WARNING: Do NOT change any data outside of this project, try to configure {@code ConnectionFactoryOptions}
* or {@code MySqlConnectionConfiguration} to control connection context and client behavior.
*/
public final class ConnectionContext implements CodecContext {

Expand Down
10 changes: 3 additions & 7 deletions src/main/java/io/asyncer/r2dbc/mysql/MySqlConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,13 @@ private static ZoneId convertZoneId(String id) {
try {
switch (realId) {
case "Factory":
// Looks like the "Factory" time zone is UTC.
// It seems like UTC.
return ZoneOffset.UTC;
case "America/Nuuk":
// They are same timezone including DST.
// America/Godthab is the same as America/Nuuk, with DST.
return ZoneId.of("America/Godthab");
case "ROC":
// Republic of China, 1912-1949, very very old time zone.
// Even the ZoneId.SHORT_IDS does not support it.
// Is there anyone using this time zone, really?
// Don't think so, but should support it for compatible.
// Just use GMT+8, id is equal to +08:00.
// It is equal to +08:00.
return ZoneId.of("+8");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS;

/**
* MySQL configuration of connection.
* A configuration of MySQL connection.
*/
public final class MySqlConnectionConfiguration {

Expand Down Expand Up @@ -461,7 +461,7 @@ public MySqlConnectionConfiguration build() {
}

/**
* Configure the database. Default no database.
* Configures the database. Default no database.
*
* @param database the database, or {@code null} if no database want to be login.
* @return this {@link Builder}.
Expand All @@ -473,7 +473,7 @@ public Builder database(@Nullable String database) {
}

/**
* Configure to create the database given in the configuration if it does not yet exist. Default to
* Configures to create the database given in the configuration if it does not yet exist. Default to
* {@code false}.
*
* @param enabled to discover and register extensions.
Expand All @@ -486,7 +486,7 @@ public Builder createDatabaseIfNotExist(boolean enabled) {
}

/**
* Configure the Unix Domain Socket to connect to.
* Configures the Unix Domain Socket to connect to.
*
* @param unixSocket the socket file path.
* @return this {@link Builder}.
Expand All @@ -500,7 +500,7 @@ public Builder unixSocket(String unixSocket) {
}

/**
* Configure the host.
* Configures the host.
*
* @param host the host.
* @return this {@link Builder}.
Expand All @@ -514,7 +514,7 @@ public Builder host(String host) {
}

/**
* Configure the password, MySQL allows to login without password.
* Configures the password. Default login without password.
* <p>
* Note: for memory security, should not use intern {@link String} for password.
*
Expand All @@ -528,7 +528,7 @@ public Builder password(@Nullable CharSequence password) {
}

/**
* Configure the port. Defaults to {@code 3306}.
* Configures the port. Defaults to {@code 3306}.
*
* @param port the port.
* @return this {@link Builder}.
Expand All @@ -543,9 +543,9 @@ public Builder port(int port) {
}

/**
* Configure the connection timeout. Default no timeout.
* Configures the connection timeout. Default no timeout.
*
* @param connectTimeout the connection timeout, or {@code null} if has no timeout.
* @param connectTimeout the connection timeout, or {@code null} if no timeout.
* @return this {@link Builder}.
* @since 0.8.1
*/
Expand All @@ -555,7 +555,7 @@ public Builder connectTimeout(@Nullable Duration connectTimeout) {
}

/**
* Set the user for login the database.
* Configures the user for login the database.
*
* @param user the user.
* @return this {@link Builder}.
Expand All @@ -580,8 +580,7 @@ public Builder username(String user) {
}

/**
* Enforce the time zone of server. Default to query server time zone in initialization (no
* enforce).
* Configures the time zone of server. Default to query server time zone in initialization.
*
* @param serverZoneId the {@link ZoneId}, or {@code null} if query in initialization.
* @return this {@link Builder}.
Expand All @@ -593,8 +592,8 @@ public Builder serverZoneId(@Nullable ZoneId serverZoneId) {
}

/**
* Configure the {@link ZeroDateOption}. It is a behavior option when this driver receives a value of
* zero-date.
* Configures the {@link ZeroDateOption}. Default to {@link ZeroDateOption#USE_NULL}. It is a
* behavior option when this driver receives a value of zero-date.
*
* @param zeroDate the {@link ZeroDateOption}.
* @return this {@link Builder}.
Expand All @@ -607,7 +606,7 @@ public Builder zeroDateOption(ZeroDateOption zeroDate) {
}

/**
* Configure ssl mode. See also {@link SslMode}.
* Configures ssl mode. See also {@link SslMode}.
*
* @param sslMode the SSL mode to use.
* @return this {@link Builder}.
Expand All @@ -620,7 +619,7 @@ public Builder sslMode(SslMode sslMode) {
}

/**
* Configure TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions}.
* Configures TLS versions, see {@link io.asyncer.r2dbc.mysql.constant.TlsVersions TlsVersions}.
*
* @param tlsVersion TLS versions.
* @return this {@link Builder}.
Expand All @@ -643,7 +642,7 @@ public Builder tlsVersion(String... tlsVersion) {
}

/**
* Configure SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as
* Configures SSL {@link HostnameVerifier}, it is available only set {@link #sslMode(SslMode)} as
* {@link SslMode#VERIFY_IDENTITY}. It is useful when server was using special Certificates or need
* special verification.
* <p>
Expand All @@ -661,7 +660,7 @@ public Builder sslHostnameVerifier(HostnameVerifier sslHostnameVerifier) {
}

/**
* Configure SSL root certification for server certificate validation. It is only available if the
* Configures SSL root certification for server certificate validation. It is only available if the
* {@link #sslMode(SslMode)} is configured for verify server certification.
* <p>
* Default is {@code null}, which means that the default algorithm is used for the trust manager.
Expand All @@ -676,7 +675,7 @@ public Builder sslCa(@Nullable String sslCa) {
}

/**
* Configure client SSL certificate for client authentication.
* Configures client SSL certificate for client authentication.
* <p>
* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}.
*
Expand All @@ -690,7 +689,7 @@ public Builder sslCert(@Nullable String sslCert) {
}

/**
* Configure client SSL key for client authentication.
* Configures client SSL key for client authentication.
* <p>
* The {@link #sslCert} and {@link #sslKey} must be both non-{@code null} or both {@code null}.
*
Expand All @@ -704,7 +703,7 @@ public Builder sslKey(@Nullable String sslKey) {
}

/**
* Configure the password of SSL key file for client certificate authentication.
* Configures the password of SSL key file for client certificate authentication.
* <p>
* It will be used only if {@link #sslKey} and {@link #sslCert} non-null.
*
Expand All @@ -719,7 +718,7 @@ public Builder sslKeyPassword(@Nullable CharSequence sslKeyPassword) {
}

/**
* Configure a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL
* Configures a {@link SslContextBuilder} customizer. The customizer gets applied on each SSL
* connection attempt to allow for just-in-time configuration updates. The {@link Function} gets
* called with the prepared {@link SslContextBuilder} that has all configuration options applied. The
* customizer may return the same builder or return a new builder instance to be used to build the SSL
Expand All @@ -739,7 +738,7 @@ public Builder sslContextBuilderCustomizer(
}

/**
* Configure TCP KeepAlive.
* Configures TCP KeepAlive.
*
* @param enabled whether to enable TCP KeepAlive
* @return this {@link Builder}
Expand All @@ -752,7 +751,7 @@ public Builder tcpKeepAlive(boolean enabled) {
}

/**
* Configure TCP NoDelay.
* Configures TCP NoDelay.
*
* @param enabled whether to enable TCP NoDelay
* @return this {@link Builder}
Expand All @@ -765,7 +764,7 @@ public Builder tcpNoDelay(boolean enabled) {
}

/**
* Configure the protocol of parametrized statements to the text protocol.
* Configures the protocol of parametrized statements to the text protocol.
* <p>
* The text protocol is default protocol that's using client-preparing. See also MySQL
* documentations.
Expand All @@ -779,7 +778,7 @@ public Builder useClientPrepareStatement() {
}

/**
* Configure the protocol of parametrized statements to the binary protocol.
* Configures the protocol of parametrized statements to the binary protocol.
* <p>
* The binary protocol is compact protocol that's using server-preparing. See also MySQL
* documentations.
Expand All @@ -792,7 +791,7 @@ public Builder useServerPrepareStatement() {
}

/**
* Configure the protocol of parametrized statements and prepare-preferred simple statements to the
* Configures the protocol of parametrized statements and prepare-preferred simple statements to the
* binary protocol.
* <p>
* The {@code preferPrepareStatement} configures whether to prefer prepare execution on a
Expand All @@ -816,7 +815,7 @@ public Builder useServerPrepareStatement(Predicate<String> preferPrepareStatemen
}

/**
* Configure the session variables, used to set session variables immediately after login. Default no
* Configures the session variables, used to set session variables immediately after login. Default no
* session variables to set. It should be a list of key-value pairs. e.g.
* {@code ["sql_mode='ANSI_QUOTES,STRICT_TRANS_TABLES'", "time_zone=00:00"]}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static Mono<MySqlConnection> getMySqlConnection(
})
.flatMap(client -> {
ByteBufAllocator allocator = client.getByteBufAllocator();
CodecsBuilder builder = Codecs.builder(allocator);
CodecsBuilder builder = Codecs.builder();
PrepareCache prepareCache = Caches.createPrepareCache(prepareCacheSize);
String db = createDbIfNotExist ? database : "";

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/io/asyncer/r2dbc/mysql/MySqlNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase)
left = middle + 1;

if (compared == -2) {
// Match succeed if case insensitive, always use last
// Match succeed if case-insensitive, always use last
// matched result that will be closer to `name`.
ciResult = middle;
}
} else if (compared > 0) {
right = middle - 1;

if (compared == 2) {
// Match succeed if case insensitive, always use last
// Match succeed if case-insensitive, always use last
// matched result that will be closer to `name`.
ciResult = middle;
}
} else {
// Match succeed when case sensitive, just return.
// Match succeed when case-sensitive.
return middle;
}
}
Expand All @@ -90,9 +90,9 @@ private static int binarySearch(String[] names, String name, boolean ignoreCase)

/**
* Compares double strings and return an integer of both difference. If the integer is {@code 0} means
* both strings equals even case sensitive, absolute value is {@code 2} means it is equals by case
* insensitive but not equals when case sensitive, absolute value is {@code 4} means it is not equals even
* case insensitive.
* both strings equals even case-sensitive, absolute value is {@code 2} means it is equals by
* case-insensitive but not equals when case-sensitive, absolute value is {@code 4} means it is not equals
* even case-insensitive.
* <p>
* Note: visible for unit tests.
*
Expand All @@ -117,7 +117,7 @@ private static int compare0(String left, String right, int start, int end) {

if (leftCh != rightCh) {
if (csCompared == 0) {
// Compare end if is case sensitive comparator.
// Compare end if is case-sensitive comparator.
csCompared = leftCh - rightCh;
}

Expand All @@ -126,18 +126,18 @@ private static int compare0(String left, String right, int start, int end) {
rightCh = Character.toLowerCase(rightCh);

if (leftCh != rightCh) {
// Not equals even case insensitive.
// Not equals even case-insensitive.
return leftCh < rightCh ? -4 : 4;
}
}
}

// Length not equals means both strings not equals even case insensitive.
// Length not equals means both strings not equals even case-insensitive.
if (leftSize != rightSize) {
return leftSize < rightSize ? -4 : 4;
}

// Equals when case insensitive, use case sensitive.
// Equals when case-insensitive, use case-sensitive.
return csCompared < 0 ? -2 : (csCompared > 0 ? 2 : 0);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/asyncer/r2dbc/mysql/MySqlParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ default boolean isNull() {
* Binary protocol encoding. See MySQL protocol documentations, if don't want to support the binary
* protocol, please receive an exception.
* <p>
* Note: not like the text protocol, it make a sense for state-less.
* Note: not like the text protocol, it makes a sense for state-less.
* <p>
* Binary protocol maybe need to add a var-integer length before encoded content. So if makes it like
* {@code Mono<Void> publishBinary (Xxx binaryWriter)}, and if supports multiple times writing like a
Expand Down Expand Up @@ -75,9 +75,9 @@ default boolean isNull() {
Mono<Void> publishText(ParameterWriter writer);

/**
* Get the {@link MySqlType} of this parameter data.
* Gets the {@link MySqlType} of this parameter data.
* <p>
* If don't want to support the binary protocol, just throw an exception please.
* If it does not want to support the binary protocol, just throw an exception please.
*
* @return the MySQL type.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static io.asyncer.r2dbc.mysql.internal.util.InternalArrays.EMPTY_STRINGS;

/**
* MySQL configuration of SSL.
* A configuration of MySQL SSL connection.
*/
public final class MySqlSslConfiguration {

Expand Down
Loading
Loading