FROZEN Datatypes

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

FROZEN datatype is used to specify columns of binary strings that result from serializing either collections, tuples, or user-defined types.

Syntax

  1. type_specification ::= FROZEN<type>

Where

  • type is a well-formed CQL datatype (additional restrictions for type are covered in the Semantics section below).

Semantics

  • Columns of type FROZEN can be part of the PRIMARY KEY.
  • Type parameters of FROZEN type must be either collection types (LIST, MAP, or SET) or user-defined types.
  • FROZEN types can be parameters of collection types.
  • For any valid frozen type parameter type, values of type are convertible into FROZEN<type>.

Examples

You can do this as shown below.

  1. cqlsh:example> CREATE TABLE directory(file FROZEN<LIST<TEXT>> PRIMARY KEY, value BLOB);
  1. cqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'documents', 'homework.doc' ], 0x);
  1. cqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'downloads', 'textbook.pdf' ], 0x12ab21ef);
  1. cqlsh:example> UPDATE directory SET value = 0xab00ff WHERE file = [ 'home', 'documents', 'homework.doc' ];
  1. cqlsh:example> SELECT * FROM directory;
  1. file | value
  2. ---------------------------------------+------------
  3. ['home', 'downloads', 'textbook.pdf'] | 0x12ab21ef
  4. ['home', 'documents', 'homework.doc'] | 0xab00ff

See Also

Data Types