=pod

=encoding UTF-8

=head1 NAME

ClickHouse - Database driver for Clickhouse OLAP Database

=head1 VERSION

Version 0.01




=head1 SYNOPSIS

ClickHouse - perl interface to Clickhouse Database. My final goal is to create DBI compatible driver for ClickHouse, but for now it's standalone module.

It's the first version and so module is EXPERIMENTAL. I can't guarantee API stability. More over, API will probably change and it will be soon.

This module is a big rough on the edges, but I decided to release it on CPAN so people can start playing around with it.


=head1 EXAMPLE

    use ClickHouse;

    my $ch = ClickHouse->new(
        host     => $ENV{'CLICK_HOUSE_HOST'}
        port     => 8123,
        user     => 'Frodo'
        password => 'finger',
    );

    my $rows = $ch->select("SELECT id, field_one, field_two FROM some_table");

    for my $row (@$rows) {
        # Do something with your row
    }

    $ch->do("INSERT INTO some_table (id, field_one, field_two) VALUES",
        [1, "String value", 38962986],
        [2, "String value", 38962986],
    );


=head1 SUBROUTINES/METHODS

=head2 new

Create new connection object

=head2 select

Fetch data from table. It returns a reference to an array that contains one reference per row (similar to DBI::fetchall_arrayref).

=head2 do

Modify data inside the database. It's universal method for any queries, which modify data. So if you want to create, alter, detach or drop table or partition or insert data into table it's your guy.

=head1 AUTHOR

Ilya Rassadin, C<< <elcamlost at gmail.com> >>

=head1 TODO

The closest plans are

=over 4

=item * Switch to Net::HTTP::NB

=item * Catch more errors and make exception messages more obvious

=item * Add new options (auto_reconnect, for example).

=back

=head1 BUGS

Please report any bugs or feature requests to L<https://github.com/elcamlost/perl-DBD-ClickHouse/issues>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.


=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc ClickHouse


You can also look for information at:

=over 4

=item * ClickHouse official documentation

L<https://clickhouse.yandex/reference_en.html>

=item * Metacpan

L<https://metacpan.org/pod/ClickHouse/>

=item * GitHub

L<https://github.com/elcamlost/perl-DBD-ClickHouse>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/ClickHouse>

=item * Search CPAN

L<http://search.cpan.org/dist/ClickHouse/>

=back


=head1 ACKNOWLEDGEMENTS


=head1 LICENSE AND COPYRIGHT

Copyright 2016 Ilya Rassadin.

This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (1.0). You may obtain a
copy of the full license at:

L<http://www.perlfoundation.org/artistic_license_1_0>

Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution. Such use shall not be
construed as a distribution of this Package.

The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.