Conversion Between CCL and Q

Learn how to convert CCL to q datatypes, q types to CCL, and q values to CCL rows.

If you wish to convert a CCL datatype to a q datatype other than the type to which it automatically converts, explicitly cast the CCL datatype as the desired q type, as described in EXECUTE STATEMENT DATABASE.

How CCL datatypes convert to q datatypes

CCL datatype

Q datatype

BLOB

list of byte

BOOLEAN

boolean

FLOAT

float

INTEGER

int

INTERVAL

long

LONG

long

STRING

list of char

TIMESTAMP

datetime

XML

list of char

How q datatypes convert to CCL datatypes

Q datatype

CCL datatype

boolean

BOOLEAN

INTEGER

byte

date

int

minute

month

time

second

short

INTEGER

LONG

Time types are set to their q integer representation.

long

INTEGER (On overflow, if value is greater than MAX_INT, the value is set to NULL.)

LONG

real

float

FLOAT

char

list of char

symbol

STRING

datetime

TIMESTAMP

Other types

Conversion not supported

When a database subquery includes a statement using the SQL dialect of q (as opposed to regular q syntax), data is read into CCL from kdb+ as it would be from any database: each row returned by the SQL dialect of q is read into a row in Sybase CEP Engine with the same number of columns. When a database subquery includes a statement using simple q (not its SQL dialect), the results returned by the q statement are mapped as shown in the following table.

Q value mapping to CCL rows and columns

Q

CCL

Single value (atom)

One column, one row.

Simple list

One column, multiple rows.

Dictionary

Two columns, multiple rows.

Flip

Multiple columns, multiple rows (the same as from the SQL dialect of q).