When we execute a single statement we only need the corresponding Row with the result.

@param results a list of {@link StatementResult}
@return the result of a single query
779057
private static Row row(List<StatementResult> results) {
		Row row = results.get( 0 ).getData().get( 0 );
		return row;
	}
354555
public RowResultSet<R> resultSet(int maxRows) {
        if (maxRows <= 0) {
            return new RowResultSet<R>(getRows());
        } // end of if

        return new RowResultSet<R>(getRows().subList(0, maxRows));
    }
1132041
public static <T> List<T> buildSQLResult(SQLRestResponse result,Class<T> type){
		if(result == null || result.getRows() == null || result.getRows().size() == 0)
			return null;
		if(result.getRows() != null && result.getRows().size() > 0) {
			List<Object[]> rows = result.getRows();
			List<T> datas = new ArrayList<T>(rows.size());
			ColumnMeta[] metas = result.getColumns();
			if (Map.class.isAssignableFrom(type)) {
				Map<String,Object> data = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					data = new HashMap<String,Object>(metas.length);
					for (int j = 0; j < metas.length; j++) {
						data.put(metas[j].getName(),row[j]);
					}
					datas.add((T)data);
				}

			} else {
				DateFormat defaultDateFormat = SerialUtil.getDateFormateMeta().toDateFormat();
				T valueObject = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					valueObject = buildObject(type,  metas,  row,defaultDateFormat);
					datas.add(valueObject);
				}
			}
			return datas;
		}
		else {
			return null;
		}

	}
1259041
@Override
    public List<T> getAll(int firstResult, int maxResults) {
        return getDatabaseSupport().getAll(getEntityClass(), firstResult, maxResults);
    }
589943
public boolean isSingleResult() {
		if (result == null) {
			return false;
		} else {
			if (singleResult == null) {
				if (result.size() == 1 && result.values().iterator().next().size() == 1) {
					singleResult = true;
				} else {
					singleResult = false;
				}
			}
			return singleResult;
		}
	}
1174003
private static List<SFStatementType> getResultTypes(JsonNode result)
  {
    JsonNode resultTypes = result.path("data").path("resultTypes");
    if (resultTypes.isNull() ||
        resultTypes.isMissingNode() ||
        resultTypes.asText().isEmpty())
    {
      return Collections.emptyList();
    }

    String[] typeStrs = resultTypes.asText().split(",");

    List<SFStatementType> res = new ArrayList<>();
    for (String typeStr : typeStrs)
    {
      long typeId = Long.valueOf(typeStr);
      res.add(SFStatementType.lookUpTypeById(typeId));
    }
    return res;
  }
956446
protected void onValidateSingleResult(List results)
    {
        if (results == null || results.isEmpty())
        {
            log.error("No result found for {} ", kunderaQuery.getJPAQuery());
            throw new NoResultException("No result found!");
        }

        if (results.size() > 1)
        {
            log.error("Non unique results found for query {} ", kunderaQuery.getJPAQuery());
            throw new NonUniqueResultException("Containing more than one result!");
        }

    }
649908
protected void iterateResult(ResultSet resSet, QueryResultTO resultTO, StatementTO statementTO) {
		
		try {
			if (resSet != null && !resSet.isClosed()) {
	    		ResultSetMetaData metaData = resSet.getMetaData();
			    int cols = metaData.getColumnCount();
			    Map<Integer, Integer> type = new HashMap<Integer, Integer>();
			    
			    List<String> columnsNames = new ArrayList<>();
			    
			    for (int i = 1; i < (cols+1); i++)
			    {
			    	String colName = metaData.getColumnName(i);
			    	columnsNames.add(colName);
			    	type.put(i, metaData.getColumnType(i));
			    }
			   
			    List<List<String>> tableResult = new ArrayList<>();
			    String clobEncoding = statementTO.getClobEncoding() != null ? statementTO.getClobEncoding() : DEFAULT_CLOB_ENCODING;
		        while (resSet.next())
			    {
		        	List<String> row = new ArrayList<>();
		        	for (int i = 1; i < (cols+1); i++)
		    	    {
		            	if (type.get(i) != null && type.get(i) == Types.BLOB) {
		            		if (statementTO.isShowBlobs()) {
		            			row.add(String.valueOf(new String(resSet.getBytes(i))));
			                } else {
			                	row.add(String.valueOf(resSet.getObject(i)));
			                }
		            	} else if (type.get(i) != null && type.get(i) == Types.CLOB) {
		            		if (statementTO.isShowClobs()) {
		            			row.add(getClobString(resSet.getClob(i), clobEncoding ));
		            		} else {
		            			row.add("CLOB content");
		            		}
		            	} else {
		            		row.add(String.valueOf(resSet.getObject(i)));
		            	}
		    	    }
		        	tableResult.add(row);
			    }
		        
		        resultTO.setSqlWarnings(null != resSet.getWarnings() ? resSet.getWarnings().toString() : null);
		        
		        resultTO.setAffectedRows(tableResult.size());
		        resultTO.setColumnsNames(columnsNames);
		        resultTO.setTableResult(tableResult);
	    	} else {
	    		resultTO.setSqlWarnings("resultSet was " + (null != resSet ? "closed already" : "null"));
	    	}
	        resultTO.setSelect(true);
	        
		} catch (Exception e) {
			resultTO.setExceptionMessage(e.getMessage());
			resultTO.setExceptionCause(null != e.getCause() ? e.getCause().toString() : null);
			resultTO.setExceptionTrace(printException(e));
		}
	}
