Jeff Zucker > SQL-Statement-1.10 > SQL::Statement::Util

Download:
SQL-Statement-1.10.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  4
Stalled  2
View Bugs
Report a bug
Source   Latest Release: SQL-Statement-1.12

Objects & Methods for accessing parsed SQL Statements ^

Column Object

 Column->name()           # column name in upper-case
 Column->display_name()   # column alias or name in user-supplied case
 Column->table()          # name of table column belongs to, if known
 Column->function()       # a Function object, if it's a computed column

Column->name()

Column->display_name()

Column->table()

Column->function()

Function Object

Value objects placeholders, columns, functions, etc.

SQL::Statement::Func Objects

A new S::S::Func object is created for each function once per prepare, after which, the following methods are available:

 name()     # function's name, e.g. UPPER
 alias()    # function's alias, e.g. c1
 args()     # an arrayref of value objects
 class()    # name of package holding func's subroutine, e.g. Bar::MyFuncs
 subname()  # name of func's subroutine, e.g. SQL_FUNCTION_UPPER

At this point, only the name of the class and sub are known, it isn't known whether there actually is a corresponding subroutine in the class. Value objects in the args arrayref may also be unknown at this point: placeholders and column names have not yet been replaced with values.

Each Func object is validated once per execute, during open_tables(). Validation requires the function's package and checks for the existence of a routine named with the function's subname. An error will be generated if the subroutine can't be found.

 validate() # checks if the function corresponds to an available subroutine