BenchmarkAnything-Storage-Backend-SQL

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

          so that we can use an earlier optimization again for
          inserting large amounts of data.

0.025     2019-05-09
        - optimizations in queue processing

0.024     2018-04-11
        - tweak sql schema with more indexes
        - rework transaction handling in queue processing
        - new comparator 'is_empty' to check for absence of value
        - renamed comparator 'not like' into 'not_like'

0.023     2017-02-08
        - parallel sync_search_engine

0.022     2017-02-07
        - default non-core fields mapping type: keyword

0.021     2017-01-31
        - Elasticsearch support

lib/BenchmarkAnything/Storage/Backend/SQL.pm  view on Meta::CPAN


1. Parameter in Sub-Array = restriction operator

    =           - equal
    !=          - not equal
    <           - lower
    >           - greater
    <=          - lower equal
    >=          - greater equal
    like        - SQL LIKE
    not_like    - SQL NOT LIKE
    is_empty    - empty string or undef or null

2. Parameter in Sub-Array = restricted column

A restriction is possible for additional values and the default columns.

3 - n. Parameters in Sub-Array = value for restriction

In general there is just a single value. For '=' and '!=' a check for multiple
values is possible. In SQL it is implemented with IN and NOT IN.

lib/BenchmarkAnything/Storage/Backend/SQL.pm  view on Meta::CPAN

            'VALUE_ID',
        ],
        select      => [
            'testrun_id',
            'machine',
        ],
        where       => [
            ['!=',       'machine',      'mx1.small'     ],
            ['=',        'NAME'   ,      'testbenchmark' ],
            ['like',     'some_key',     'some%value'    ],
            ['not_like', 'another_key',  'another%value' ],
            ['is_empty', 'parameter1',   1 ], # check parameter1 is empty     - Elasticsearch backend only
            ['is_empty', 'parameter2',   0 ], # check parameter2 is not empty - Elasticsearch backend only
        ],
        limit       => 2,
        offset      => 1,
        order_by    => [
            'machine',
            ['testrun_id','ASC']
        ],
    });

lib/BenchmarkAnything/Storage/Backend/SQL/Query/common.pm  view on Meta::CPAN


sub _NOW { "CURRENT_TIMESTAMP" }

sub _FOR_UPDATE { "FOR UPDATE" }

sub default_columns {
    return %h_default_columns;
}

sub benchmark_operators {
    return ( '=', '!=', 'like', 'not_like', 'is_empty', '<', '>', '<=', '>=' );
}

sub create_where_clause {

    my ( $or_self, $s_column_name, $ar_value ) = @_;

    my $s_where_clause = q##;
    if ( $ar_value->[0] eq 'not like' or $ar_value->[0] eq 'not_like' ) {
        $s_where_clause = "$s_column_name NOT LIKE ?";
    }
    elsif ( $ar_value->[0] eq 'like' ) {
        $s_where_clause = "$s_column_name LIKE ?";
    }
    elsif ( $ar_value->[0] eq 'is_empty' ) {
        my $empty_option = $ar_value->[1];
        use Data::Dumper;
        warn "ar_value: ".Dumper($ar_value);
        if (defined($ar_value->[1]) and $ar_value->[1] eq '0') {



( run in 0.558 second using v1.01-cache-2.11-cpan-cc502c75498 )