1245563
public static <R> MethodResult<R> success(R result) {
        return new MethodResult<>(result, null, false);
    }
138986
public void setResults(java.util.Collection<SearchRecord> results) {
        if (results == null) {
            this.results = null;
            return;
        }

        this.results = new java.util.ArrayList<SearchRecord>(results);
    }
1308445
public HashMap<String, Object> getFirstResult(String query)
        throws Exception {
        HashMap<String, Object> result = null;

        Statement queryStatement = null;
        ResultSet results = null;
        try (Connection sqlConnection = getConnection()) {
            queryStatement = sqlConnection.createStatement();
            results = queryStatement.executeQuery(query);
            if (results.next()) {
                result = new HashMap<>();
                String[] columns = getColumnNames(results.getMetaData());

                for (String column : columns) {
                    result.put(column, results.getObject(column));
                }
            }
        } catch (Exception e) {

        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (queryStatement != null) {
                    queryStatement.close();
                }
            } catch (Exception e) {
            }
        }

        return result;
    }
705471
public static <T> ExceptionalStream<T, SQLException> rows(final ResultSet resultSet, final Try.Function<ResultSet, T, SQLException> recordGetter) {
        N.checkArgNotNull(resultSet, "resultSet");
        N.checkArgNotNull(recordGetter, "recordGetter");

        final ExceptionalIterator<T, SQLException> iter = new ExceptionalIterator<T, SQLException>() {
            private boolean hasNext;

            @Override
            public boolean hasNext() throws SQLException {
                if (hasNext == false) {
                    hasNext = resultSet.next();
                }

                return hasNext;
            }

            @Override
            public T next() throws SQLException {
                if (hasNext() == false) {
                    throw new NoSuchElementException();
                }

                hasNext = false;

                return recordGetter.apply(resultSet);
            }

            @Override
            public void skip(long n) throws SQLException {
                N.checkArgNotNegative(n, "n");

                final long m = hasNext ? n - 1 : n;

                JdbcUtil.skip(resultSet, m);

                hasNext = false;
            }
        };

        return newStream(iter);
    }
956369
public Result[] batch(List<? extends Row> actions) throws IOException {
    try {
      Object[] resultsOrErrors = new Object[actions.size()];
      batchCallback(actions, resultsOrErrors, null);
      // At this point we are guaranteed that the array only contains results,
      // if it had any errors, batch would've thrown an exception
      Result[] results = new Result[resultsOrErrors.length];
      System.arraycopy(resultsOrErrors, 0, results, 0, results.length);
      return results;
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      LOG.error("Encountered exception in batch(List<>).", e);
      throw new IOException("Batch error", e);
    }
  }
745750
@Override
	protected String[] getRow(String[] resultRow) {
		return Arrays.copyOfRange(resultRow, 1, resultRow.length);
	}
1365963
public String format(Map<String, String> results) {
        return format(results, TableShape.Horizontal);
    }
337426
private List<?> toList(Object results)
    {
        if (results instanceof Object[])
        {
            return Arrays.asList( (Object[]) results );
        }
        if (results instanceof Collection)
        {
            return new ArrayList<Object>( (Collection<?>) results );
        }
        return null;
    }
623760
public ExecutionResult withResult(Object result) {
    return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll);
  }