use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindStringArrayNull.
@Test
public void bindStringArrayNull() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toStringArray(null), Type.array(Type.string()));
assertThat(row.isNull(0)).isTrue();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method checkSingleValueOfType.
private Struct checkSingleValueOfType(ResultSet resultSet, Type expectedType) {
assertThat(resultSet.next()).isTrue();
assertThat(resultSet.getType().getStructFields()).hasSize(1);
assertThat(resultSet.getType().getStructFields().get(0).getType()).isEqualTo(expectedType);
Struct row = resultSet.getCurrentRowAsStruct();
assertThat(resultSet.next()).isFalse();
return row;
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBoolArray.
@Test
public void bindBoolArray() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toBoolArray(Arrays.asList(true, null, false)), Type.array(Type.bool()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBooleanList(0)).containsExactly(true, null, false).inOrder();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindBoolArrayEmpty.
@Test
public void bindBoolArrayEmpty() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toBoolArray(Arrays.<Boolean>asList()), Type.array(Type.bool()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getBooleanList(0)).containsExactly();
}
use of com.google.cloud.spanner.Struct in project google-cloud-java by GoogleCloudPlatform.
the class ITQueryTest method bindStringArray.
@Test
public void bindStringArray() {
Struct row = execute(Statement.newBuilder("SELECT @v").bind("v").toStringArray(Arrays.asList("a", "b", null)), Type.array(Type.string()));
assertThat(row.isNull(0)).isFalse();
assertThat(row.getStringList(0)).containsExactly("a", "b", null).inOrder();
}
Aggregations