Exemplo n.º 1
0
        public void issue_20()
        {
            var table = R.Db(DbName).Table(TableName);

            table.Delete().Run(conn);

            Console.WriteLine(">>> INSERT");
            var result = table.Insert(new { foo = "bar" }).RunResult(conn);
            var id     = result.GeneratedKeys[0];

            result.AssertInserted(1);

            Console.WriteLine(">>> UPDATE 1 / VALUE 1");
            var value = "VALUE1";

            result = table.Get(id).update(new { Target = value }).RunResult(conn);
            result.Dump();

            Console.WriteLine(">>> UPDATE 2 / VALUE 2");
            value = "VALUE2";
            var optResult = table.Get(id).update(new { Target = value })
                            .optArg("return_changes", true).Run(conn);

            ExtensionsForTesting.Dump(optResult);
        }
Exemplo n.º 2
0
        public void insert_some_binary_the_java_way()
        {
            var data = Enumerable.Range(0, 256)
                       .Select(Convert.ToByte)
                       .ToArray();

            var myObject = new MapObject()
            {
                { "id", "javabin" },
                { "the_data", R.Binary(data) }
            };

            R.Db(DbName).Table(TableName)
            .Insert(myObject).Run(conn);

            var result = R.Db(DbName).Table(TableName)
                         .Get("javabin").Run(conn);

            ExtensionsForTesting.Dump(result.the_data);
        }