Skip to content

Commit fb618d5

Browse files
Addressed comments
1 parent cf7b397 commit fb618d5

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/Statement.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -261,26 +261,32 @@ public Statement of(String sql) {
261261
}
262262

263263
/**
264+
* This function accepts the SQL statement with unnamed parameters(?) and accepts the list of
265+
* objects to replace unnamed parameters. Primitive types are supported
266+
*
267+
* <p>For Date column, following types are supported
268+
*
269+
* <ul>
270+
* <li>java.util.Date
271+
* <li>LocalDate
272+
* <li>com.google.cloud.Date
273+
* </ul>
274+
*
275+
* <p>For Timestamp column, following types are supported. All the dates should be in UTC
276+
* format. Incase if the timezone is not in UTC, spanner client will convert that to UTC
277+
* automatically
278+
*
279+
* <ul>
280+
* <li>LocalDateTime
281+
* <li>OffsetDateTime
282+
* <li>ZonedDateTime
283+
* </ul>
284+
*
285+
* <p>
286+
*
264287
* @param sql SQL statement with unnamed parameters denoted as ?
265288
* @param values positional list of values for the unnamed parameters in the SQL string
266289
* @return Statement a statement that can be executed on Spanner
267-
* <p>This function accepts the SQL statement with unnamed parameters(?) and accepts the
268-
* list of objects to replace unnamed parameters. Primitive types are supported
269-
* <p>For Date column, following types are supported
270-
* <ul>
271-
* <li>java.util.Date
272-
* <li>LocalDate
273-
* <li>com.google.cloud.Date
274-
* </ul>
275-
* <p>For Timestamp column, following types are supported. All the dates should be in UTC
276-
* format. Incase if the timezone is not in UTC, spanner client will convert that to UTC
277-
* automatically
278-
* <ul>
279-
* <li>LocalDateTime
280-
* <li>OffsetDateTime
281-
* <li>ZonedDateTime
282-
* </ul>
283-
* <p>
284290
* @see DatabaseClient#getStatementFactory
285291
*/
286292
public Statement withUnnamedParameters(String sql, Object... values) {

google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,6 @@ static Value toValue(Object value) {
866866
if (value instanceof Date) {
867867
return Value.date((Date) value);
868868
}
869-
if (value instanceof java.util.Date) {
870-
return Value.date(Date.fromJavaUtilDate((java.util.Date) value));
871-
}
872869
if (value instanceof LocalDate) {
873870
return Value.date(convertLocalDateToSpannerDate((LocalDate) value));
874871
}
@@ -939,10 +936,6 @@ static Value toValue(Object value) {
939936
if (object instanceof Date) {
940937
return Value.dateArray(convertToTypedIterable((Date) object, iterator));
941938
}
942-
if (object instanceof java.util.Date) {
943-
return Value.dateArray(
944-
convertToTypedIterable(Date::fromJavaUtilDate, (java.util.Date) object, iterator));
945-
}
946939
if (object instanceof LocalDate) {
947940
return Value.dateArray(
948941
SpannerTypeConverter.convertToTypedIterable(

0 commit comments

Comments
 (0)