-
Notifications
You must be signed in to change notification settings - Fork 1.1k
spanner-jdbc: Step 16 - JdbcResultSet #5891
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
spanner-jdbc: Step 16 - JdbcResultSet #5891
Conversation
...le-cloud-spanner-jdbc/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcResultSet.java
Show resolved
Hide resolved
|
|
||
| /** Extract {@link java.sql.Types} code from Spanner {@link Type}. */ | ||
| static int extractColumnType(Type type) { | ||
| if (type.equals(Type.bool())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would either flip the equality here, or check for null and throw first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies to further if statements in this file.
| } | ||
|
|
||
| private static final String RESULTSET_NOT_SUPPORTED = | ||
| "Getting a resultset from an array is not supported"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'ResultSet'
| JdbcPreconditions.checkArgument(start >= 1, "Start position must be >= 1"); | ||
| JdbcPreconditions.checkArgument(searchstr != null, "searchstr may not be null"); | ||
| checkPosition(start); | ||
| int res = value.indexOf(searchstr, (int) start - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'searchStr'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same applies to below usage of the parameter
| @@ -0,0 +1,267 @@ | |||
| /* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was already done in step 13. Does it need a rebase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based this PR on step 13 to avoid build errors. Once 13 is merged, this one should be rebased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has now been rebased.
| @@ -0,0 +1,274 @@ | |||
| /* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think this was again already added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I based this PR on step 13 to avoid build errors. Once 13 is merged, this one should be rebased.
...loud-spanner-jdbc/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetMetaDataTest.java
Outdated
Show resolved
Hide resolved
|
|
||
| @Test | ||
| public void testToString() { | ||
| assertNotNull(subject.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's also assert what the string value is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
...google-cloud-spanner-jdbc/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java
Outdated
Show resolved
Hide resolved
...google-cloud-spanner-jdbc/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## spanner-jdbc #5891 +/- ##
==================================================
- Coverage 46.12% 46.12% -0.01%
Complexity 24189 24189
==================================================
Files 2456 2456
Lines 262236 262236
Branches 29602 29602
==================================================
- Hits 120952 120949 -3
- Misses 132173 132176 +3
Partials 9111 9111
Continue to review full report at Codecov.
|
d463224 to
68a099c
Compare
* add jdbc types and type mappings for Cloud Spanner * update CR year * add jdbc ResultSet * added null checks and javadoc and fixed formatting * added missing checks for negative overflow and added test cases * fixed camel case * refactored if-statements into one, added actual check for toString * removed formatter hints * extracted to variable + added extra documentation
Adds
java.sql.ResultSetimplementation for Cloud Spanner. This is basically a wrapper around acom.google.cloud.spanner.ResultSet.(The branch of this PR is based on step 13. Step 13 has been merged and this PR has been rebased.)