phpClick
[ class tree: phpClick ] [ index: phpClick ] [ all elements ]

Class: Query

Source Location: /includes/Query.inc.php

Class Overview

XmlObject
   |
   --Query

An abstraction of a database query


Methods


Inherited Methods

Class: XmlObject

XmlObject::__construct()
XmlObject::getDom()
Returns a refernce to the DOMDocument that is at the root of this XML object
XmlObject::getFirstChildNodeByTagName()
Returns a reference to the first child XML node with a particular name
XmlObject::getOrCreateChildNodeByTagName()
Returns a reference to the first child XML node with a particular name.
XmlObject::getXmlNode()
Returns a reference to the DOMNode of this XML object
XmlObject::removeAllChildNodesByTagName()
Deletes all child nodes that have a particular name
XmlObject::setXmlNode()
Sets a refernce to the DOMNode.

Class Details

[line 13]
An abstraction of a database query



[ Top ]


Class Methods


constructor __construct [line 19]

Query __construct( [mixed $oParentComponent = NULL], [mixed $oQueryNode = NULL])

Construct a new Query object



Tags:

access:  public


Overrides XmlObject::__construct() (parent method not documented)

[ Top ]

method addSortBy [line 133]

void addSortBy( string $sFieldName, [string $sDirection = "asc"])

Adds a sort field name and direction of the sort ("asc" for ascending, or "desc" for descending).



Tags:

access:  public


Parameters:

string   $sFieldName   The name of the database field
string   $sDirection   The direction (must be "asc" or "desc")

[ Top ]

method createNewFilter [line 300]

QueryFilter createNewFilter( string $sDbFieldName, string $sOperator, string $sInputFieldId, string $sParameter)

Adds a new filter, i.e. '<filter dbFieldName="firstName" operator="isEmpty"...'



Tags:

return:  Object that holds the filter
access:  public


Parameters:

string   $sDbFieldName   Database field name
string   $sOperator   Operator, e.g. "contains"
string   $sInputFieldId   Input field Id that the operator binds to
string   $sParameter   Any text if no input field Id was choosen

[ Top ]

method createNewFiltersNode [line 215]

DOMNode createNewFiltersNode( )

Creates an XML node that can hold filters, i.e. "<filters>"



Tags:

return:  XML node that holds filters
access:  public


[ Top ]

method getFields [line 51]

array getFields( )

Returns an array containing the databae fields to be returned by the query.



Tags:

return:  of fields that should be returned
access:  public


[ Top ]

method getFilterByPosition [line 328]

QueryFilter getFilterByPosition( int $iPosition)

Returns a filter from the XML



Tags:

return:  object that contains the filter indicated by the position or NULL
access:  public


Parameters:

int   $iPosition   position of the filter within the XML, starting with 1

[ Top ]

method getFilters [line 228]

array getFilters( )

Returns an array of "filter" objects



Tags:

return:  of objects of type QueryFilter
access:  public


[ Top ]

method getFiltersConnector [line 251]

string getFiltersConnector( )

Returns either the keyword "and" or the keyword "or" which represent the boolean connector used to connect the filters of this query



Tags:

return:  the keyword "and" or the keyword "or"; default is "and"
access:  public


[ Top ]

method getParentComponent [line 33]

Component getParentComponent( )

Returns the parent Component of this object



Tags:

return:  A reference to the component containing this object
access:  public


[ Top ]

method getSortByField [line 84]

string getSortByField( int $iSortByNr)

Returns the name of the database field that the resulting data is sorted by.

There are 3 sort-by fields that get applied one after the other




Tags:

return:  The name of the database field or NULL
access:  public


Parameters:

int   $iSortByNr   The number of the "sorty-by" field (must be 1, 2, or 3)

[ Top ]

method getSortByFieldDirection [line 109]

string getSortByFieldDirection( int $iSortByNr)

Returns the sort direction ("asc" for ascending, "desc" for descending that the resulting data is sorted by.

There are 3 sort-by fields that get applied one after the other




Tags:

return:  Either "asc" or "desc" or NULL
access:  public


Parameters:

int   $iSortByNr   The number of the "sorty-by" field (must be 1, 2, or 3)

[ Top ]

method getSql [line 357]

string getSql( [boolean $bReturnAllFields = FALSE])

Returns the SQL code representing the query



Tags:

return:  The SQL query
access:  public


Parameters:

boolean   $bReturnAllFields   A flag indicating that all database fields of a record should be included in the query results regardless of whether what fields are "selected fields" of the query. This translates to e.g. "SELECT * ..."

[ Top ]

method getType [line 42]

string getType( )

Returns the query type (ie. select, insert, update, delete)



Tags:

return:  The query type
access:  public


[ Top ]

method removeAllFilters [line 284]

void removeAllFilters( )

Deletes all filters defined for this query



Tags:

access:  public


[ Top ]

method removeAllSortBy [line 197]

void removeAllSortBy( )

Removes all sort entries (e.g. <sort direction="asc">firstname</sort>) from the XML



Tags:

access:  public


[ Top ]

method setFields [line 162]

void setFields( array $aFields)

Sets the databae fields to be returned by the query



Tags:

access:  public


Parameters:

array   $aFields   of database field names

[ Top ]

method setFiltersConnector [line 272]

void setFiltersConnector( string $sConnector)

Sets either the keyword "and" or the keyword "or" which represent the boolean connector used to connect the filters of this query



Tags:

access:  public


Parameters:

string   $sConnector   the keyword "and" or the keyword "or"

[ Top ]

method setSortBy [line 148]

void setSortBy( array $aSortBy)

Sets the sort criteria (up to 3)



Tags:

access:  public


Parameters:

array   $aSortBy   The sort criteria in the following format. Example: array("firstname" => "asc", "lastname" => "desc")

[ Top ]

method sortByExists [line 66]

boolean sortByExists( )

Returns TRUE if any sort parameter exists, FALSE otherwise



Tags:

return:  TRUE if any sort parameter exists, FALSE otherwise
access:  public


[ Top ]


Documentation generated on Wed, 12 Jan 2005 17:52:35 -0500 by phpDocumentor 1.3.0RC3