Exemplo n.º 1
0
  @Override
  public boolean execute(String sql) throws SQLException {
    checkClosed();
    SQLRequest sqlRequest = new SQLRequest(sql);

    sqlRequest.includeTypesOnResponse(true);
    try {
      sqlResponse = connection.client().sql(sqlRequest).actionGet();
    } catch (SQLActionException e) {
      throw new SQLException(e.getMessage(), e);
    }
    if (sqlResponse.rowCount() < 0 || sqlResponse.rowCount() != sqlResponse.rows().length) {
      return false;
    }
    resultSet = new CrateResultSet(this, sqlResponse);
    return true;
  }
Exemplo n.º 2
0
 @Override
 public boolean execute(String sql) throws SQLException {
   checkClosed();
   SQLRequest sqlRequest = new SQLRequest(sql);
   sqlRequest.setDefaultSchema(connection.getSchema());
   sqlRequest.includeTypesOnResponse(true);
   try {
     ActionFuture<SQLResponse> future = connection.client().sql(sqlRequest);
     if (getQueryTimeout() > 0) {
       sqlResponse = future.actionGet(getQueryTimeout(), TimeUnit.SECONDS);
     } else {
       sqlResponse = future.actionGet();
     }
   } catch (SQLActionException e) {
     throw new SQLException(e.getMessage(), e);
   }
   if (sqlResponse.rowCount() < 0 || sqlResponse.rowCount() != sqlResponse.rows().length) {
     return false;
   }
   resultSet = new CrateResultSet(this, sqlResponse);
   return true;
 }