use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindTimestampArray.
@Test
public void bindTimestampArray() {
Timestamp t1 = Timestamp.parseTimestamp("2016-09-18T00:00:00Z");
Timestamp t2 = Timestamp.parseTimestamp("2016-09-19T00:00:00Z");
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toTimestampArray(Arrays.asList(t1, t2, null)), Type.array(Type.timestamp()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getTimestampList(0)).containsExactly(t1, t2, null).inOrder();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindStringArrayEmpty.
@Test
public void bindStringArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toStringArray(Arrays.<String>asList()), Type.array(Type.string()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getStringList(0)).containsExactly();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindFloat64ArrayNull.
@Test
public void bindFloat64ArrayNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toFloat64Array((double[]) null), Type.array(Type.float64()));
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindTimestampNull.
@Test
public void bindTimestampNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to((Timestamp) null), Type.timestamp());
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindInt64.
@Test
public void bindInt64() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").to(1234), Type.int64());
assertThat(row.isNull(0)).isFalse();
assertThat(row.getLong(0)).isEqualTo(1234);
}
Aggregations