Subject: | [Fwd: 'literal' as 'alias' construct - possible?] |
Date: | Mon, 18 May 2009 15:25:31 +0200 (CEST) |
To: | bug-fey [...] rt.cpan.org |
From: | "Erik Rijkers" <er [...] xs4all.nl> |
not strictly a bug, but nothing happening on fey@fey-project.org, so here goes again
Show quoted text
---------------------------------------- Original Message ----------------------------------------
Subject: 'literal' as 'alias' construct - possible?
From: "Erik" <er@xs4all.nl>
Date: Sat, May 2, 2009 03:06
To: fey@fey-project.org
--------------------------------------------------------------------------------------------------
Hi,
I am trying to get an alias on a literal from Fey:
select 'my_string' as 'my_alias' from my_table
(as it is often useful to 'name' literal columns)
my $schema = Fey::Loader->new(dbh => $dbh)->make_schema();
my $select = Fey::SQL->new_select();
my $table = $schema->table( 'mytable' );
my $string = "my_string";
my $alias = "my_alias";
my $literal = Fey::Literal->new_from_scalar( $lit_string );
$literal->set_alias_name( $lit_alias );
$select->select(
$literal
)
->from( $table )
;
my $sql = $select->sql( $dbh );
print $sql, "\n";
I was looking at the module code to see whether it can be done,
or whether perhaps I can add the possibility.
It looks to me that the construct has not been foreseen,
but as a Moose-noob, /and/ a Fey-noob I thought I'd ask here first.
I am wondering if it's alreay possible? A m I overlooking something?
thanks,
Erik Rijkers