tom-- / yii2-dynamic-ar

An extension to add NoSQL-like documents to Yii 2 Framework's Active Record ORM.
ISC License
57 stars 15 forks source link

Nested columns in wrong charset in Maria 10.1 #19

Closed tom-- closed 7 years ago

tom-- commented 7 years ago
tests\unit\DynamicActiveRecordTest::testCustomColumns
tests\unit\DynamicActiveRecordTest::testCustomColumnsExpression

are failing because https://jira.mariadb.org/browse/MDEV-9429

In these tests the insert is

INSERT INTO `product` (id, name, dynamic_columns) VALUES (
    1,
    'product1',
    COLUMN_CREATE(
        'supplier_id', 1,
        'str', 'value1',
        'int', 123,
        'float', 123.456,
        'bool', TRUE,
        'null', null,
        'children', COLUMN_CREATE(
            'str', 'value1',
            'int', 123,
            'float', 123.456,
            'bool', TRUE,
            'null', null
        )
    ))

and the select is

SELECT *, 
    (
        COLUMN_GET(
            COLUMN_GET(`dynamic_columns`, 'children' AS char), 
            'int' AS char
        ) * 2
    ) AS customColumn, 
    COLUMN_JSON(`dynamic_columns`) AS `dynamic_columns` 
FROM `product` WHERE `name`='product1'

If the inner column_get is instead

            COLUMN_GET(`dynamic_columns`, 'children' AS binary)

then all should be well.

Hence it may be sufficient to get all columns deeper than level 1 AS binary.

tom-- commented 7 years ago

https://jira.mariadb.org/browse/MDEV-11928