Poco::ActiveRecord

template < typename IDType >

class ActiveRecord

File Information

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

Description

The base class for all database objects that implement the ActiveRecord pattern, with a single key column.

Inheritance

Direct Base Classes: ActiveRecordBase

All Base Classes: ActiveRecordBase, Poco::RefCountedObject

Member Summary

Member Functions: id, isValid, lastInsertID, mutableID, queryInto, toString, updateID, withContext

Inherited Functions: attach, context, create, detach, duplicate, insert, isAttached, isValid, referenceCount, release, remove, toString, update, withContext

Types Aliases

ID

using ID = IDType;

Ptr

using Ptr = Poco::AutoPtr < ActiveRecord >;

Constructors

ActiveRecord protected

ActiveRecord() = default;

ActiveRecord protected inline

ActiveRecord(
    ID id
);

ActiveRecord protected inline

ActiveRecord(
    const ActiveRecord & other
);

Destructor

~ActiveRecord protected virtual

~ActiveRecord() = default;

Member Functions

id

ID id() const;

Returns the unique ID of the object.

isValid virtual

bool isValid() const;

toString virtual

std::string toString() const;

lastInsertID protected static

static ID lastInsertID(
    Poco::Data::Session & session
);

Returns the last inserted ID from the database session. Used for automatically incrementing keys.

mutableID protected

ID & mutableID();

queryInto protected static inline

template < typename AR > static void queryInto(
    Poco::Data::Statement & statement,
    AR & ar
);

updateID protected

void updateID(
    Poco::Data::Session & session
);

Updates the ID using lastInsertID().

withContext protected static inline

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

Variables

INVALID_ID static

static const IDType INVALID_ID;