Skip to content

Instantly share code, notes, and snippets.

@Ashish-Jovial
Forked from LukeTillman/Program.cs
Last active August 29, 2015 14:17
Show Gist options
  • Save Ashish-Jovial/69f80bd8a954695c9a6d to your computer and use it in GitHub Desktop.
Save Ashish-Jovial/69f80bd8a954695c9a6d to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using Cassandra;
namespace GettingStarted
{
class Program
{
static void Main(string[] args)
{
// Connect to the demo keyspace on our cluster running at 127.0.0.1
Cluster cluster = Cluster.Builder().AddContactPoint("127.0.0.1").Build();
ISession session = cluster.Connect("demo");
// Insert Bob
session.Execute("insert into users (lastname, age, city, email, firstname) values ('Jones', 35, 'Austin', 'bob@example.com', 'Bob')");
// Read Bob's information back and print to the console
Row result = session.Execute("select * from users where lastname='Jones'").First();
Console.WriteLine("{0} {1}", result["firstname"], result["age"]);
// Update Bob's age and then read it back and print to the console
session.Execute("update users set age = 36 where lastname = 'Jones'");
result = session.Execute("select * from users where lastname='Jones'").First();
Console.WriteLine("{0} {1}", result["firstname"], result["age"]);
// Delete Bob, then try to read all users and print them to the console
session.Execute("delete from users where lastname = 'Jones'");
RowSet rows = session.Execute("select * from users");
foreach(Row row in rows)
Console.WriteLine("{0} {1}", row["firstname"], row["age"]);
// Wait for enter key before exiting
Console.ReadLine();
}
}
}
@Ashish-Jovial
Copy link
Author

how can it prove ACID properties ?, if it is local then i guess load on system will increase. Correct me please if i am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment