Poco::ActiveRecord

class ActiveRecordBase

File Information

Library: ActiveRecord
Package: ActiveRecord
Header: Poco/ActiveRecord/ActiveRecord.h

Description

The base class for the ActiveRecord class template.

Inheritance

Direct Base Classes: Poco::RefCountedObject

All Base Classes: Poco::RefCountedObject

Known Derived Classes: ActiveRecord, KeylessActiveRecord

Member Summary

Member Functions: attach, context, create, detach, insert, isAttached, isValid, remove, toString, update, withContext

Inherited Functions: duplicate, referenceCount, release

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < ActiveRecordBase >;

Constructors

ActiveRecordBase protected

ActiveRecordBase() = default;

Destructor

~ActiveRecordBase protected virtual

~ActiveRecordBase() = default;

Member Functions

attach

void attach(
    Context::Ptr pContext
);

Attaches the object to a Context.

context inline

Context::Ptr context() const;

Returns the Context this object is attached to, or a null pointer if the object has not been attached to a Context.

create

void create(
    Context::Ptr pContext
);

Attaches the given Context and calls insert().

detach

void detach();

Detaches the object from its Context.

insert virtual

virtual void insert() = 0;

Inserts a new row in the database with the content of this object. The ID must be 0, and after successful insert, a unique ID is assigned.

isAttached inline

bool isAttached() const;

Returns true if and only if the object has been attached to a Context, otherwise false.

isValid virtual

virtual bool isValid() const;

Returns true if and only if the object is valid ID, otherwise false.

remove virtual

virtual void remove() = 0;

Deletes the corresponding row in the database.

toString virtual

virtual std::string toString() const = 0;

Returns a string representation of the object for debugging purposes. The default implementation returns the ID.

update virtual

virtual void update() = 0;

Updates the row in the database with the content of this object.

withContext protected static inline

template < typename T > static Poco::AutoPtr < T > withContext(
    Poco::AutoPtr < T > pObj,
    Context::Ptr pContext
);

Securely control IoT edge devices from anywhere   Connect a Device