|
Nebula
|
#include <filterset.h>
Implements a filter for datatbase data using a condition tree.
A filter can be compiled into a SQL WHERE statement.
Inherits Core::RefCounted.
Inherited by Db::Sqlite3FilterSet.
Classes | |
| class | Token |
Public Member Functions | |
| FilterSet () | |
| constructor | |
| virtual | ~FilterSet () |
| destructor | |
| void | Clear () |
| clear the filter | |
| void | ClearDirtyFlag () |
| clear the dirty state of the filter (every op on the filter will make it dirty) | |
| bool | IsDirty () const |
| return true if the filter is dirty | |
| bool | IsEmpty () const |
| return true if the filter is empty | |
| void | BeginBlock () |
| begin a new level in the condition tree (opens a bracket) | |
| void | EndBlock () |
| end the current level in the condition tree (close current bracket) | |
| void | AddEqualCheck (const Attr::Attribute &attr) |
| add an equality check | |
| void | AddGreaterThenCheck (const Attr::Attribute &attr) |
| add a greater check | |
| void | AddLessThenCheck (const Attr::Attribute &attr) |
| add a lesser check | |
| void | AddGreaterOrEqualCheck (const Attr::Attribute &attr) |
| add a greater-equals check | |
| void | AddLessOrEqualCheck (const Attr::Attribute &attr) |
| add a lesser-equals check | |
| void | AddAnd () |
| add a boolean AND | |
| void | AddOr () |
| add a boolean OR | |
| void | AddNot () |
| add a boolean NOT | |
| virtual Util::String | AsSqlWhere () const |
| compile into an SQL WHERE statement | |
| virtual void | BindValuesToCommand (const Ptr< Command > &cmd, IndexT wildcardStartIndex) |
| bind filter attribute values to command | |
Public Member Functions inherited from Core::RefCounted | |
| RefCounted () | |
| constructor | |
| int | GetRefCount () const |
| get the current refcount | |
| void | AddRef () |
| increment refcount by one | |
| void | Release () |
| decrement refcount and destroy object if refcount is zero | |
| bool | IsInstanceOf (const Rtti &rtti) const |
| return true if this object is instance of given class | |
| bool | IsInstanceOf (const Util::String &className) const |
| return true if this object is instance of given class by string | |
| bool | IsInstanceOf (const Util::FourCC &classFourCC) const |
| return true if this object is instance of given class by fourcc | |
| bool | IsA (const Rtti &rtti) const |
| return true if this object is instance of given class, or a derived class | |
| bool | IsA (const Util::String &rttiName) const |
| return true if this object is instance of given class, or a derived class, by string | |
| bool | IsA (const Util::FourCC &rttiFourCC) const |
| return true if this object is instance of given class, or a derived class, by fourcc | |
| const Util::String & | GetClassName () const |
| get the class name | |
| Util::FourCC | GetClassFourCC () const |
| get the class FourCC code | |
Protected Attributes | |
| Util::SimpleTree< Token > | tokens |
| Util::SimpleTree< Token >::Node * | curToken |
| Util::Array< Attr::Attribute > | bindAttrs |
| bool | isDirty |
Private Member Functions | |
| __DeclareClass (FilterSet) | |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::RefCounted | |
| static void | DumpRefCountingLeaks () |
| dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!) | |
Protected Member Functions inherited from Core::RefCounted | |
| virtual | ~RefCounted () |
| destructor (called when refcount reaches zero) | |
| Db::FilterSet::FilterSet | ( | ) |
constructor
|
virtual |
destructor
|
private |
| void Db::FilterSet::AddAnd | ( | ) |
add a boolean AND
This adds an AND boolean operation.
This may not be the first or last token in a block (this is checked by the next End()).
| void Db::FilterSet::AddEqualCheck | ( | const Attr::Attribute & | attr | ) |
add an equality check
This adds an equal-check to the filter, where the attribute's id defines the column, and the attribute's value is the value to check the column's contents against.
| void Db::FilterSet::AddGreaterOrEqualCheck | ( | const Attr::Attribute & | attr | ) |
add a greater-equals check
This adds a greater-equal-check to the filter, where the attribute's id defines the column, and the attribute's value is the value to check the column's contents against.
| void Db::FilterSet::AddGreaterThenCheck | ( | const Attr::Attribute & | attr | ) |
add a greater check
This adds an greater-check to the filter, where the attribute's id defines the column, and the attribute's value is the value to check the column's contents against.
| void Db::FilterSet::AddLessOrEqualCheck | ( | const Attr::Attribute & | attr | ) |
add a lesser-equals check
This adds a less-equal-check to the filter, where the attribute's id defines the column, and the attribute's value is the value to check the column's contents against.
| void Db::FilterSet::AddLessThenCheck | ( | const Attr::Attribute & | attr | ) |
add a lesser check
This adds a less-check to the filter, where the attribute's id defines the column, and the attribute's value is the value to check the column's contents against.
| void Db::FilterSet::AddNot | ( | ) |
add a boolean NOT
This adds an NOT boolean operation.
This may not be last token in a block (this is checked by the next End()).
| void Db::FilterSet::AddOr | ( | ) |
add a boolean OR
This adds an OR boolean operation.
This may not be the first or last token in a block (this is checked by the next End()).
|
virtual |
compile into an SQL WHERE statement
This method should return a string fragment which contains the part behind an SQL WHERE representing the condition tree encoded in this Filter object.
Reimplemented in Db::Sqlite3FilterSet.
| void Db::FilterSet::BeginBlock | ( | ) |
begin a new level in the condition tree (opens a bracket)
This starts a new statement block (think of it as opening brackets) and makes it current token.
All following statements will go below this block, until the method End() is called.
|
virtual |
bind filter attribute values to command
This methods binds the actual WHERE values to a compiled command.
Reimplemented in Db::Sqlite3FilterSet.
| void Db::FilterSet::Clear | ( | ) |
clear the filter
|
inline |
clear the dirty state of the filter (every op on the filter will make it dirty)
| void Db::FilterSet::EndBlock | ( | ) |
end the current level in the condition tree (close current bracket)
This ends the current statement block.
The method will make sure that there is no dangling And/Or token, and that the root level isn't reached yet.
|
inline |
return true if the filter is dirty
|
inline |
return true if the filter is empty
|
protected |
|
protected |
|
protected |
|
protected |