MariaDB 10.0.1 introduced the following improvements to the dynamic columns feature.
It is possible to refer to column by names. Names can be used everywhere where in MariaDB 5.3 one could use only strings:
COLUMN_CREATE('int_col', 123 as int, 'double_col', 3.14 as double, 'string_col', 'text-data' as char);
COLUMN_ADD(dyncol_blob, 'intcol', 1234);
COLUMN_GET(dynstr, 'column1' as char(10));
COLUMN_EXISTS(dyncol_blob, 'column_name');
select column_list(column_create(1, 22, 2, 23)); +------------------------------------------+ | column_list(column_create(1, 22, 2, 23)) | +------------------------------------------+ | `1`,`2` | +------------------------------------------+ select column_list(column_create('column1', 22, 'column2', 23)); +----------------------------------------------------------+ | column_list(column_create('column1', 22, 'column2', 23)) | +----------------------------------------------------------+ | `column1`,`column2` | +----------------------------------------------------------+
select column_list(column_add(column_create('1a', 22), '1b', 23)); +------------------------------------------------------------+ | column_list(column_add(column_create('1a', 22), '1b', 23)) | +------------------------------------------------------------+ | `1a`,`1b` | +------------------------------------------------------------+
select column_list(column_add(column_create('1a', 22), '1b', 23)); +------------------------------------------------------------+ | column_list(column_add(column_create('1a', 22), '1b', 23)) | +------------------------------------------------------------+ | 1 | +------------------------------------------------------------+
The following new functions have been added to dynamic columns in MariaDB 10
COLUMN_CHECK is used to check a column's integrity. When it encounters an error it does not return illegal format errors but returns false instead. It also checks integrity more thoroughly and finds errors in the dynamic column internal structures which might not be found by other functions.
select column_check(column_create('column1', 22)); +--------------------------------------------+ | column_check(column_create('column1', 22)) | +--------------------------------------------+ | 1 | +--------------------------------------------+ select column_check('abracadabra'); +-----------------------------+ | column_check('abracadabra') | +-----------------------------+ | 0 | +-----------------------------+
COLUMN_JSON converts all dynamic column record content to a JSON object.
select column_json(column_create('column1', 1, 'column2', "two")); +------------------------------------------------------------+ | column_json(column_create('column1', 1, 'column2', "two")) | +------------------------------------------------------------+ | {"column1":1,"column2":"two"} | +------------------------------------------------------------+
Note that Cassandra is no longer actively being developed.
Some internal changes were added to dynamic columns to allow them to serve as an interface to Apache Cassandra dynamic columns. The Cassandra engine may pack all columns which were not mentioned in the MariaDB interface table definition and even bring changes in the dynamic column contents back to the cassandra columns family (the table analog in cassandra).
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/dynamic-columns-in-mariadb-10/