Skip to content

Commit 679d6e6

Browse files
elcamlosttheory
authored andcommitted
Add URI::clickhouse
1 parent f21368b commit 679d6e6

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Revision history for Perl extension URI::db.
22

33
0.23
4+
- Added URI::clickhouse. Thanks to Ilia Rassadin for the PR (#18).
45

56
0.22 2024-04-05T01:38:17Z
67
- Changed Oracle database DBI parameter generation as follows:

lib/URI/clickhouse.pm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package URI::clickhouse;
2+
use base 'URI::_odbc';
3+
our $VERSION = '0.20';
4+
5+
sub default_port { 8123 }
6+
7+
1;

t/dbi.t

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,34 @@ for my $spec (
501501
dsn => 'dbi:Pg:host=foo;port=123;dbname=try;foo=1;foo=2;lol=yes',
502502
dbi => [ [host => 'foo'], [port => 123], [dbname => 'try'] ],
503503
qry => [ foo => 1, foo => 2, lol => 'yes' ],
504+
uri => 'db:clickhouse:',
505+
dsn => 'dbi:ODBC:',
506+
dbi => [ [DSN => undef] ],
507+
qry => [],
508+
},
509+
{
510+
uri => 'db:clickhouse:dbadmin',
511+
dsn => 'dbi:ODBC:DSN=dbadmin',
512+
dbi => [ [DSN => 'dbadmin'] ],
513+
qry => [],
514+
},
515+
{
516+
uri => 'db:clickhouse://yow',
517+
dsn => 'dbi:ODBC:Server=yow;Port=8123',
518+
dbi => [ [Server => 'yow'], [Port => 8123], [Database => undef] ],
519+
qry => [],
520+
},
521+
{
522+
uri => 'db:clickhouse://yow:33',
523+
dsn => 'dbi:ODBC:Server=yow;Port=33',
524+
dbi => [ [Server => 'yow'], [Port => 33], [Database => undef] ],
525+
qry => [],
526+
},
527+
{
528+
uri => 'db:clickhouse://foo:123/try?foo=1&foo=2&lol=yes&Driver=ClickHouse',
529+
dsn => 'dbi:ODBC:Server=foo;Port=123;Database=try;foo=1;foo=2;lol=yes;Driver=ClickHouse',
530+
dbi => [ [Server => 'foo'], [Port => 123], [Database => 'try'] ],
531+
qry => [ foo => 1, foo => 2, lol => 'yes', Driver => 'ClickHouse' ],
504532
},
505533
) {
506534
my $uri = $spec->{uri};

t/engines.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ for my $spec (
5353
[ cockroachdb => 26257, 'cockroach' ],
5454
[ yugabyte => 5433, 'pg' ],
5555
[ yugabytedb => 5433, 'pg' ],
56+
[ clickhouse => 8123, 'clickhouse' ],
5657
) {
5758
my ($engine, $port, $canon) = @{ $spec };
5859
my $prefix = "db:$engine";

0 commit comments

Comments
 (0)