The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JsonSQL::Param::Order - JsonSQL::Param::Order object. Stores a Perl representation of an SQL ORDER BY clause for use in JsonSQL::Query objects.

VERSION

version 0.4

SYNOPSIS

This module constructs a Perl object representing the ORDER BY parameter of an SQL SELECT statement and has methods for extracting the parameters to generate the appropriate SQL string.

DESCRIPTION

Object properties:

_field => JsonSQL::Param::Field
_orderDir => "ASC" or "DESC"
_nullsPlacement => "FIRST" or "LAST"

Generated parameters:

$orderByField => <string>
$orderByMod => <string>

METHODS

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

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

    $orderhashref               => A hashref of field/sortorder/nullplacement 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_orderby -> ( $orderByField, $orderByMod )

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

    $orderByField           => The column to sort by.
    $orderByMod             => A string of sort modifiers to place after the column (ex: "ASC NULLS FIRST").

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.