ShardingSphereStatement extends AbstractStatementAdapter { @Override public ResultSet executeQuery(final String sql) throws SQLException { if (Strings.isNullOrEmpty(sql)) { throw new SQLException(SQLExceptionConstant.SQL_STRING_NULL_OR_EMPTY); } ResultSet result; try { executionContext = createExecutionContext(sql); List<QueryResult> queryResults; if (ExecutorConstant.MANAGED_RESOURCE) { Collection<InputGroup<StatementExecuteUnit>> inputGroups = getInputGroups(); cacheStatements(inputGroups); queryResults = statementExecutor.executeQuery(inputGroups); } else { queryResults = rawExecutor.executeQuery(getRawInputGroups(), new RawSQLExecutorCallback()); } MergedResult mergedResult = mergeQuery(queryResults); result = new ShardingSphereResultSet(statements.stream().map(this::getResultSet).collect(Collectors.toList()), mergedResult, this, executionContext); } finally { currentResultSet = null; } currentResultSet = result; return result; } ShardingSphereStatement(final ShardingSphereConnection connection);  ShardingSphereStatement(final ShardingSphereConnection connection, final int resultSetType, final int resultSetConcurrency);  ShardingSphereStatement(final ShardingSphereConnection connection, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability); @Override ResultSet executeQuery(final String sql); @Override int executeUpdate(final String sql); @Override int executeUpdate(final String sql, final int autoGeneratedKeys); @Override int executeUpdate(final String sql, final int[] columnIndexes); @Override int executeUpdate(final String sql, final String[] columnNames); @Override boolean execute(final String sql); @Override boolean execute(final String sql, final int autoGeneratedKeys); @Override boolean execute(final String sql, final int[] columnIndexes); @Override boolean execute(final String sql, final String[] columnNames); @Override ResultSet getResultSet(); @SuppressWarnings("MagicConstant") @Override int getResultSetType(); @SuppressWarnings("MagicConstant") @Override int getResultSetConcurrency(); @Override int getResultSetHoldability(); @Override boolean isAccumulate(); @Override Collection<Statement> getRoutedStatements(); @Override ResultSet getGeneratedKeys();  }
@Test(expected = SQLException.class) public void assertQueryWithNull() throws SQLException { try (Statement statement = getShardingSphereDataSource().getConnection().createStatement()) { statement.executeQuery(null); } }
@Test(expected = SQLException.class) public void assertQueryWithEmptyString() throws SQLException { try (Statement statement = getShardingSphereDataSource().getConnection().createStatement()) { statement.executeQuery(""); } }