Template Class for inserting a row. More...

#include "rdm_db_insert_row.h"

Public Member Functions

RDM_RETCODE init (RDM_DB db)
Initialize this object. More...
void reset (void)
Reset this object. More...
RDM_RETCODE flush_value (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Flush this object. More...
RDM_RETCODE flush_stats (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Flush this object. More...
RDM_RETCODE flush_range (uint32_t threshold=1, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Flush this object. More...
template<class SOURCE_VALUE_T >
RDM_RETCODE put_value (SOURCE_VALUE_T *source_value, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Template method for receiving a data value. More...
template<class SOURCE_STATS_T >
RDM_RETCODE put_stats (SOURCE_STATS_T *source_stats, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Template method for receiving statistics. More...
template<class SOURCE_RANGE_T >
RDM_RETCODE put_range (SOURCE_RANGE_T *source_range, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Template method for receiving ranges. More...

Protected Member Functions

uint32_t init_tables_to_write_lock (RDM_TABLE_ID *tables)
IDs of the tables where rows are inserted. More...
uint32_t init_tables_to_read_lock (RDM_TABLE_ID *tables)
IDs of the tables where rows are read. More...
void unput (void)
Undo a previous put operation. More...
void unflush (void)
Undo a previous flush operation. More...

Static Protected Member Functions

constexpr static int number_of_tables_to_write_lock (void)
Number of tables where rows are inserted. More...
constexpr static int number_of_tables_to_read_lock (void)
Number of tables where rows are read. More...

Protected Attributes

RDM_DB db
RDM_CURSOR cursor

Friends

template<class ANY_NEXT >
class RDM::DB::transaction
template<class ANY_NEXT_1 , class ANY_NEXT_2 >
class RDM::TIME_SERIES::split
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_NEXT >
class RDM::TIME_SERIES::collect
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_INDATA_T , class ANY_NEXT >
class RDM::TIME_SERIES::fft
template<uint32_t ANY_N, class ANY_AGGREGATE_T , class ANY_AGG_ELEMENT_T , class ANY_NEXT >
class RDM::TIME_SERIES::mean
template<class ANY_RATIO , class ANY_NEXT >
class RDM::TIME_SERIES::scale
template<uint32_t ANY_N, class ANY_STATS_T , class ANY_NEXT >
class RDM::TIME_SERIES::stats
template<uint32_t ANY_N, class ANY_NEXT >
class RDM::TIME_SERIES::downsample
template<class ANY_NEXT >
class RDM::TIME_SERIES::custom

Detailed Description

template<RDM_TABLE_ID table_id>
class RDM::DB::insert_row< table_id >

Template Class for inserting a row.

Template class for inserting data values, ranges, or statistics into a table. What is received will be inserted into the specified table.

Template Parameters
table_id The ID of the table to insert the received data values, ranges, or statistics into.
Examples
cpp70Example_main.cpp, time_series_fft.cpp, time_series_range.cpp, time_series_restore_aggregate.cpp, and time_series_stats.cpp.

Member Function Documentation

flush_range()

template<RDM_TABLE_ID table_id>
RDM_RETCODE RDM::DB::insert_row< table_id >::flush_range ( uint32_t threshold = 1,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Flush this object.

Calling this method does not do anything here.

Return values
sOKAY Normal, successful return.
Parameters
threshold [IN] Only flush objects where at least this many elements have been collected
transactional [IN] Is the flush required to be transactional
185 {
186return sOKAY;
187 }

References sOKAY.

flush_stats()

template<RDM_TABLE_ID table_id>
RDM_RETCODE RDM::DB::insert_row< table_id >::flush_stats ( uint32_t threshold = 1,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Flush this object.

Calling this method does not do anything here.

Return values
sOKAY Normal, successful return.
Parameters
threshold [IN] Only flush objects where at least this many elements have been collected
transactional [IN] Is the flush required to be transactional
172 {
173return sOKAY;
174 }

References sOKAY.

flush_value()

template<RDM_TABLE_ID table_id>
RDM_RETCODE RDM::DB::insert_row< table_id >::flush_value ( uint32_t threshold = 1,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Flush this object.

Calling this method does not do anything here.

Return values
sOKAY Normal, successful return.
Parameters
threshold [IN] Only flush objects where at least this many elements have been collected
transactional [IN] Is the flush required to be transactional
159 {
160return sOKAY;
161 }

References sOKAY.

init()

template<RDM_TABLE_ID table_id>
RDM_RETCODE RDM::DB::insert_row< table_id >::init ( RDM_DB db )
inline

Initialize this object.

Calling this method before sending it any data values, ranges, or statistics.

Return values
sOKAY Normal, successful return.
eDBNOTOPEN Database not open.
eCURSORDB Cursor is associated with a different database.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
Parameters
db [IN] Use this database for inserting the received data values, ranges, or statistics.
Examples
time_series_fft.cpp, time_series_range.cpp, and time_series_restore_aggregate.cpp.
127 {
129
130if (rc == sOKAY)
131 {
133 }
134
135return rc;
136 }

References RDM::DB::insert_row< table_id >::cursor, RDM::DB::insert_row< table_id >::db, rdm_dbAllocCursor(), and sOKAY.

Here is the call graph for this function:

init_tables_to_read_lock()

template<RDM_TABLE_ID table_id>
uint32_t RDM::DB::insert_row< table_id >::init_tables_to_read_lock ( RDM_TABLE_ID * tables )
inlineprotected

IDs of the tables where rows are read.

Use this method to initialize an array of table IDs. This array can then be used to start a transaction where those tables are specified.

93 {
94return 0;
95 }

init_tables_to_write_lock()

template<RDM_TABLE_ID table_id>
uint32_t RDM::DB::insert_row< table_id >::init_tables_to_write_lock ( RDM_TABLE_ID * tables )
inlineprotected

IDs of the tables where rows are inserted.

Use this method to initialize an array of table IDs. This array can then be used to start a transaction where those tables are specified.

71 {
72 *tables = table_id;;
73return 1;
74 }

number_of_tables_to_read_lock()

template<RDM_TABLE_ID table_id>
constexpr static int RDM::DB::insert_row< table_id >::number_of_tables_to_read_lock ( void )
inlinestaticconstexprprotected

Number of tables where rows are read.

Constant expression method used to statically calculate the size of the array needed for table locking.

82 {
83return 0;
84 }

number_of_tables_to_write_lock()

template<RDM_TABLE_ID table_id>
constexpr static int RDM::DB::insert_row< table_id >::number_of_tables_to_write_lock ( void )
inlinestaticconstexprprotected

Number of tables where rows are inserted.

Constant expression method used to statically calculate the size of the array needed for table locking.

60 {
61return 1;
62 }

put_range()

template<RDM_TABLE_ID table_id>
template<class SOURCE_RANGE_T >
RDM_RETCODE RDM::DB::insert_row< table_id >::put_range ( SOURCE_RANGE_T * source_range,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Template method for receiving ranges.

Receive one range and insert it into the database.

Template Parameters
SOURCE_RANGE_T The actual type of the range received.
Return values
sOKAY Normal, successful return.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eCURSORDB Cursor is associated with a different database.
eDBNOTOPEN Database not open.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eDUPLICATE Attempt to insert a duplicate value as a unique/primary key.
eREADONLY Database is read-only and cannot be updated.
eREFINTEGRITY Integrity constraint violation.
eROWLIMIT Table row limit reached.
eINVARG Invalid argument.
Parameters
[in] source_range The source range sent to this class
transactional [IN] Is the put required to be transactional
267 {
268return put_value (source_range, transactional);
269 }

References RDM::DB::insert_row< table_id >::put_value().

Here is the call graph for this function:

put_stats()

template<RDM_TABLE_ID table_id>
template<class SOURCE_STATS_T >
RDM_RETCODE RDM::DB::insert_row< table_id >::put_stats ( SOURCE_STATS_T * source_stats,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Template method for receiving statistics.

Receive one statistic and insert it into the database.

Template Parameters
SOURCE_STATS_T The actual type of the statistic received.
Return values
sOKAY Normal, successful return.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eCURSORDB Cursor is associated with a different database.
eDBNOTOPEN Database not open.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eDUPLICATE Attempt to insert a duplicate value as a unique/primary key.
eREADONLY Database is read-only and cannot be updated.
eREFINTEGRITY Integrity constraint violation.
eROWLIMIT Table row limit reached.
eINVARG Invalid argument.
Parameters
[in] source_stats The source statistics sent to this class
transactional [IN] Is the put required to be transactional
241 {
242return put_value (source_stats, transactional);
243 }

References RDM::DB::insert_row< table_id >::put_value().

Here is the call graph for this function:

put_value()

template<RDM_TABLE_ID table_id>
template<class SOURCE_VALUE_T >
RDM_RETCODE RDM::DB::insert_row< table_id >::put_value ( SOURCE_VALUE_T * source_value,
RDM::DB::TRANSACTIONAL_T transactional = RDM::DB::NOT_TRANSACTIONAL
)
inline

Template method for receiving a data value.

Receive one data value and insert it into the database.

Template Parameters
SOURCE_VALUE_T The actual type of the source values received
Return values
sOKAY Normal, successful return.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eCURSORDB Cursor is associated with a different database.
eDBNOTOPEN Database not open.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eDUPLICATE Attempt to insert a duplicate value as a unique/primary key.
eREADONLY Database is read-only and cannot be updated.
eREFINTEGRITY Integrity constraint violation.
eROWLIMIT Table row limit reached.
eINVARG Invalid argument.
Parameters
[in] source_value The source value sent to this class
transactional [IN] Is the put required to be transactional
211 {
213db, table_id, source_value,
214sizeof (*source_value), &cursor);
215
216return rc;
217 }

References RDM::DB::insert_row< table_id >::cursor, RDM::DB::insert_row< table_id >::db, and rdm_dbInsertRow().

Referenced by RDM::DB::insert_row< table_id >::put_range(), and RDM::DB::insert_row< table_id >::put_stats().

Here is the call graph for this function:
Here is the caller graph for this function:

reset()

template<RDM_TABLE_ID table_id>
void RDM::DB::insert_row< table_id >::reset ( void )
inline

Reset this object.

Calling this method to discard all internally kept data values, ranges, and statistics that have not yet been persisted and start over from scratch.

Return values
sOKAY Normal, successful return.
147 {
148 }

unflush()

template<RDM_TABLE_ID table_id>
void RDM::DB::insert_row< table_id >::unflush ( void )
inlineprotected

Undo a previous flush operation.

107 {
108/* Nothing to be done here */
109 }

unput()

template<RDM_TABLE_ID table_id>
void RDM::DB::insert_row< table_id >::unput ( void )
inlineprotected

Undo a previous put operation.

100 {
101/* Undoing the insert is handled by the split class */
102 }

Friends And Related Function Documentation

RDM::DB::transaction

template<RDM_TABLE_ID table_id>
template<class ANY_NEXT >
friend class RDM::DB::transaction
friend

RDM::TIME_SERIES::collect

template<RDM_TABLE_ID table_id>
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_NEXT >
friend class RDM::TIME_SERIES::collect
friend

RDM::TIME_SERIES::custom

template<RDM_TABLE_ID table_id>
template<class ANY_NEXT >
friend class RDM::TIME_SERIES::custom
friend

RDM::TIME_SERIES::downsample

template<RDM_TABLE_ID table_id>
template<uint32_t ANY_N, class ANY_NEXT >
friend class RDM::TIME_SERIES::downsample
friend

RDM::TIME_SERIES::fft

template<RDM_TABLE_ID table_id>
template<uint32_t ANY_N, class ANY_RANGE_T , class ANY_INDATA_T , class ANY_NEXT >
friend class RDM::TIME_SERIES::fft
friend

RDM::TIME_SERIES::mean

template<RDM_TABLE_ID table_id>
template<uint32_t ANY_N, class ANY_AGGREGATE_T , class ANY_AGG_ELEMENT_T , class ANY_NEXT >
friend class RDM::TIME_SERIES::mean
friend

RDM::TIME_SERIES::scale

template<RDM_TABLE_ID table_id>
template<class ANY_RATIO , class ANY_NEXT >
friend class RDM::TIME_SERIES::scale
friend

RDM::TIME_SERIES::split

template<RDM_TABLE_ID table_id>
template<class ANY_NEXT_1 , class ANY_NEXT_2 >
friend class RDM::TIME_SERIES::split
friend

RDM::TIME_SERIES::stats

template<RDM_TABLE_ID table_id>
template<uint32_t ANY_N, class ANY_STATS_T , class ANY_NEXT >
friend class RDM::TIME_SERIES::stats
friend

Field Documentation

cursor

template<RDM_TABLE_ID table_id>
RDM_CURSOR RDM::DB::insert_row< table_id >::cursor
protected

The cursor to use for inserting the data values

Referenced by RDM::DB::insert_row< table_id >::init(), and RDM::DB::insert_row< table_id >::put_value().

db

template<RDM_TABLE_ID table_id>
RDM_DB RDM::DB::insert_row< table_id >::db
protected

The database data values are inserted into

Referenced by RDM::DB::insert_row< table_id >::init(), and RDM::DB::insert_row< table_id >::put_value().


The documentation for this class was generated from the following files:
RDM_DB db
Definition: rdm_db_insert_row.h:41
RDM_CURSOR cursor
Definition: rdm_db_insert_row.h:42
@ sOKAY
Definition: rdmretcodetypes.h:96
RDM_RETCODE rdm_dbAllocCursor(RDM_DB db, RDM_CURSOR *pCursor)
Allocate a cursor.
RDM_RETCODE rdm_dbInsertRow(RDM_DB db, RDM_TABLE_ID tableId, const void *colValues, size_t bytesIn, RDM_CURSOR *pCursor)
Insert a new row into a table at the specified rowId.
RDM_RETCODE put_value(SOURCE_VALUE_T *source_value, RDM::DB::TRANSACTIONAL_T transactional=RDM::DB::NOT_TRANSACTIONAL)
Template method for receiving a data value.
Definition: rdm_db_insert_row.h:208
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:44