Search::QueryParser::SQL::Column - SQL column object
my $column = Search::QueryParser::SQL::Column->new(
name => 'foo',
type => 'char',
alias => 'bar',
fuzzy_op => 'ILIKE',
fuzzy_not_op => 'NOT ILIKE',
callback => sub {
my ($col, $op, $val) = @_;
return "$col $op $val";
},
orm_callback => sub {
my ($col, $op, $val) = @_;
return( $col => { $op => $val } );
},
);
This class represents a column in a database table, and is used for rendering
SQL correctly.
Only new or overridden method are documented here.
Instantiate a new Column object. args may be a hash or hashref.
args keys are also accessor methods:
- name
- The column name. Stringifies to this value.
- type
- SQL column type: char, varchar, integer, datetime, timestamp, etc.
- alias
- Alternate names for the column. May be a scalar string or array ref.
- fuzzy_op
- The operator to use when a column value has a wildcard attached. For text
columns this defaults to "ILIKE". For
numeric columns this defaults to ">=".
- fuzzy_not_op
- The operator to use when a column value has a wildcard attached and is
negated. For text columns this defaults to "NOT
ILIKE". For numeric columns this defaults to "!
>=".
- callback
- Should be a CODE reference expecting three arguments: the Column object,
the operator in play, and the value. Should return a string to be pushed
onto the Query buffer.
- orm_callback
- Like callback but should return a pair of values: the column name and
either a value or a hashref with the operator as the key.
Returns Column name. Column objects overload to this method.
Peter Karman, "<karman@cpan.org>"
Please report any bugs or feature requests to
"bug-search-queryparser-sql@rt.cpan.org", or
through the web interface at <http://rt.cpan.org>. I will be notified,
and then you'll automatically be notified of progress on your bug as I make
changes.
The Minnesota Supercomputing Institute
"http://www.msi.umn.edu/" sponsored the
development of this software.
Copyright 2008 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.