NAME
DBIx::Class::Smooth::Functions - Specify columns
VERSION
Version 0.0107, released 2020-10-28.
SYNOPSIS
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');
DESCRIPTION
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.
1;
__END__
Arguments
Pass a string to refer to a column name. Pass a reference to a string to pass a string to the database function.
STRING FUNCTIONS
$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
.
* 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])
1;
SOURCE
https://github.com/Csson/p5-DBIx-Class-Smooth
HOMEPAGE
https://metacpan.org/release/DBIx-Class-Smooth
AUTHOR
Erik Carlsson <info@code301.com>
COPYRIGHT AND LICENSE
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.