my $post;
$post = pop @names if $names[-1] eq '*';
- my $ret =
- $quote->[0] .
- join( $join, @names ) .
- $quote->[-1];
+ my $ret;
+ $ret = $quote->[0] .
+ join( $join, @names ) .
+ $quote->[-1]
+ if @names;
+
+ $ret = $ret
+ ? $ret . $sep . $post
+ : $post
+ if defined $post;
+
- $ret .= $sep . $post if defined $post;
return $ret;
}
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 10;
use Test::Differences;
use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
is $sqla->dispatch( { -type => 'name', args => [qw/me id/] }), "me.id",
"Simple name generator";
+is $sqla->dispatch( { -type => 'name', args => ['*'] } ),
+ "*",
+ "* name generator";
+
is $sqla->dispatch( { -type => 'name', args => [qw/me */]}),
"me.*",
"Simple name generator";
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More tests => 5;
use Test::Exception;
use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
lives_ok {
$sqla->quote_chars('[]');
} "coercion of quote_chars from Str works";
+
+
+is $sqla->dispatch( { -type => 'name', args => [qw/me id/] }),
+ "[me].[id]",
+ "me.id";
+
+
+is $sqla->dispatch( { -type => 'name', args => [qw/me */] }),
+ "[me].*",
+ "me.*";
+
+
+is $sqla->dispatch( { -type => 'name', args => [qw/*/] }),
+ "*",
+ "*";