DBIx::Class::Smooth::Functions - Specify columns
Version 0.0108, released 2020-11-29.
use DBIx::Class::Smooth::Functions -all; # With DBIx::Class::Smooth $rs->annotate(first_two_from_column => Substring('title', 1, 2)); $rs->annotate(first_two_from_string => Substring(\'The Fellowship', 1, 2)); # Normal DBIx::Class $rs->search({}, { '+select' => [{ substring => ['title', 1, 2]}], '+as' => ['first_two_from_column'] }); $rs->search({}, { '+select' => [ \['substring("The Fellowship", 1, 2)'] ], '+as' => ['first_two_from_string'] }); # and then, regardless $rs->first->get_column('first_two_from_column');
DBIx::Class::Smooth::Functions contains SQL function helpers. They work together with annotate (which is added by DBIx::Class::Smooth::ResultSet) to make adding calculated columns easier. See synopsis for a general example.
annotate
1;
__END__
Pass a string to refer to a column name. Pass a reference to a string to pass a string to the database function.
$column_or_value can be either a quoted string (to refer to a column name) or a reference to a string (to pass a hard coded string to the SQL function). @columns_or_values is a list of $column_or_value.
$column_or_value
@columns_or_values
* Ascii($column_or_value) * Bin($column_or_value) * CharLength($column_or_value) * Concat(@columns_or_values) * ConcatWS($separator, @columns_or_values) # $separator can be column or value as well * Elt($index, @columns_or_values) # * ExportSet($bits, $on, $off[, $separator[, $number_of_bits]]) # all parameters can be columns or values * Substring($column_or_value, $position[, $length])
https://github.com/Csson/p5-DBIx-Class-Smooth
https://metacpan.org/release/DBIx-Class-Smooth
Erik Carlsson <info@code301.com>
This software is copyright (c) 2018 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install DBIx::Class::Smooth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Smooth
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Smooth
For more information on module installation, please visit the detailed CPAN module installation guide.