Active Query Builder Web API

Client for Perl

Download the client for Perl


You can download the ready-to-use client for Perl using the "Download now" link below or install the package from the public repository. Using the package will let you keep the client up-to-date. Full source code is available at GitHub.

Direct Download

Download Active Query Builder Web API Client for Perl:

Download now

Install using CPAN

Use CPAN package manager to add Active Query Builder Web API Client to your Perl project:

cpan install SQL::QueryBuilder::WebApi
CPAN package

Source code on GitHub

Download and review source code of Active Query Builder Web API Client for Perl on GitHub

Source on Github
Getting started with the client for Perl
Create a new API provider
my $api = SQL::QueryBuilder::WebApi::ActiveQueryBuilderApi->new()
Create a new Transform object
my $transform = SQL::QueryBuilder::WebApi::Object::Transform->new();
$transform->guid('9dbd355e-360e-430e-9cca-df6dd8b6d8d1'); #Metadata Guid from dashboard
$transform->sql('select id, name from Person'); #Initial sql query
Add totals calculation
my $avg = SQL::QueryBuilder::WebApi::Object::Totals->new();
$avg->field('id');
$avg->aggregate('avg');

my $max = SQL::QueryBuilder::WebApi::Object::Totals->new();
$max->field('id');
$max->aggregate('max');

$transform->totals([ $avg, $max ]);
Define pagination
my $page = SQL::QueryBuilder::WebApi::Object::Pagination->new();
$page->skip(2);
$page->take(3);

$transform->pagination($page);
Setup sorting
$asc = SQL::QueryBuilder::WebApi::Object::Sorting->new();
$asc->field('id');
$asc->order('asc');

$desc = SQL::QueryBuilder::WebApi::Object::Sorting->new();
$desc->field('id');
$desc->order('desc');

$transform->sortings([ $asc, $desc ]);
Apply filters
my $filter = SQL::QueryBuilder::WebApi::Object::ConditionGroup->new();

my $condition = SQL::QueryBuilder::WebApi::Object::Condition->new();
$condition->field('id');
$condition->condition_operator('Between');
$condition->values([ 1, 5 ]);

$filter->conditions([ $condition ]);

$transform->filter($filter);
Hide some columns
my $column = SQL::QueryBuilder::WebApi::Object::HiddenColumn->new();
$column->field('name');

$transform->hidden_columns([ $column ]);
Send request to the API
$result = $api->transform_sql_post(transform => $transform);
my $transformedSql = $result->sql;
Get list of query columns
my $query = SQL::QueryBuilder::WebApi::Object::SqlQuery->new();
$query->guid('9dbd355e-360e-430e-9cca-df6dd8b6d8d1'); #Metadata Guid from dashboard
$query->text('select id, name from Person'); #Initial sql query

my $columns = $api->get_query_columns_post(query => $query);