diff --git a/doc/cql/CQL.html b/doc/cql/CQL.html index e835470256..ef0183e80b 100644 --- a/doc/cql/CQL.html +++ b/doc/cql/CQL.html @@ -1,4 +1,4 @@ -

Cassandra Query Language (CQL) v0.99.1

Table of Contents

  1. Cassandra Query Language (CQL) v0.99.1
    1. Table of Contents
    2. USE
    3. SELECT
      1. Specifying Columns
      2. Column Family
      3. Consistency Level
      4. Filtering rows
      5. Limits
    4. UPDATE
      1. Column Family
      2. Consistency Level
      3. Specifying Columns and Row
    5. DELETE
      1. Specifying Columns
      2. Column Family
      3. Consistency Level
      4. Specifying Rows
    6. TRUNCATE
    7. CREATE KEYSPACE
    8. Common Idioms
      1. Specifying Consistency
      2. Term specification
        1. String Literals
        2. Integers / longs
        3. UUIDs

USE

Synopsis:

USE <KEYSPACE>;
+

Cassandra Query Language (CQL) v0.99.1

Table of Contents

  1. Cassandra Query Language (CQL) v0.99.1
    1. Table of Contents
    2. USE
    3. SELECT
      1. Specifying Columns
      2. Column Family
      3. Consistency Level
      4. Filtering rows
      5. Limits
    4. UPDATE
      1. Column Family
      2. Consistency Level
      3. Specifying Columns and Row
    5. DELETE
      1. Specifying Columns
      2. Column Family
      3. Consistency Level
      4. Specifying Rows
    6. TRUNCATE
    7. CREATE KEYSPACE
    8. Common Idioms
      1. Specifying Consistency
      2. Term specification
        1. String Literals
        2. Unicode
        3. Integers / longs
        4. UUIDs

USE

Synopsis:

USE <KEYSPACE>;
 

A USE statement consists of the USE keyword, followed by a valid keyspace name. Its purpose is to assign the per-connection, current working keyspace. All subsequent keyspace-specific actions will be performed in the context of the supplied value.

SELECT

Synopsis:

SELECT [FIRST N] [REVERSED] <SELECT EXPR> FROM <COLUMN FAMILY> [USING <CONSISTENCY>]
         [WHERE <CLAUSE>] [LIMIT N];
 

A SELECT is used to read one or more records from a Cassandra column family. It returns a result-set of rows, where each row consists of a key and a collection of columns corresponding to the query.

Specifying Columns

SELECT [FIRST N] [REVERSED] name1, name2, name3 FROM ...
@@ -29,4 +29,4 @@ UPDATE ... WHERE KEY IN (keyname1, keyname2)
 

Accepts a single argument for the column family name, and permanently removes all data from said column family.

CREATE KEYSPACE

Synopsis:

CREATE KEYSPACE <NAME> WITH replication_factor = <NUM> AND strategy_class = "<STRATEGY>"
     [AND strategy_options.<OPTION> = <VALUE> [AND strategy_options.<OPTION> = <VALUE>]];
 

The CREATE KEYSPACE statement creates a new top-level namespace (aka “keyspace”). Valid names are any string constructed of alphanumeric characters and underscores, but must begin with a letter. Properties such as replication strategy and count are specified during creation using the following accepted keyword arguments:

keywordrequireddescription
replication_factoryesNumeric argument that specifies the number of replicas for this keyspace.
strategy_classyesClass name to use for managing replica placement. Any of the shipped strategies can be used by specifying the class name relative to org.apache.cassandra.locator, others will need to be fully-qualified and located on the classpath.
strategy_optionsnoSome strategies require additional arguments which can be supplied by appending the option name to the strategy_options keyword, separated by a colon (:). For example, a strategy option of “DC1” with a value of “1” would be specified as strategy_options:DC1 = "1".

Common Idioms

Specifying Consistency

... USING <CONSISTENCY> ...
-

Consistency level specifications are made up the keyword USING, followed by a consistency level identifier. Valid consistency levels are as follows:

Term specification

Where possible, the type of terms are inferred; the following term types are supported:

String Literals

String literals are any value enclosed in double-quotes, (`"`). String literals are treated as raw bytes; no interpolation is performed.

