Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-DBIx-Class/t/search/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-DBIx-Class/t/search/empty_attrs.t
use strict;
use warnings;

use Test::More;

use lib qw(t/lib);
use DBICTest ':DiffSQL';

my $schema = DBICTest->init_schema();

my $rs = $schema->resultset('Artist')->search(
  [ -and => [ {}, [] ], -or => [ {}, [] ] ],
  {
    select => [],
    columns => {},
    '+columns' => 'artistid',
    join => [ {}, [ [ {}, {} ] ], {} ],
    prefetch => [ [ [ {}, [] ], {} ], {}, [ {} ] ],
    order_by => [],
    group_by => [],
    offset => 0,
  }
);

is_same_sql_bind(
  $rs->as_query,
  '(SELECT me.artistid FROM artist me)',
  [],
);

is_same_sql_bind(
  $rs->count_rs->as_query,
  '(SELECT COUNT(*) FROM artist me)',
  [],
);

is_same_sql_bind(
  $rs->as_subselect_rs->search({}, { columns => 'artistid' })->as_query,
  '(SELECT me.artistid FROM (SELECT me.artistid FROM artist me) me)',
  [],
);

{
  local $TODO = 'Stupid misdesigned as_subselect_rs';
  is_same_sql_bind(
    $rs->as_subselect_rs->as_query,
    $rs->as_subselect_rs->search({}, { columns => 'artistid' })->as_query,
  );
}

done_testing;

Hry