use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method negativeInfinity.
@Test
public void negativeInfinity() {
Struct row = execute(Statement.newBuilder("SELECT IEEE_DIVIDE(-1, 0)"), Type.float64());
assertThat(row.getDouble(0)).isNegativeInfinity();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBytesNull.
@Test
public void bindBytesNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to((ByteArray) null), Type.bytes());
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBool.
@Test
public void bindBool() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to(true).build(), Type.bool());
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBoolean(0)).isEqualTo(true);
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindTimestampArrayEmpty.
@Test
public void bindTimestampArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toTimestampArray(Arrays.<Timestamp>asList()), Type.array(Type.timestamp()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getTimestampList(0)).containsExactly();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindString.
@Test
public void bindString() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to("abc"), Type.string());
assertThat(row.isNull(0)).isFalse();
assertThat(row.getString(0)).isEqualTo("abc");
}
Aggregations