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
type_specification ::= FROZEN<type>
Where
type
is a well-formed CQL datatype (additional restrictions fortype
are covered in the Semantics section below).
Semantics
- Columns of type
FROZEN
can be part of thePRIMARY KEY
. - Type parameters of
FROZEN
type must be either collection types (LIST
,MAP
, orSET
) or user-defined types. FROZEN
types can be parameters of collection types.- For any valid frozen type parameter
type
, values oftype
are convertible intoFROZEN<type>
.
Examples
You can do this as shown below.
cqlsh:example> CREATE TABLE directory(file FROZEN<LIST<TEXT>> PRIMARY KEY, value BLOB);
cqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'documents', 'homework.doc' ], 0x);
cqlsh:example> INSERT INTO directory(file, value) VALUES([ 'home', 'downloads', 'textbook.pdf' ], 0x12ab21ef);
cqlsh:example> UPDATE directory SET value = 0xab00ff WHERE file = [ 'home', 'documents', 'homework.doc' ];
cqlsh:example> SELECT * FROM directory;
file | value
---------------------------------------+------------
['home', 'downloads', 'textbook.pdf'] | 0x12ab21ef
['home', 'documents', 'homework.doc'] | 0xab00ff
See Also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .