Skip to content

Commit

Permalink
NotNull
Browse files Browse the repository at this point in the history
  • Loading branch information
dxahtepb committed Jul 13, 2020
1 parent b794e3c commit 5e999b7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion driver/src/main/java/com/intellij/CouchbaseMetaData.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.intellij;

import com.couchbase.client.java.json.JsonObject;
import org.jetbrains.annotations.NotNull;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
Expand All @@ -19,7 +20,7 @@ public class CouchbaseMetaData implements DatabaseMetaData {
private final CouchbaseConnection connection;
private final CouchbaseJdbcDriver driver;

CouchbaseMetaData(CouchbaseConnection connection, CouchbaseJdbcDriver driver) {
CouchbaseMetaData(@NotNull CouchbaseConnection connection, @NotNull CouchbaseJdbcDriver driver) {
this.connection = connection;
this.driver = driver;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.json.JsonArray;
import com.couchbase.client.java.query.QueryOptions;
import org.jetbrains.annotations.NotNull;

import java.io.InputStream;
import java.io.Reader;
Expand Down Expand Up @@ -36,7 +37,7 @@ public class CouchbasePreparedStatement extends CouchbaseBaseStatement implement
private final String sql;
private Object[] params;

CouchbasePreparedStatement(Cluster cluster, String sql, boolean returnNullStrings) {
CouchbasePreparedStatement(@NotNull Cluster cluster, @NotNull String sql, boolean returnNullStrings) {
super(cluster);
this.returnNullStrings = returnNullStrings;
this.sql = sql;
Expand Down
11 changes: 4 additions & 7 deletions driver/src/main/java/com/intellij/CouchbaseResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.couchbase.client.java.json.JsonObject;
import com.couchbase.client.java.query.ReactiveQueryResult;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;

import java.io.InputStream;
Expand Down Expand Up @@ -45,18 +46,17 @@ public class CouchbaseResultSet implements ResultSet {
private CouchbaseResultSetMetaData meta;
private boolean isClosed = false;

CouchbaseResultSet(Statement statement, Mono<ReactiveQueryResult> queryResult, boolean returnNullStrings) {
CouchbaseResultSet(@NotNull Statement statement, @NotNull Mono<ReactiveQueryResult> queryResult,
boolean returnNullStrings) {
this.statement = statement;
this.stream = queryResult.flux()
.flatMap(ReactiveQueryResult::rowsAsObject)
.doOnRequest(x -> System.err.println("Requested next: " + x))
.doOnCancel(() -> System.err.println("Cancel this flux"))
.toStream();
this.iterator = stream.iterator();
this.returnNullStrings = returnNullStrings;
}

CouchbaseResultSet(Statement statement, Mono<ReactiveQueryResult> queryResult) {
CouchbaseResultSet(@NotNull Statement statement, @NotNull Mono<ReactiveQueryResult> queryResult) {
this(statement, queryResult, true);
}

Expand Down Expand Up @@ -85,7 +85,6 @@ public boolean next() throws SQLException {

@Override
public void close() {
System.out.println("Close called");
if (stream != null) {
stream.close();
iterator = Collections.emptyIterator();
Expand Down Expand Up @@ -297,7 +296,6 @@ public SQLWarning getWarnings() throws SQLException {

@Override
public void clearWarnings() {
// todo
}

@Override
Expand Down Expand Up @@ -425,7 +423,6 @@ public int getFetchDirection() {

@Override
public void setFetchSize(int rows) {
// todo
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.intellij;

import org.jetbrains.annotations.NotNull;

import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
Expand All @@ -18,7 +20,7 @@ public class CouchbaseResultSetMetaData implements ResultSetMetaData {

private final List<ColumnMetaData> columnMetaData;

CouchbaseResultSetMetaData(List<ColumnMetaData> columnMetaData) {
CouchbaseResultSetMetaData(@NotNull List<ColumnMetaData> columnMetaData) {
this.columnMetaData = columnMetaData;
}

Expand Down
4 changes: 3 additions & 1 deletion driver/src/main/java/com/intellij/CouchbaseStatement.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.intellij;

import com.couchbase.client.java.Cluster;
import org.jetbrains.annotations.NotNull;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;

public class CouchbaseStatement extends CouchbaseBaseStatement {
CouchbaseStatement(Cluster cluster) {
CouchbaseStatement(@NotNull Cluster cluster) {
super(cluster);
}

Expand All @@ -25,6 +26,7 @@ public ResultSet executeQuery(String sql) throws SQLException {

@Override
public int executeUpdate(String sql) throws SQLException {
//todo: learn to handle update queries
checkClosed();
try {
result = new CouchbaseResultSet(this, cluster.reactive().query(sql));
Expand Down

0 comments on commit 5e999b7

Please sign in to comment.