NAME
DBIx::RoboQuery::Util - Utility functions for DBIx::RoboQuery
VERSION
version 0.032
SYNOPSIS
use DBIx::RoboQuery::Util ();
DESCRIPTION
A collection of utility functions for DBIx::RoboQuery.
FUNCTIONS
order_from_sql
# returns qw(fld1)
@order = order_from_sql("SELECT * FROM table ORDER BY fld1");
# returns qw(fld1 fld2)
@order = order_from_sql(
"SELECT * FROM table ORDER BY fld1 DESC, fld2 FETCH 2 ROWS",
{suffix => 'FETCH 2 ROWS'}
);
# suffix can also be an re: qr/FETCH \d+ ROWS/
Return a list of the column names that make up the sort order based on the ORDER BY
clause of a SQL statement.
Options can be specified in a hashref:
suffix
A string of sql (or a regular expression compiled with qr//) that follows the
ORDER BY
clause; OftenORDER BY
is the last clause of the statement. To anchor the regular expression used to find the ORDER BY clause to the end of the string, specify a string or regexp that follows the ORDER BY clause and completes the statement.
Other modules that could be used instead:
Currently a flat list of column names is returned. (Any direction (ASC
or DESC
) is dropped.)
EXPORTS
None. The functions in this module are not intended for public consumption.
AUTHOR
Randy Stauner <rwstauner@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Randy Stauner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.