From 074413739fbab03ab56f1140ccbe2625d34db079 Mon Sep 17 00:00:00 2001 From: ostmann Date: Mon, 10 Jan 2011 11:56:49 +0100 Subject: [PATCH 1/4] - Failing test for wrong order when 'select'-attr is used --- t/search/select_chains.t | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/t/search/select_chains.t b/t/search/select_chains.t index 6adbca53b..1efa39f34 100644 --- a/t/search/select_chains.t +++ b/t/search/select_chains.t @@ -107,4 +107,20 @@ is_same_sql_bind ( 'Correct chaining before attr resolution' ); +# Test the order of columns +$rs = $schema->resultset('CD')->search ({}, { + 'select' => [ 'me.cdid', 'me.title' ], +}); + +is_same_sql_bind ( + $rs->as_query, + '( SELECT + me.cdid, + me.title + FROM cd me + )', + [], + 'Corrent order of selected columns' +); + done_testing; From b14de32734e19850934ec609b8b10d6085dca206 Mon Sep 17 00:00:00 2001 From: ostmann Date: Mon, 10 Jan 2011 11:59:55 +0100 Subject: [PATCH 2/4] - Typo --- t/search/select_chains.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/search/select_chains.t b/t/search/select_chains.t index 1efa39f34..bdec570f0 100644 --- a/t/search/select_chains.t +++ b/t/search/select_chains.t @@ -120,7 +120,7 @@ is_same_sql_bind ( FROM cd me )', [], - 'Corrent order of selected columns' + 'Correct order of selected columns' ); done_testing; From 83a32c32818890189f5f38aa709039912ccf3aa4 Mon Sep 17 00:00:00 2001 From: ostmann Date: Tue, 8 Feb 2011 15:58:55 +0100 Subject: [PATCH 3/4] - Bug with wrong ordered columns in ->cursor is back, when literal SQL is used --- t/search/select_chains.t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/search/select_chains.t b/t/search/select_chains.t index bdec570f0..fb641df52 100644 --- a/t/search/select_chains.t +++ b/t/search/select_chains.t @@ -109,13 +109,14 @@ is_same_sql_bind ( # Test the order of columns $rs = $schema->resultset('CD')->search ({}, { - 'select' => [ 'me.cdid', 'me.title' ], + 'select' => [ 'me.cdid', \'SUBSTR(me.title FROM 2)', 'me.title' ], }); is_same_sql_bind ( $rs->as_query, '( SELECT me.cdid, + SUBSTR(me.title FROM 2), me.title FROM cd me )', From 285f2c2f9d173c92b948f8857c8087e09b2bb1cb Mon Sep 17 00:00:00 2001 From: Felix Ostmann Date: Tue, 17 Jun 2014 14:27:47 +0200 Subject: [PATCH 4/4] failing test for join & literal sql - Using literal sql with quoting and configure quote_names=0 erase the join from the resultset - see also wip/sadrak_debug --- t/90join_torture.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/t/90join_torture.t b/t/90join_torture.t index 2bc86b288..15a6722ca 100644 --- a/t/90join_torture.t +++ b/t/90join_torture.t @@ -9,6 +9,21 @@ use DBICTest; use DBIC::SqlMakerTest; my $schema = DBICTest->init_schema(); +lives_ok (sub { + my $rs = $schema->resultset( 'CD' )->search( + { + -and => [ + \'`last_track`.`title` IS NULL', + ], + }, + { + 'join' => 'last_track', + } + ); + + my @executed = $rs->all(); +}, 'Literal join with quotes'); + lives_ok (sub { my $rs = $schema->resultset( 'CD' )->search( {