Example #1
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");
            }

            IUnmanagedTarget cursor;

            using (var stream = IgniteManager.Memory.Allocate().GetStream())
            {
                var writer = Marshaller.StartMarshal(stream);

                writer.WriteBoolean(qry.Local);
                writer.WriteString(qry.Sql);
                writer.WriteInt(qry.PageSize);

                WriteQueryArgs(writer, qry.Arguments);

                writer.WriteBoolean(qry.EnableDistributedJoins);
                writer.WriteBoolean(qry.EnforceJoinOrder);

                FinishMarshal(writer);

                cursor = UU.CacheOutOpQueryCursor(Target, (int)CacheOp.QrySqlFields, stream.SynchronizeOutput());
            }

            return(new FieldsQueryCursor <T>(cursor, Marshaller, _flagKeepBinary, readerFunc));
        }
Example #2
0
        /** <inheritDoc /> */
        public IQueryCursor <IList> QueryFields(SqlFieldsQuery qry)
        {
            IgniteArgumentCheck.NotNull(qry, "qry");

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

            IUnmanagedTarget cursor;

            using (var stream = IgniteManager.Memory.Allocate().Stream())
            {
                var writer = Marshaller.StartMarshal(stream);

                writer.WriteBoolean(qry.Local);
                writer.WriteString(qry.Sql);
                writer.WriteInt(qry.PageSize);

                WriteQueryArgs(writer, qry.Arguments);

                FinishMarshal(writer);

                cursor = UU.CacheOutOpQueryCursor(Target, (int)CacheOp.QrySqlFields, stream.SynchronizeOutput());
            }

            return(new FieldsQueryCursor(cursor, Marshaller, _flagKeepPortable));
        }
Example #3
0
        /** <inheritDoc /> */
        public IQueryCursor <ICacheEntry <TK, TV> > Query(QueryBase qry)
        {
            IgniteArgumentCheck.NotNull(qry, "qry");

            IUnmanagedTarget cursor;

            using (var stream = IgniteManager.Memory.Allocate().GetStream())
            {
                var writer = Marshaller.StartMarshal(stream);

                qry.Write(writer, IsKeepBinary);

                FinishMarshal(writer);

                cursor = UU.CacheOutOpQueryCursor(Target, (int)qry.OpId, stream.SynchronizeOutput());
            }

            return(new QueryCursor <TK, TV>(cursor, Marshaller, _flagKeepBinary));
        }