
DBIx::RoboQuery::Util - Utility functions for DBIx::RoboQuery

version 0.032

use DBIx::RoboQuery::Util ();

A collection of utility functions for DBIx::RoboQuery.

# 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; Often ORDER 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.)

None. The functions in this module are not intended for public consumption.

Randy Stauner <rwstauner@cpan.org>

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.