|
Nebula
|
#include <reader.h>
Wrapper to bulk-read the contents of a database table.
Inherits Core::RefCounted.
Public Member Functions | |
| Reader () | |
| constructor | |
| virtual | ~Reader () |
| destructor | |
| void | SetDatabase (const Ptr< Database > &db) |
| set database object | |
| void | SetTableName (const Util::String &n) |
| set the database table name | |
| void | AddFilterAttr (const Attr::Attribute &attr) |
| add an optional filter/WHERE attribute | |
| bool | Open () |
| open the reader, this will perform a query on the database | |
| bool | IsOpen () const |
| return true if reader is open | |
| void | Close () |
| close the reader | |
| int | GetNumRows () const |
| get number of rows in the result | |
| void | SetToRow (int rowIndex) |
| set read cursor to specified row | |
| int | GetCurrentRowIndex () const |
| get current row index | |
| bool | HasAttr (Attr::AttrId attrId) const |
| return true if attribute exists at current row | |
| bool | GetBool (Attr::BoolAttrId attrId) const |
| return bool attribute value | |
| int | GetInt (Attr::IntAttrId attrId) const |
| return int attribute value | |
| float | GetFloat (Attr::FloatAttrId attrId) const |
| return float attribute value | |
| const Util::String & | GetString (Attr::StringAttrId attrId) const |
| return string attribute value | |
| const Math::vec4 | GetVec4 (Attr::Vec4AttrId attrId) const |
| return vec4 attribute value | |
| const Math::mat4 | GetMat4 (Attr::Mat4AttrId attrId) const |
| return mat4 attribute value | |
| const Util::Guid & | GetGuid (Attr::GuidAttrId attrId) const |
| return guid attribute value | |
| const Util::Blob & | GetBlob (Attr::BlobAttrId attrId) const |
| return blob attribute value | |
| const Ptr< Db::ValueTable > & | GetValueTable () const |
| get direct pointer to value table | |
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 | |
Private Member Functions | |
| __DeclareClass (Reader) | |
Private Attributes | |
| bool | isOpen |
| Ptr< Database > | database |
| Util::String | tableName |
| Util::Array< Attr::Attribute > | filterAttrs |
| Ptr< Dataset > | dataset |
| Ptr< ValueTable > | valueTable |
| IndexT | curRowIndex |
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::Reader::Reader | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
inline |
add an optional filter/WHERE attribute
Add a filter attribute to the reader.
The reader will create a database query where all filter attribute are ANDed.
| void Db::Reader::Close | ( | ) |
close the reader
Close the reader.
This deletes the query object created in the constructor.
| const Util::Blob & Db::Reader::GetBlob | ( | Attr::BlobAttrId | attrId | ) | const |
return blob attribute value
| bool Db::Reader::GetBool | ( | Attr::BoolAttrId | attrId | ) | const |
return bool attribute value
|
inline |
get current row index
| float Db::Reader::GetFloat | ( | Attr::FloatAttrId | attrId | ) | const |
return float attribute value
| const Util::Guid & Db::Reader::GetGuid | ( | Attr::GuidAttrId | attrId | ) | const |
return guid attribute value
| int Db::Reader::GetInt | ( | Attr::IntAttrId | attrId | ) | const |
return int attribute value
| const Math::mat4 Db::Reader::GetMat4 | ( | Attr::Mat4AttrId | attrId | ) | const |
return mat4 attribute value
|
inline |
get number of rows in the result
Returns the number of rows in the result.
Only valid while open.
| const Util::String & Db::Reader::GetString | ( | Attr::StringAttrId | attrId | ) | const |
return string attribute value
|
inline |
get direct pointer to value table
| const Math::vec4 Db::Reader::GetVec4 | ( | Attr::Vec4AttrId | attrId | ) | const |
return vec4 attribute value
| bool Db::Reader::HasAttr | ( | Attr::AttrId | attrId | ) | const |
return true if attribute exists at current row
Return true if a specific attribute exists in the current row.
|
inline |
return true if reader is open
| bool Db::Reader::Open | ( | ) |
open the reader, this will perform a query on the database
Open the reader.
This will create a dataset which performs a query on the database.
|
inline |
set the database table name
Set the name of database table the reader will work on.
|
inline |
set read cursor to specified row
Sets the reader cursor to the specified row.
Only valid while open.
|
private |
|
private |
|
private |
|
private |
|
private |