当前位置: 首页>>代码示例>>Java>>正文


Java SQLStates类代码示例

本文整理汇总了Java中org.apache.tajo.jdbc.SQLStates的典型用法代码示例。如果您正苦于以下问题:Java SQLStates类的具体用法?Java SQLStates怎么用?Java SQLStates使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SQLStates类属于org.apache.tajo.jdbc包,在下文中一共展示了SQLStates类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createExternalTable

import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
public TableDesc createExternalTable(final String name, final Schema schema, final Path path, final TableMeta meta)
    throws SQLException, ServiceException {
  return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
      TajoMasterClientProtocol.class, false, true) {
    public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();

      CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
      builder.setName(name);
      builder.setSchema(schema.getProto());
      builder.setMeta(meta.getProto());
      builder.setPath(path.toUri().toString());
      TableResponse res = tajoMasterService.createExternalTable(null, builder.build());
      if (res.getResultCode() == ResultCode.OK) {
        return CatalogUtil.newTableDesc(res.getTableDesc());
      } else {
        throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
      }
    }
  }.withRetries();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:22,代码来源:TajoClient.java

示例2: getTableDesc

import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
public TableDesc getTableDesc(final String tableName) throws SQLException, ServiceException {
  return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
      TajoMasterClientProtocol.class, false, true) {
    public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();

      GetTableDescRequest.Builder build = GetTableDescRequest.newBuilder();
      build.setTableName(tableName);
      TableResponse res = tajoMasterService.getTableDesc(null, build.build());
      if (res.getResultCode() == ResultCode.OK) {
        return CatalogUtil.newTableDesc(res.getTableDesc());
      } else {
        throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
      }
    }
  }.withRetries();
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:18,代码来源:TajoClient.java

示例3: createExternalTable

import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
/**
 * Create an external table.
 *
 * @param tableName The table name to be created. This name is case sensitive. This name can be qualified or not.
 *                  If the table name is not qualified, the current database in the session will be used.
 * @param schema The schema
 * @param path The external table location
 * @param meta Table meta
 * @return the created table description.
 * @throws SQLException
 * @throws ServiceException
 */
public TableDesc createExternalTable(final String tableName, final Schema schema, final Path path,
                                     final TableMeta meta)
    throws SQLException, ServiceException {
  return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
      TajoMasterClientProtocol.class, false, true) {
    public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
      checkSessionAndGet(client);

      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();

      CreateTableRequest.Builder builder = CreateTableRequest.newBuilder();
      builder.setSessionId(sessionId);
      builder.setName(tableName);
      builder.setSchema(schema.getProto());
      builder.setMeta(meta.getProto());
      builder.setPath(path.toUri().toString());
      TableResponse res = tajoMasterService.createExternalTable(null, builder.build());
      if (res.getResultCode() == ResultCode.OK) {
        return CatalogUtil.newTableDesc(res.getTableDesc());
      } else {
        throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
      }
    }
  }.withRetries();
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:38,代码来源:TajoClient.java

示例4: getTableDesc

import org.apache.tajo.jdbc.SQLStates; //导入依赖的package包/类
/**
 * Get a table description
 *
 * @param tableName The table name to get. This name is case sensitive.
 * @return Table description
 */
public TableDesc getTableDesc(final String tableName) throws ServiceException {
  return new ServerCallable<TableDesc>(connPool, tajoMasterAddr,
      TajoMasterClientProtocol.class, false, true) {
    public TableDesc call(NettyClientBase client) throws ServiceException, SQLException {
      checkSessionAndGet(client);

      TajoMasterClientProtocolService.BlockingInterface tajoMasterService = client.getStub();

      GetTableDescRequest.Builder builder = GetTableDescRequest.newBuilder();
      builder.setSessionId(sessionId);
      builder.setTableName(tableName);
      TableResponse res = tajoMasterService.getTableDesc(null, builder.build());
      if (res.getResultCode() == ResultCode.OK) {
        return CatalogUtil.newTableDesc(res.getTableDesc());
      } else {
        throw new SQLException(res.getErrorMessage(), SQLStates.ER_NO_SUCH_TABLE.getState());
      }
    }
  }.withRetries();
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:27,代码来源:TajoClient.java


注:本文中的org.apache.tajo.jdbc.SQLStates类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。