Nebula
|
#include <writer.h>
A wrapper class to bulk-write data to the database in a simple way.
Inherits Core::RefCounted.
Public Member Functions | |
Writer () | |
constructor | |
virtual | ~Writer () |
destructor | |
void | SetDatabase (const Ptr< Database > &db) |
set database object | |
void | SetTableName (const Util::String &n) |
set the database table name | |
void | AddColumn (const Db::Column &col) |
add a column definition | |
void | SetFlushTable (bool flushTable) |
set true if the table should be deleted before writing new data | |
bool | Open () |
open the writer | |
bool | OpenFromValueTable (const Ptr< ValueTable > &values) |
special case: open from existing value table | |
bool | IsOpen () const |
return true if open | |
void | Close () |
close the writer - write to DB | |
void | BeginRow () |
begin writing a new row | |
void | SetBool (Attr::BoolAttrId id, bool b) |
set bool attribute in current row | |
void | SetInt (Attr::IntAttrId id, int i) |
set int attribute in current row | |
void | SetFloat (Attr::FloatAttrId id, float f) |
set float attribute in current row | |
void | SetString (Attr::StringAttrId id, const Util::String &s) |
set string attribute in current row | |
void | SetVec4 (Attr::Vec4AttrId id, const Math::vec4 &v) |
set vec4 attribute in current row | |
void | SetMat4 (Attr::Mat4AttrId id, const Math::mat4 &m) |
set mat4 attribute in current row | |
void | SetGuid (Attr::GuidAttrId id, const Util::Guid &guid) |
set guid attribute in current row | |
void | SetBlob (Attr::BlobAttrId id, const Util::Blob &blob) |
set blob attribute in current row | |
void | EndRow () |
end current row | |
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 (Writer) | |
IndexT | FindAttrIndex (Attr::AttrId id) const |
check if attribute exists in current row | |
Private Attributes | |
Ptr< Database > | database |
bool | isOpen |
bool | inBeginRow |
Util::String | tableName |
Util::Array< Column > | columns |
Util::Dictionary< Attr::AttrId, IndexT > | columnMap |
Ptr< ValueTable > | valueTable |
bool | flushTable |
IndexT | rowIndex |
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::Writer::Writer | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
inline |
add a column definition
Add a column to the db writer.
void Db::Writer::BeginRow | ( | ) |
begin writing a new row
Begin writing a new row to the database.
void Db::Writer::Close | ( | ) |
close the writer - write to DB
Close the writer.
The database update stuff will happen here.
void Db::Writer::EndRow | ( | ) |
end current row
Finish writing the current row.
This will update the columns array with any new attribute ids in the current row.
|
private |
check if attribute exists in current row
|
inline |
return true if open
bool Db::Writer::Open | ( | ) |
open the writer
This opens the writer.
bool Db::Writer::OpenFromValueTable | ( | const Ptr< ValueTable > & | srcValues | ) |
special case: open from existing value table
This opens the writer from an existing value table.
Note: you still need to add primary and/or indexed columns, all others will be taken from the value table.
|
inline |
set blob attribute in current row
|
inline |
set bool attribute in current row
set database object
Set pointer to database.
|
inline |
set float attribute in current row
|
inline |
set true if the table should be deleted before writing new data
|
inline |
set guid attribute in current row
|
inline |
set int attribute in current row
|
inline |
set mat4 attribute in current row
|
inline |
set string attribute in current row
|
inline |
set the database table name
Set the name of database table the writer will work on.
|
inline |
set vec4 attribute in current row
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |