Name

QBit::Application::Model::DB::clickhouse::dbi - Class for ClickHouse DBI.

Description

Implements dbi methods for ClickHouse driver.

Package methods

new

Arguments:

  • %opts - connection options: host, port, database, user, password, timeout, db(QBit::Application::Model::DB::clickhouse)

Return values:

  • $dbh - object (QBit::Application::Model::DB::clickhouse::dbi)

Example:

my $dbh = QBit::Application::Model::DB::clickhouse::dbi->new(
    host     => '127.0.0.1',
    port     => 8123,
    database => 'default',
    user     => 'default',
    password => '',
    timeout  => 300,
    db       => $app->clickhouse
);

prepare

Arguments:

  • $sql - string (SQL)

Return values:

  • $sth - object (QBit::Application::Model::DB::clickhouse::st)

Example:

my $sth = $dbh->prepare('SELECT 1');

do

Arguments:

  • $sql - string (SQL)

  • $attr - hash ref (additional attributes)

  • @params - array (parameters to binding)

Return values:

  • $boolean - (true on success; false otherwise)

Example:

$dbh->do('INSERT INTO `state` (`date`, `hits`) VALUES ("2017-09-03", 35)')
  or die $dbh->err() . ': ' . $dbh->errstr();