DynamicCacheDescriptor desc = cacheDescriptor(ctx); if (qry.getSchema() == null) { String schema = QueryUtils.normalizeSchemaName(desc.cacheName(), desc.cacheConfiguration().getSqlSchema());
/** Serialize SQL field query to stream. */ void write(SqlFieldsQuery qry, BinaryOutputStream out) { writeObject(out, qry.getSchema()); out.writeInt(qry.getPageSize()); out.writeInt(-1); // do not limit writeObject(out, qry.getSql()); ClientUtils.collection(qry.getArgs() == null ? null : Arrays.asList(qry.getArgs()), out, this::writeObject); out.writeByte((byte)0); // statement type ANY out.writeBoolean(qry.isDistributedJoins()); out.writeBoolean(qry.isLocal()); out.writeBoolean(qry.isReplicatedOnly()); out.writeBoolean(qry.isEnforceJoinOrder()); out.writeBoolean(qry.isCollocated()); out.writeBoolean(qry.isLazy()); out.writeLong(qry.getTimeout()); out.writeBoolean(true); // include column names }
SQLException { GridCacheTwoStepQuery res = GridSqlQuerySplitter.split( connMgr.connectionForThread().connection(qry.getSchema()), prepared, qry.getArgs(),
DynamicCacheDescriptor desc = cacheDescriptor(ctx); if (qry.getSchema() == null) { String schema = QueryUtils.normalizeSchemaName(desc.cacheName(), desc.cacheConfiguration().getSqlSchema());
/** Serialize SQL field query to stream. */ void write(SqlFieldsQuery qry, BinaryOutputStream out) { writeObject(out, qry.getSchema()); out.writeInt(qry.getPageSize()); out.writeInt(-1); // do not limit writeObject(out, qry.getSql()); ClientUtils.collection(qry.getArgs() == null ? null : Arrays.asList(qry.getArgs()), out, this::writeObject); out.writeByte((byte)0); // statement type ANY out.writeBoolean(qry.isDistributedJoins()); out.writeBoolean(qry.isLocal()); out.writeBoolean(qry.isReplicatedOnly()); out.writeBoolean(qry.isEnforceJoinOrder()); out.writeBoolean(qry.isCollocated()); out.writeBoolean(qry.isLazy()); out.writeLong(qry.getTimeout()); out.writeBoolean(true); // include column names }
/** * Split query into two-step query. * @param prepared JDBC prepared statement. * @param qry Original fields query. * @return Two-step query. * @throws IgniteCheckedException in case of error inside {@link GridSqlQuerySplitter}. * @throws SQLException in case of error inside {@link GridSqlQuerySplitter}. */ private GridCacheTwoStepQuery split(Prepared prepared, SqlFieldsQuery qry) throws IgniteCheckedException, SQLException { GridCacheTwoStepQuery res = GridSqlQuerySplitter.split(connectionForThread(qry.getSchema()), prepared, qry.getArgs(), qry.isCollocated(), qry.isDistributedJoins(), qry.isEnforceJoinOrder(), this); List<Integer> cacheIds = collectCacheIds(null, res); if (!F.isEmpty(cacheIds) && hasSystemViews(res)) { throw new IgniteSQLException("Normal tables and system views cannot be used in the same query.", IgniteQueryErrorCode.UNSUPPORTED_OPERATION); } if (F.isEmpty(cacheIds)) res.local(true); else { res.cacheIds(cacheIds); res.local(qry.isLocal()); } res.pageSize(qry.getPageSize()); return res; }