Switch to: V9V8V7V6V5

CREATE KEYVALUE

Defines a new KeyValue and prepares it for the receiving data.

Syntax

--
-- to create default KeyValue:
--
keyvalue_definition
    :    CREATE [OR REPLACE] [TEMPORARY] [RAM] [COMPRESSED] 
         KEYVALUE [IF NOT EXISTS] keyvalue_name
--
-- to create KeyValue WITH KEY
--
keyvalue_definition
    :    CREATE [OR REPLACE] [TEMPORARY] [RAM] [COMPRESSED]
         KEYVALUE [IF NOT EXISTS] keyvalue_name
         WITH KEY ( vext_key_parts )
 
vext_key_parts
    :    vext_key_part, ...
 
vext_key_part
    :    BYTE | SHORT | USHORT | LONG | ULONG | LLONG | ULLONG | VARBINARY | VARCHAR
--
-- to create a specialized KeyValue: FOR TABLE, FOR LINK, FOR TABLES
--
keyvalue_definition
    :    CREATE [OR REPLACE] [TEMPORARY] [RAM] [COMPRESSED]
         KEYVALUE [IF NOT EXISTS] keyvalue_name
         { FOR TABLES
         | FOR TABLE table_name
         | FOR LINK link_name 
         }

ARGUMENTS

OR REPLACE

This clause forces dropping of an existed keyvalue with the specified name and creates new empty keyvalue as specified. So effectively this is the same as

DROP KEYVALUE T;
CREATE KEYVALUE T ....

NOTE: 'OR REPLACE' syntax Valentina have taken from Oracle/Postgre world.

TEMPORARY

If specified then KeyValue will be created as Temporary Database Object, i.e. files are stored on .tmp volume, and information about this object is not saved into the schema.

RAM

If specified then KeyValue creates own files as ram-files, not touching the disk.

COMPRESSED

If specified then KeyValue uses compression for big values, which are going into underline Segment File, similar to BLOB field. It should notice that picture values are not compressed.

IF NOT EXISTS

The IF NOT EXISTS option allows you to suppress the error message in case if such keyvalue already exists. This makes it much easier to perform SQL dumps without interruption.

NOTE: 'IF NOT EXISTS' syntax Valentina have taken from MySQL world.

keyvalue_name

Specifies the name of new keyvalue. The keyvalue object belongs to the database. Keyvalue objects share the same namespace within a database.

WITH KEY

This form allows you to create a special KeyValue WITH KEY. You should specify the KEY structure using a comma-separated list of allowed types.

FOR TABLE

This form allows you to create a special KeyValue FOR TABLE. In this case, you should also specify the name of Table.

FOR LINK

This form allows you to create a special KeyValue FOR LINK. In this case, you should also specify the name of Link.

FOR TABLES

This form allows you to create a special KeyValue FOR TABLES.

Examples

Default KeyValue

CREATE KEYVALUE kvProperties;
CREATE KEYVALUE TEMPORARY kvProperties;

KeyValue With KEY

CREATE KEYVALUE kvProperties FOR TABLE T1

Default KeyValue

CREATE KEYVALUE kvProperties FOR TABLE T1