Apache.Cassandra.Cassandra.Client.set_keyspace C# (CSharp) Method

set_keyspace() public method

public set_keyspace ( string keyspace ) : void
keyspace string
return void
      public void set_keyspace(string keyspace)
      {
        #if !SILVERLIGHT
        send_set_keyspace(keyspace);
        recv_set_keyspace();

        #else
        var asyncResult = Begin_set_keyspace(null, null, keyspace);
        End_set_keyspace(asyncResult);

        #endif
      }
      #if SILVERLIGHT

Usage Example

Example #1
0
        private static void Main()
        {
            TTransport framedTransport = new TFramedTransport(new TSocket("localhost", 9160));
            TTransport socketTransport = new TSocket("localhost", 9160);
            TProtocol framedProtocol = new TBinaryProtocol(framedTransport);
            TProtocol socketProtocol = new TBinaryProtocol(socketTransport);

            var client = new Cassandra.Client(framedProtocol, framedProtocol); // all framed
            //var client = new Cassandra.Client(socketProtocol, socketProtocol); // all socket
            //var client = new Cassandra.Client(framedProtocol, socketProtocol); // in: framed out: socket
            //var client = new Cassandra.Client(socketProtocol, framedProtocol); // in: socket out: framed

            framedTransport.Open();
            socketTransport.Open();
            Console.WriteLine("Start");

            client.set_keyspace("Keyspace1");

            Console.WriteLine("Count Key");
            var key = Encoding.ASCII.GetBytes("MyKey");
            var columns = new List<byte[]>(new[] { Encoding.ASCII.GetBytes("MyColumn") });
            var column_parent = new ColumnParent {
                Column_family = "Standard1"
            };
            var predicate = new SlicePredicate {
                Column_names = columns
            };
            client.get_count(key, column_parent, predicate, ConsistencyLevel.ALL);

            Console.WriteLine("Done");
            Console.Read();
        }
All Usage Examples Of Apache.Cassandra.Cassandra.Client::set_keyspace
Cassandra.Client