Exemple #1
0
        /// <summary>
        /// Writes the SQL fields query.
        /// </summary>
        private static void WriteSqlFieldsQuery(IBinaryRawWriter writer, SqlFieldsQuery qry,
                                                bool includeColumns = true)
        {
            Debug.Assert(qry != null);

            writer.WriteString(qry.Schema);
            writer.WriteInt(qry.PageSize);
            writer.WriteInt(-1);  // maxRows: unlimited
            writer.WriteString(qry.Sql);
            QueryBase.WriteQueryArgs(writer, qry.Arguments);

            // .NET client does not discern between different statements for now.
            // We could have ExecuteNonQuery method, which uses StatementType.Update, for example.
            writer.WriteByte((byte)StatementType.Any);

            writer.WriteBoolean(qry.EnableDistributedJoins);
            writer.WriteBoolean(qry.Local);
#pragma warning disable 618
            writer.WriteBoolean(qry.ReplicatedOnly);
#pragma warning restore 618
            writer.WriteBoolean(qry.EnforceJoinOrder);
            writer.WriteBoolean(qry.Colocated);
            writer.WriteBoolean(qry.Lazy);
            writer.WriteTimeSpanAsLong(qry.Timeout);
            writer.WriteBoolean(includeColumns);
        }
Exemple #2
0
        /** <inheritDoc /> */
        public IQueryCursor <T> QueryFields <T>(SqlFieldsQuery qry, Func <IBinaryRawReader, int, T> readerFunc)
        {
            IgniteArgumentCheck.NotNull(qry, "qry");
            IgniteArgumentCheck.NotNull(readerFunc, "readerFunc");

            if (string.IsNullOrEmpty(qry.Sql))
            {
                throw new ArgumentException("Sql cannot be null or empty");
            }

            var cursor = DoOutOpObject((int)CacheOp.QrySqlFields, writer =>
            {
                writer.WriteBoolean(qry.Local);
                writer.WriteString(qry.Sql);
                writer.WriteInt(qry.PageSize);

                QueryBase.WriteQueryArgs(writer, qry.Arguments);

                writer.WriteBoolean(qry.EnableDistributedJoins);
                writer.WriteBoolean(qry.EnforceJoinOrder);
                writer.WriteBoolean(qry.Lazy); // Lazy flag.
                writer.WriteInt((int)qry.Timeout.TotalMilliseconds);
                writer.WriteBoolean(qry.ReplicatedOnly);
                writer.WriteBoolean(qry.Colocated);
                writer.WriteString(qry.Schema); // Schema
            });

            return(new FieldsQueryCursor <T>(cursor, _flagKeepBinary, readerFunc));
        }
Exemple #3
0
        private IPlatformTargetInternal QueryFieldsInternal(SqlFieldsQuery qry)
        {
            IgniteArgumentCheck.NotNull(qry, "qry");

            if (string.IsNullOrEmpty(qry.Sql))
            {
                throw new ArgumentException("Sql cannot be null or empty");
            }

            return(DoOutOpObject((int)CacheOp.QrySqlFields, writer =>
            {
                writer.WriteBoolean(qry.Local);
                writer.WriteString(qry.Sql);
                writer.WriteInt(qry.PageSize);

                QueryBase.WriteQueryArgs(writer, qry.Arguments);

                writer.WriteBoolean(qry.EnableDistributedJoins);
                writer.WriteBoolean(qry.EnforceJoinOrder);
                writer.WriteBoolean(qry.Lazy); // Lazy flag.
                writer.WriteInt((int)qry.Timeout.TotalMilliseconds);
                writer.WriteBoolean(qry.ReplicatedOnly);
                writer.WriteBoolean(qry.Colocated);
                writer.WriteString(qry.Schema); // Schema
            }));
        }
Exemple #4
0
        /// <summary>
        /// Writes the SQL query.
        /// </summary>
        private static void WriteSqlQuery(IBinaryRawWriter writer, SqlQuery qry)
        {
            Debug.Assert(qry != null);

            writer.WriteString(qry.QueryType);
            writer.WriteString(qry.Sql);
            QueryBase.WriteQueryArgs(writer, qry.Arguments);
            writer.WriteBoolean(qry.EnableDistributedJoins);
            writer.WriteBoolean(qry.Local);
            writer.WriteBoolean(qry.ReplicatedOnly);
            writer.WriteInt(qry.PageSize);
            writer.WriteTimeSpanAsLong(qry.Timeout);
        }