Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed issue #98

  • Loading branch information...
commit b7aba462ea39c9bfb8d1812284431b83f8516bbf 1 parent 55686d5
Nick Berardi nberardi authored
2  src/Connections/CqlVersion.cs
View
@@ -5,7 +5,7 @@ namespace FluentCassandra.Connections
{
public static class CqlVersion
{
- public const string Cql = "0.8.0";
+ public const string Cql = "2.0.0";
public const string Cql3 = "3.0.0";
public const string Edge = Cql3;
public const string ConnectionDefault = null;
29 src/Operations/ExecuteCqlNonQuery.cs
View
@@ -23,22 +23,19 @@ public override Void Execute()
if (CqlVersion == FluentCassandra.Connections.CqlVersion.ConnectionDefault)
CqlVersion = Session.ConnectionBuilder.CqlVersion;
- switch(CqlVersion) {
- case FluentCassandra.Connections.CqlVersion.Cql:
- Session.GetClient().execute_cql_query(
- query,
- isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE);
- break;
-
- case FluentCassandra.Connections.CqlVersion.Cql3:
- Session.GetClient().execute_cql3_query(
- query,
- isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE,
- Session.WriteConsistency);
- break;
-
- default:
- throw new FluentCassandraException(CqlVersion + " is not a valid CQL version.");
+ var client = Session.GetClient();
+
+ if (CqlVersion == FluentCassandra.Connections.CqlVersion.Cql || client.describe_version() < RpcApiVersion.Cassandra120) {
+ client.execute_cql_query(
+ query,
+ isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE);
+ } else if (CqlVersion == FluentCassandra.Connections.CqlVersion.Cql3) {
+ client.execute_cql3_query(
+ query,
+ isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE,
+ Session.ReadConsistency);
+ } else {
+ throw new FluentCassandraException(CqlVersion + " is not a valid CQL version.");
}
return new Void();
28 src/Operations/ExecuteCqlQuery.cs
View
@@ -43,24 +43,20 @@ public override IEnumerable<ICqlRow> Execute()
if (CqlVersion == FluentCassandra.Connections.CqlVersion.ConnectionDefault)
CqlVersion = Session.ConnectionBuilder.CqlVersion;
+ var client = Session.GetClient();
var result = (CqlResult)null;
- switch (CqlVersion) {
- case FluentCassandra.Connections.CqlVersion.Cql:
- result = Session.GetClient().execute_cql_query(
- query,
- isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE);
- break;
-
- case FluentCassandra.Connections.CqlVersion.Cql3:
- result = Session.GetClient().execute_cql3_query(
- query,
- isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE,
- Session.ReadConsistency);
- break;
-
- default:
- throw new FluentCassandraException(CqlVersion + " is not a valid CQL version.");
+ if (CqlVersion == FluentCassandra.Connections.CqlVersion.Cql || client.describe_version() < RpcApiVersion.Cassandra120) {
+ result = client.execute_cql_query(
+ query,
+ isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE);
+ } else if (CqlVersion == FluentCassandra.Connections.CqlVersion.Cql3) {
+ result = client.execute_cql3_query(
+ query,
+ isCqlQueryCompressed ? Apache.Cassandra.Compression.GZIP : Apache.Cassandra.Compression.NONE,
+ Session.ReadConsistency);
+ } else {
+ throw new FluentCassandraException(CqlVersion + " is not a valid CQL version.");
}
return GetRows(result);
Please sign in to comment.
Something went wrong with that request. Please try again.