The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JsonSQL::Param::Field - JsonSQL::Param::Field object. Stores a Perl representation of an SQL field expression for use in JsonSQL::Query objects.

VERSION

version 0.41

SYNOPSIS

This module constructs a Perl object representing a field identifier for use in SQL queries. It has a method for extracting the parameters to generate the appropriate SQL string.

DESCRIPTION

Object properties:

_fieldName => <string>
_fieldAlias => <string>
_fieldTable => <string>
_fieldSchema => <string>

Generated parameters:

$fieldString => <string>
$fieldAlias => <string>

METHODS

Constructor new($fieldhashref, $queryObj, $default_table_rules)

Instantiates and returns a new JsonSQL::Param::Field object.

    $fieldhashref               => A hashref of column/alias/table/schema properties used to construct the object.
    $queryObj                   => A reference to the JsonSQL::Query object that will own this object.
    $default_table_rules        => The default whitelist table rules to use to validate access when the table params 
                                   are not provided to the field object. Usually, these are acquired from the table params
                                   of another object (ex: the FROM clause of a SELECT statement).

Returns a JsonSQL::Error object on failure.

ObjectMethod get_field_param -> $fieldString || { $fieldString => $fieldAlias }

Generates parameters represented by the object for the SQL statement. Returns:

    $fieldString           => The SQL field identifier as a quoted string. Includes schema and table as appropriate.
    $fieldAlias            => The alias to use for the field if specified.

AUTHOR

Chris Hoefler <bhoefler@draper.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Chris Hoefler.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.