ClickHouse-Encoder

 view release on metacpan or  search on metacpan

lib/ClickHouse/Encoder/TCP.pm  view on Meta::CPAN

# Compression flags in Query packet
use constant COMPRESSION_DISABLE => 0;
use constant COMPRESSION_ENABLE  => 1;

# Varint and length-prefixed string codecs are XS-backed; the bound
# subs (pack_varint, unpack_varint, pack_string, unpack_string)
# live in PACKAGE = ClickHouse::Encoder::TCP inside Encoder.xs.

# ----- client packets ------------------------------------------------

# Hello packet: announces our protocol revision and credentials.
#
#   pack_hello(
#       client_name => 'ClickHouse::Encoder',  # default
#       major       => 1,                       # default
#       minor       => 0,                       # default
#       revision    => 54429,                   # default
#       database    => 'default',
#       user        => 'default',
#       password    => '',
#   );

t/schema-redirect.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use Config;
use File::Temp qw(tempdir);
use lib 'blib/lib', 'blib/arch', 't/lib';
use ClickHouse::Encoder;

# Keep Enum literals intact and avoid forwarding credentials on redirects.

# Enum label with an unbalanced paren: type must survive verbatim and
# later columns must not be dropped.
{
    my $ddl = q{CREATE TABLE t (`a` Enum8('x)y' = 1, 'z' = 2), b UInt32) ENGINE = Memory};
    my $s = ClickHouse::Encoder->parse_create_table($ddl);
    is_deeply($s->{columns},
        [['a', q{Enum8('x)y' = 1, 'z' = 2)}], ['b', 'UInt32']],
        'paren in Enum label keeps type and later columns');
    is($s->{engine}, 'Memory', 'engine still parsed after Enum fix');



( run in 2.436 seconds using v1.01-cache-2.11-cpan-3f962061493 )