*/
private void retrieveSchema() throws SQLException {
try {
TGetResultSetMetadataReq metadataReq = new TGetResultSetMetadataReq(stmtHandle);
// TODO need session handle
TGetResultSetMetadataResp metadataResp;
if (transportLock == null) {
metadataResp = client.GetResultSetMetadata(metadataReq);
} else {
transportLock.lock();
try {
metadataResp = client.GetResultSetMetadata(metadataReq);
} finally {
transportLock.unlock();
}
}
Utils.verifySuccess(metadataResp.getStatus());
StringBuilder namesSb = new StringBuilder();
StringBuilder typesSb = new StringBuilder();
TTableSchema schema = metadataResp.getSchema();
if (schema == null || !schema.isSetColumns()) {
// TODO: should probably throw an exception here.
return;
}
setSchema(new TableSchema(schema));