man Lire::DlfQuery () - Interface to specialized SQL wrappers used internally by the Lire API.

NAME

Lire::DlfQuery - Interface to specialized SQL wrappers used internally by the Lire API.

SYNOPSIS

  use Lire::DlfQuery;

DESCRIPTION

This is the constructor method for the Lire::DlfQuery class. It takes a dlf stream name and a Lire::DlfStore object as parameters. Lire::DlfStore is expected to contain the specified stream. Both parameters are mandatory. This method returns an instance of Lire::DlfQuery.

stream_name()

Returns the DLF stream's name upon which this DlfQuery is defined. This method can be used to add an ExtendedSchema stream which will be joined in the query.

joined_streams()

Returns as an array reference all the streams that are part of the query.

release()

Nested DlfQuery introduce a circular reference between the children and the parent. Call release() on the top-level DlfQuery to remove the circular when the DlfQuery object isn't needed anymore, so that perl can garbage collect the objects.

create_nested_query()

This method will create and return an instance of Lire::DlfQuery nested within the current query. The returned query will be modified later with regular methods.

nested_queries()

This method returns a reference to an array containing all the nested queries of the current query. Returns true if there is a field CW$field_name defined in the query. Returns the SQL expression that is associated with the field CW$field_name in the query. This method will throw an exception if there is no field CW$field_name defined in the query.

fields()

Returns the name of the fields defined as simple fields in an array reference. These are fields added through the add_field() method.

group_fields()

Returns the name of the fields defined as group fields in an array reference. These are fields added through the add_group_field() method.

aggr_fields()

Returns the name of the fields defined as aggregate fields in an array reference. These are fields added through the add_aggr_field() method. Add a simple field to the current query. The first parameter will be the field name. The second represents an expression that will then be aliased with the specified field name. Only the field name is mandatory.

Certain restrictions apply: simple fields cannot be added to queries containing either subqueries or group fields. Add a group field to the current query. The first parameter will be the field name. The second represents the aggregate expression that will then be aliased with the specified field name. Both parameters are mandatory.

Aggregate field can only be added to queries which contain group fields. Add a group field to the current query. The first parameter will be the field name. The second represents an expression that will then be aliased with the specified field name. Only the field name is mandatory.

Certain restrictions apply: group fields cannot be added to queries containing simple fields. Sets the order clause of the query, that is, what will appear in the ORDER BY clause of the SQL statement.

order_by_clause()

Returns the current ORDER BY clause or undef when none was set.

sort_spec()

Returns the sort specification that was set using set_sort_spec(). If no sort specification was set (or it was set using the set_order_by_clause() method), this will be undef.

set_limit()

Sets the limit clause of the query, that is, what will appear in the LIMIT clause of the SQL statement. This method will also have an impact on the internal handling of the query.

limit()

Returns the maximum number of records that should be returned by the query. When no limit was set, it returns 0. Sets the filter clause of the query, the filter clause being the SQL restrictions on the results that will be return by the query, i.e. what will appear in the WHERE clause of the SQL statement.

It is compatible with the DBI handling of placeholders ('?'). Of course, the amount of placeholders has to be the same of the amount of values and variables that are passed in CW@params.

Only the clause parameter is mandatory, the number of elements in CW@params being dependent on the amount of placeholders specified therein.

filter_clause()

Returns the current WHERE clause or undef when none was set.

execute()

This method executes the query through the database interface and returns an instance of Lire::DlfResult to obtain the data.

execute_summary()

Same as the execute() except that the query is executed as a summary query.

SEE ALSO

AUTHORS

  Francis J. Lacoste <flacoste@logreport.org>
  Wolfgang Sourdeau <Wolfgang.Sourdeau@Contre.COM>

VERSION

$Id: DlfQuery.pm,v 1.43 2004/05/17 17:05:19 wsourdeau Exp $

COPYRIGHT

Copyright (C) 2003 Stichting LogReport Foundation LogReport@LogReport.org

This file is part of Lire.

Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.