Orange-OpenSource / YACassandraPDO

Cassandra PDO Driver fork
Apache License 2.0
85 stars 32 forks source link

map<bigint,...> on select is losing array keys #88

Open ghost opened 9 years ago

ghost commented 9 years ago
CREATE TABLE test (id ascii PRIMARY KEY, test map<bigint,text>);

INSERT INTO test (id, test) VALUES ('Hello', {7: 'World'});
INSERT INTO test (id, test) VALUES ('Foo', {3: 'Bar', 4: 'Baz'});
cqlsh> SELECT * FROM test;

 id    | test
-------+----------------------
 Hello |         {7: 'World'}
   Foo | {3: 'Bar', 4: 'Baz'}
$pdo = new \PDO('cassandra:host=localhost;port=9160');
$pdo->exec('USE ...;');

$stmt = $pdo->prepare('SELECT * FROM test;');
$stmt->execute();

echo '<pre>';
print_r($stmt->fetchAll(\PDO::FETCH_ASSOC));
echo '</pre>';
Array(
    [0] => Array(
        [id] => Hello
        [test] => Array(
            [0] => World // must be: [7] => World
        )
    )
    [1] => Array(
        [id] => Foo
        [test] => Array(
            // [3] => Bar // is lost
            [0] => Baz // must be: [4] => Baz
        )
    )
)