Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Upgrade dependencies and SPI features
Browse files Browse the repository at this point in the history
  • Loading branch information
mirromutth committed Sep 16, 2021
1 parent a11a694 commit df312ef
Show file tree
Hide file tree
Showing 27 changed files with 617 additions and 382 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
@@ -1,2 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
13 changes: 13 additions & 0 deletions README.md
@@ -1,3 +1,16 @@
# Why doesn't it seem so active

Due to COVID-19 and my personal reasons, the progress of this project in 2021 is soooooo slow.

If you ask me "Are u ok? how about u healthy?". Yes, I'm fine. In China, most areas are no longer infected
with COVID-19. It just...my work plan was severely hindered because of COVID-19.

I trust this will not become a norm. *I'm trying to maintain this project as well as I can*.

**May the dead rest, and hope the living be healthy**

*Donation are not accepted because I'm subscribing JetBrains open source license, thanks.*

# Reactive Relational Database Connectivity MySQL Implementation

[![Maven Central](https://img.shields.io/maven-central/v/dev.miku/r2dbc-mysql?color=green&label=Maven%20Central)](https://search.maven.org/search?q=g:%22dev.miku%22%20AND%20a:%22r2dbc-mysql%22)
Expand Down
2 changes: 1 addition & 1 deletion mvnw
Expand Up @@ -8,7 +8,7 @@
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
Expand Down
2 changes: 1 addition & 1 deletion mvnw.cmd
Expand Up @@ -7,7 +7,7 @@
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
Expand Down
40 changes: 20 additions & 20 deletions pom.xml
Expand Up @@ -21,7 +21,7 @@

<groupId>dev.miku</groupId>
<artifactId>r2dbc-mysql</artifactId>
<version>0.8.3.BUILD-SNAPSHOT</version>
<version>0.9.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Reactive Relational Database Connectivity - MySQL</name>
Expand Down Expand Up @@ -56,26 +56,27 @@
</scm>

<properties>
<assertj.version>3.18.1</assertj.version>
<java.version>1.8</java.version>
<mbr.version>0.2.0.RELEASE</mbr.version>
<jmh.version>1.27</jmh.version>
<jsr305.version>3.0.2</jsr305.version>
<junit.version>5.7.0</junit.version>
<logback.version>1.2.3</logback.version>
<mockito.version>3.7.7</mockito.version>
<mysql.version>8.0.23</mysql.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<r2dbc-spi.version>0.9.0.BUILD-SNAPSHOT</r2dbc-spi.version>
<reactor.version>Dysprosium-SR16</reactor.version>
<slf4j.version>1.7.30</slf4j.version>
<testcontainers.version>1.15.1</testcontainers.version>
<hikari-cp.version>3.4.5</hikari-cp.version>
<spring-framework.version>5.3.3</spring-framework.version>
<jackson.version>2.12.1</jackson.version>
<java.version>1.8</java.version>
<maven.deploy.skip>true</maven.deploy.skip>
<maven.surefire.skip>false</maven.surefire.skip>

<r2dbc-spi.version>0.9.0.BUILD-SNAPSHOT</r2dbc-spi.version>
<reactor.version>Dysprosium-SR22</reactor.version>
<assertj.version>3.20.2</assertj.version>
<jmh.version>1.33</jmh.version>
<junit.version>5.7.2</junit.version>
<logback.version>1.2.5</logback.version>
<mockito.version>3.12.3</mockito.version>
<mysql.version>8.0.26</mysql.version>
<slf4j.version>1.7.32</slf4j.version>
<testcontainers.version>1.16.0</testcontainers.version>
<hikari-cp.version>4.0.3</hikari-cp.version>
<spring-framework.version>5.3.9</spring-framework.version>
<jackson.version>2.12.4</jackson.version>
<mbr.version>0.2.0.RELEASE</mbr.version>
<jsr305.version>3.0.2</jsr305.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -261,7 +262,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<excludePackageNames>
dev.miku.r2dbc.mysql.authentication,dev.miku.r2dbc.mysql.client,dev.miku.r2dbc.mysql.util,dev.miku.r2dbc.mysql.codec.lob,dev.miku.r2dbc.mysql.message
Expand Down Expand Up @@ -297,7 +298,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>
Expand Down Expand Up @@ -472,5 +473,4 @@
</repositories>
</profile>
</profiles>

</project>
22 changes: 13 additions & 9 deletions src/main/java/dev/miku/r2dbc/mysql/ColumnNameSet.java
Expand Up @@ -18,14 +18,7 @@

import dev.miku.r2dbc.mysql.util.InternalArrays;

import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Predicate;

Expand All @@ -40,6 +33,9 @@
*/
final class ColumnNameSet extends AbstractSet<String> implements Set<String> {

static final Comparator<MySqlColumnDescriptor> NAME_COMPARATOR = (left, right) ->
MySqlNames.compare(left.getName(), right.getName());

private final String[] originNames;

private final String[] sortedNames;
Expand All @@ -58,7 +54,7 @@ private ColumnNameSet(String[] originNames, String[] sortedNames) {
@Override
public boolean contains(Object o) {
if (o instanceof String) {
return MySqlNames.nameSearch(this.sortedNames, (String) o) >= 0;
return findIndex((String) o) >= 0;
}

return false;
Expand Down Expand Up @@ -186,6 +182,14 @@ public String toString() {
return Arrays.toString(originNames);
}

int findIndex(String name) {
return MySqlNames.nameSearch(this.sortedNames, name);
}

String[] getSortedNames() {
return sortedNames;
}

static ColumnNameSet of(String name) {
requireNonNull(name, "name must not be null");

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/dev/miku/r2dbc/mysql/ConnectionState.java
Expand Up @@ -35,10 +35,10 @@ interface ConnectionState {
*
* @param timeoutSeconds seconds of current lock wait timeout.
*/
void setLockWaitTimeout(long timeoutSeconds);
void setCurrentLockWaitTimeout(long timeoutSeconds);

/**
* Checks if lock wait timeout has been changed by {@link #setLockWaitTimeout(long)}.
* Checks if lock wait timeout has been changed by {@link #setCurrentLockWaitTimeout(long)}.
*
* @return if lock wait timeout changed.
*/
Expand All @@ -52,7 +52,7 @@ interface ConnectionState {
/**
* Resets current isolation level in initial state.
*/
void resetLockWaitTimeout();
void resetCurrentLockWaitTimeout();

/**
* Checks if connection is processing a transaction.
Expand Down
118 changes: 0 additions & 118 deletions src/main/java/dev/miku/r2dbc/mysql/ExceptionFactory.java

This file was deleted.

19 changes: 18 additions & 1 deletion src/main/java/dev/miku/r2dbc/mysql/InsertSyntheticRow.java
Expand Up @@ -89,6 +89,18 @@ public Number get(String name) {
return get0(getType().getJavaType());
}

@Override
public boolean contains(String name) {
requireNonNull(name, "name must not be null");

return contains0(name);
}

@Override
public RowMetadata getMetadata() {
return this;
}

@Override
public ColumnMetadata getColumnMetadata(int index) {
assertValidIndex(index);
Expand All @@ -110,6 +122,7 @@ public List<ColumnMetadata> getColumnMetadatas() {
}

@Override
@SuppressWarnings("deprecation")
public Set<String> getColumnNames() {
return nameSet;
}
Expand All @@ -135,11 +148,15 @@ public Nullability getNullability() {
}

private void assertValidName(String name) {
if (!nameSet.contains(name)) {
if (!contains0(name)) {
throw new NoSuchElementException("Column name '" + name + "' does not exist in " + this.nameSet);
}
}

private boolean contains0(String name) {
return nameSet.contains(name);
}

private <T> T get0(Class<?> type) {
return codecs.decodeLastInsertId(lastInsertId, type);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/miku/r2dbc/mysql/MySqlBatchingBatch.java
Expand Up @@ -61,7 +61,7 @@ public MySqlBatch add(String sql) {
@Override
public Flux<MySqlResult> execute() {
return QueryFlow.execute(client, getSql())
.map(messages -> new MySqlResult(false, codecs, context, null, messages));
.map(messages -> MySqlResult.toResult(false, codecs, context, null, messages));
}

@Override
Expand Down

0 comments on commit df312ef

Please sign in to comment.