Integers / longs

Integers are any term consisting soley of unquoted numericals, longs are any otherwise valid integer term followed by an upper case “L”, (e.g. 100L). It is an error to specify an integer term that will not fit in 4 bytes unsigned, or a long that will not fit in 8 bytes unsigned.

UUIDs

There are two types of UUIDs supported by the CQL specification, time-based (version 1) and randomly generated (version 4). These are specified in statements using the timeuuid(<UUID STRING>) and uuid(<UUID STRING>) notations respectively.

In addition to the hex-based string representation, timeuuid() terms also accept arguments to specify the data-time component. The full list of timeuuid() arguments are:

argumentexamplebehavior
nonetimeuuid()Results in the creation of a new UUID based on system time of the node parsing the query.
nowtimeuuid(“now”)Results in the creation of a new UUID based on system time of the node parsing the query.
milliseconds since epochtimeuuid(1296755320376)Creates a UUID with a time component that is based on the supplied time-stamp.
iso8601 timestamptimeuuid(“2011-02-01T14:00-0600”)Creates a UUID with a time component that is based on the supplied time-stamp.
string representation (hex)timeuuid(“e9229b24-2fbe-11e0-a4de-0026c650d722”)Reproduces the specified version 1 UUID node-side.
\ No newline at end of file +

Consistency level specifications are made up the keyword USING, followed by a consistency level identifier. Valid consistency levels are as follows:

Term specification

Where possible, the type of terms are inferred; the following term types are supported:

String Literals

String literals are any value enclosed in double-quotes, (`"`). String literals are treated as raw bytes; no interpolation is performed.

Unicode

Unicode terms are any double-quoted string prefixed with a lower-case u, for example u"© 2011 The Apache Software Foundation". Unicode terms are identical to standard string literals, with the exception that they are encoded to bytes using the UTF-8 charset.

Integers / longs

Integers are any term consisting soley of unquoted numericals, longs are any otherwise valid integer term followed by an upper case “L”, (e.g. 100L). It is an error to specify an integer term that will not fit in 4 bytes unsigned, or a long that will not fit in 8 bytes unsigned.

UUIDs

There are two types of UUIDs supported by the CQL specification, time-based (version 1) and randomly generated (version 4). These are specified in statements using the timeuuid(<UUID STRING>) and uuid(<UUID STRING>) notations respectively.

In addition to the hex-based string representation, timeuuid() terms also accept arguments to specify the data-time component. The full list of timeuuid() arguments are:

argumentexamplebehavior
nonetimeuuid()Results in the creation of a new UUID based on system time of the node parsing the query.
nowtimeuuid(“now”)Results in the creation of a new UUID based on system time of the node parsing the query.
milliseconds since epochtimeuuid(1296755320376)Creates a UUID with a time component that is based on the supplied time-stamp.
iso8601 timestamptimeuuid(“2011-02-01T14:00-0600”)Creates a UUID with a time component that is based on the supplied time-stamp.
string representation (hex)timeuuid(“e9229b24-2fbe-11e0-a4de-0026c650d722”)Reproduces the specified version 1 UUID node-side.
\ No newline at end of file diff --git a/doc/cql/CQL.textile b/doc/cql/CQL.textile index 46e4142d8f..4bf4fcc21a 100644 --- a/doc/cql/CQL.textile +++ b/doc/cql/CQL.textile @@ -195,10 +195,14 @@ h3(#terms). Term specification Where possible, the type of terms are inferred; the following term types are supported: -h4. String Literals +h4(#string_literals). String Literals String literals are any value enclosed in double-quotes, (`"`). String literals are treated as raw bytes; no interpolation is performed. +h4. Unicode + +Unicode terms are any double-quoted string prefixed with a lower-case @u@, for example @u"© 2011 The Apache Software Foundation"@. Unicode terms are identical to standard "string literals":#string_literals, with the exception that they are encoded to bytes using the UTF-8 charset. + h4. Integers / longs Integers are any term consisting soley of unquoted numericals, longs are any otherwise valid integer term followed by an upper case "L", (e.g. 100L). It is an error to specify an integer term that will not fit in 4 bytes unsigned, or a long that will not fit in 8 bytes unsigned.