diff --git a/Build.PL b/Build.PL index f7f08cd..39fb010 100644 --- a/Build.PL +++ b/Build.PL @@ -8,7 +8,7 @@ Module::Build->new( requires => { 'Apache::Session' => 0, 'JSON' => 0, }, recommends => { 'DBI' => 0, 'Net::LDAP' => 0.38, }, test_requires => { DBI => 0, 'DBD::SQLite' => 0, }, - dist_version => '1.2.9', + dist_version => '1.3.0', autosplit => [qw(lib/Apache/Session/Browseable/_common.pm)], configure_requires => { 'Module::Build' => 0, }, )->create_build_script; diff --git a/Changes b/Changes index 9915e98..9cfe36a 100644 --- a/Changes +++ b/Changes @@ -79,4 +79,7 @@ Revision history for Perl extension Apache::Session::Browseable. 1.2.9 - Use either Redis::Fast or Redis - - Fix error when searchOn is used without fields + - Fix error when searchOn is used without fields (PgJSON) + +1.3.0 + - Fix also PgHstore error when searchOn is used without fields diff --git a/META.json b/META.json index 01efba6..218602d 100644 --- a/META.json +++ b/META.json @@ -152,6 +152,6 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "v1.2.9", + "version" : "v1.3.0", "x_serialization_backend" : "JSON::PP version 2.97001" } diff --git a/META.yml b/META.yml index f45149a..3dca3db 100644 --- a/META.yml +++ b/META.yml @@ -104,5 +104,5 @@ requires: JSON: '0' resources: license: http://dev.perl.org/licenses/ -version: v1.2.9 +version: v1.3.0 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/lib/Apache/Session/Browseable/PgHstore.pm b/lib/Apache/Session/Browseable/PgHstore.pm index 6d039ef..42e9c64 100644 --- a/lib/Apache/Session/Browseable/PgHstore.pm +++ b/lib/Apache/Session/Browseable/PgHstore.pm @@ -45,10 +45,6 @@ sub searchOnExpr { sub _query { my ( $class, $args, $query, @fields ) = @_; my %res = (); - my $index = - ref( $args->{Index} ) - ? $args->{Index} - : [ split /\s+/, $args->{Index} ]; my $dbh = $class->_classDbh($args); my $table_name = $args->{TableName} @@ -56,20 +52,32 @@ sub _query { my $sth; my $fields = - join( ',', 'id', map { s/'//g; "a_session -> '$_' AS $_" } @fields ); + @fields + ? join( ',', 'id', map { s/'//g; "a_session -> '$_' AS $_" } @fields ) + : '*'; $sth = $dbh->prepare("SELECT $fields from $table_name where $query->{query}"); $sth->execute( @{ $query->{values} } ); # In this case, PostgreSQL change field name in lowercase my $res = $sth->fetchall_hashref('id') or return {}; - foreach (@fields) { - if ( $_ ne lc($_) ) { - foreach my $s ( keys %$res ) { - $res->{$s}->{$_} = delete $res->{$s}->{ lc $_ }; + if (@fields) { + foreach (@fields) { + if ( $_ ne lc($_) ) { + foreach my $s ( keys %$res ) { + $res->{$s}->{$_} = delete $res->{$s}->{ lc $_ }; + } } } } + else { + my $self = eval "&${class}::populate();"; + my $sub = $self->{unserialize}; + foreach my $s ( keys %$res ) { + my $tmp = &$sub( { serialized => $res->{$s}->{a_session} } ); + $res->{$s} = $tmp; + } + } return $res; } diff --git a/rpm/Apache-Session-Browseable.spec b/rpm/Apache-Session-Browseable.spec index 4ed6efb..bb19c78 100644 --- a/rpm/Apache-Session-Browseable.spec +++ b/rpm/Apache-Session-Browseable.spec @@ -3,7 +3,7 @@ #============================================================================== %define real_name Apache-Session-Browseable -%define real_version 1.2.9 +%define real_version 1.3.0 #============================================================================== # Main package