Peter Karman > Search-QueryParser-SQL-0.008 > Search::QueryParser::SQL::Column

Download:
Search-QueryParser-SQL-0.008.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.008   Source   Latest Release: Search-QueryParser-SQL-0.010

NAME ^

Search::QueryParser::SQL::Column - SQL column object

SYNOPSIS ^

 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 } );
    },
 );

DESCRIPTION ^

This class represents a column in a database table, and is used for rendering SQL correctly.

METHODS ^

Only new or overridden method are documented here.

new( args )

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.

stringify

Returns Column name. Column objects overload to this method.

AUTHOR ^

Peter Karman, <karman@cpan.org>

BUGS ^

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.

ACKNOWLEDGEMENTS ^

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE ^

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.

syntax highlighting: