use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindDateArray.
@Test
public void bindDateArray() {
Date d1 = Date.parseDate("2016-09-18");
Date d2 = Date.parseDate("2016-09-19");
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toDateArray(Arrays.asList(d1, d2, null)), Type.array(Type.date()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getDateList(0)).containsExactly(d1, d2, null).inOrder();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBoolNull.
@Test
public void bindBoolNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to((Boolean) null), Type.bool());
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBytesArrayEmpty.
@Test
public void bindBytesArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toBytesArray(Arrays.<ByteArray>asList()), Type.array(Type.bytes()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBytesList(0)).isEmpty();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method positiveInfinity.
@Test
public void positiveInfinity() {
Struct row = execute(Statement.newBuilder("SELECT IEEE_DIVIDE(1, 0)"), Type.float64());
assertThat(row.getDouble(0)).isPositiveInfinity();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindInt64ArrayNull.
@Test
public void bindInt64ArrayNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toInt64Array((long[]) null), Type.array(Type.int64()));
assertThat(row.isNull(0)).isTrue();
}
Aggregations