Search in sources :

Example 1 with CloudSpannerDataType

use of nl.topicus.jdbc.CloudSpannerDataType in project spanner-jdbc by olavloite.

the class CloudSpannerResultSet method getArray.

@Override
public Array getArray(int columnIndex) throws SQLException {
    if (isNull(columnIndex))
        return null;
    Type type = resultSet.getColumnType(columnIndex - 1);
    if (type.getCode() != Code.ARRAY)
        throw new CloudSpannerSQLException("Column with index " + columnIndex + " does not contain an array", com.google.rpc.Code.INVALID_ARGUMENT);
    CloudSpannerDataType dataType = CloudSpannerDataType.getType(type.getArrayElementType().getCode());
    List<? extends Object> elements = dataType.getArrayElements(resultSet, columnIndex - 1);
    return CloudSpannerArray.createArray(dataType, elements);
}
Also used : Type(com.google.cloud.spanner.Type) CloudSpannerDataType(nl.topicus.jdbc.CloudSpannerDataType) CloudSpannerDataType(nl.topicus.jdbc.CloudSpannerDataType) CloudSpannerSQLException(nl.topicus.jdbc.exception.CloudSpannerSQLException)

Aggregations

Type (com.google.cloud.spanner.Type)1 CloudSpannerDataType (nl.topicus.jdbc.CloudSpannerDataType)1 CloudSpannerSQLException (nl.topicus.jdbc.exception.CloudSpannerSQLException)1