当前位置: 首页>>代码示例>>C#>>正文


C# Table.OpenWriter方法代码示例

本文整理汇总了C#中Table.OpenWriter方法的典型用法代码示例。如果您正苦于以下问题:C# Table.OpenWriter方法的具体用法?C# Table.OpenWriter怎么用?C# Table.OpenWriter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table的用法示例。


在下文中一共展示了Table.OpenWriter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SELECT

        // Table SELECTS //
        public static Table SELECT(string Dir, string Name, DataSet Data, FNodeSet Nodes, Predicate Where)
        {

            Table rs = new Table(Dir, Name, Nodes.Columns);
            RecordWriter w = rs.OpenWriter();
            FastReadPlan plan = new FastReadPlan(Data, Where, Nodes, w);
            plan.Execute();
            w.Close();
            return rs;

        }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:12,代码来源:DataFactory.cs

示例2: GetWriter

        public static RecordWriter GetWriter(Workspace Enviro, Schema Columns, HScriptParser.Return_actionContext context)
        {

            // Get the table name //
            string name = context.full_table_name().table_name().IDENTIFIER().GetText();
            string db =
                (context.full_table_name().database_name() == null)
                ? "GLOBAL"
                : context.full_table_name().database_name().GetText();

            // Figure out if we need to append //
            bool appendto =
                (context.K_INSERT() != null)
                ? true
                : false;

            // Global -- Append //
            if (context.full_table_name().database_name() == null && appendto)
            {
                if (Enviro.ChunkHeap.Exists(name))
                    return Enviro.ChunkHeap[name].OpenWriter();
                throw new HScriptCompileException(string.Format("Chunk '{0}' does not exist", name));
            }

            // Static -- Append //
            if (appendto)
            {
                string fullname = db + "." + name;
                if (Enviro.Exists(db, name))
                    return Enviro.GetStaticTable(db, name).OpenWriter();
                throw new HScriptCompileException(string.Format("Table '{0}' does not exist", fullname));
            }

            // Global -- Create New //
            if (context.full_table_name().database_name() == null)
            {
                RecordSet data = new RecordSet(Columns);
                Enviro.ChunkHeap.Reallocate(name, data);
                return data.OpenWriter();
            }

            // Static -- Create New //
            string dir = Enviro.Connections[db];
            Table t = new Table(dir, name, Columns);
            return t.OpenWriter();

        }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:47,代码来源:VisitorHelper.cs

示例3: Extend

        public override Table Extend(string Dir, string Name, DataSet Data, FNodeSet ClusterVariables, FNodeSet OtherKeepers, Predicate Where)
        {

            // Check that the ClusterVariable count matches the internal node set count //
            if (ClusterVariables.Count != this._fields.Count)
                throw new ArgumentException("The cluster variable count passed does not match the internal cluster variable count");

            // Create the selectors //
            FNodeSet values = OtherKeepers.CloneOfMe();
            FNode n = new FNodeResult(null, new RowClusterCellFunction(this._rule, this._means));
            foreach (FNode t in ClusterVariables.Nodes)
            {
                n.AddChildNode(t.CloneOfMe());
            }
            values.Add("CLUSTER_ID", n);

            // Build a recordset //
            Table tablix = new Table(Dir, Name, values.Columns, Data.MaxRecords);
            RecordWriter w = tablix.OpenWriter();

            // Run a fast select //
            FastReadPlan plan = new FastReadPlan(Data, Where, values, w);
            w.Close();

            return tablix;

        }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:27,代码来源:RowCluster.cs

示例4: Extend

        public override Table Extend(string Dir, string Name, DataSet Data, FNodeSet Inputs, FNodeSet OtherKeepValues, Predicate Where)
        {

            // Combine the keep variables and the expected nodes //
            FNodeSet nodes = FNodeSet.Union(OtherKeepValues.CloneOfMe(), this.Responses.Expected);

            // Open the reader //
            RecordReader rr = Data.OpenReader(Where);

            // Create the output table and stream //
            Table q = new Table(Dir, Name, nodes.Columns);
            RecordWriter Output = q.OpenWriter();

            // Create a memory structure //
            StaticRegister mem = new StaticRegister(Data.Columns);

            // Assign both the input set and output set to the memory structure //
            nodes.AssignRegister(mem);
            Inputs.AssignRegister(mem);

            // Run through each record //
            while (rr.EndOfData == false)
            {

                // Assign memory //
                mem.Assign(rr.ReadNext());

                // Get the array of doubles for the network //
                double[] d = Record.ToDouble(Inputs.Evaluate());

                // Render each node //
                this._Nodes.Render(d);

                // Output //
                Record t = nodes.Evaluate();
                Output.Insert(t);

            }

            Output.Close();

            return q;
        
        }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:44,代码来源:NeuralNetwork.cs

示例5: TestSerializer

        public static void TestSerializer()
        {

            //RecordSet rs = new RecordSet(@"C:\Users\pwdlu_000\Documents\Equus\X_Data\Temp_Database\", "Test1", new Schema("t1 bool, t2 int, t3 double, t4 date, t5 string.16, t6 blob.16"));
            Table t = new Table(@"C:\Users\pwdlu_000\Documents\Equus\X_Data\Temp_Database\", "Test2", new Schema("t1 bool, t2 int, t3 double, t4 date, t5 string.16, t6 blob.16"), 500);
            RecordWriter w = t.OpenWriter();

            for (int i = 0; i < 5000; i++)
            {
                Cell a = new Cell(true);
                Cell b = new Cell(100L);
                Cell c = new Cell(3.14D);
                Cell d = new Cell(DateTime.Now);
                Cell e = new Cell("Hello World1");
                Cell f = new Cell(Guid.NewGuid().ToByteArray());
                Record r = Record.Stitch(a, b, c, d, e, f);
                w.Insert(r);
            }
            w.Close();

            Table x = BinarySerializer.BufferTable(t.Header.Path);
            RecordReader uc = x.OpenReader();

            while (!uc.EndOfData)
            {
                Console.WriteLine(uc.ReadNext());
            }


            //BinarySerializer.FlushRecordSetSafe4(rs);

            //Stopwatch tx = Stopwatch.StartNew();
            //for (int i = 0; i < 1000; i++)
            //{
            //    //BinarySerializer.FlushRecordSet(rs);
            //    //BinarySerializer.FlushRecordSetSafe(rs);
            //    //BinarySerializer.FlushRecordSetSafe2(rs);
            //    //BinarySerializer.FlushRecordSetSafe3(rs);
            //    BinarySerializer.FlushRecordSetSafe4(rs);
            //}
            //tx.Stop();
            //Console.WriteLine(tx.Elapsed);

            //Stopwatch tx = Stopwatch.StartNew();
            //for (int i = 0; i < 1000; i++)
            //{
            //    RecordSet ts = BinarySerializer.BufferRecordSet(rs.Header.Path);
            //    RecordSet ts = BinarySerializer.BufferRecordSetSafe(rs.Header.Path);
            //    RecordSet ts = BinarySerializer.BufferRecordSetSafe2(rs.Header.Path);
            //}
            //tx.Stop();
            //Console.WriteLine(tx.Elapsed);
            //RecordSet qs = BinarySerializer.BufferRecordSetSafe2(rs.Header.Path);
            //qs.Print(10);

            //RecordSet ts = BinarySerializer.BufferRecordSetSafe2(rs.Header.Path);
            //ts.Print(10);


        }
开发者ID:pwdlugosz,项目名称:Horse,代码行数:60,代码来源:Program.cs


注:本文中的Table.OpenWriter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。