Template Class for inserting a row. More...

#include "rdm_db_insert_row.h"

Public Member Functions

RDM_RETCODE init (RDM_DB p_db)
Initialize this object. More...
void reset (void)
Reset this object. More...
RDM_RETCODE flush_value (uint32_t=1, RDM::DB::TRANSACTIONAL_T=RDM::DB::NOT_TRANSACTIONAL)
Flush this object. More...
RDM_RETCODE flush_stats (uint32_t=1, RDM::DB::TRANSACTIONAL_T=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=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

uint8_t * serialize (uint8_t *buffer)
uint8_t * unserialize (uint8_t *buffer)
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 *)
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 get_serialize_size (void)
Get the size of a buffer for serialization to hold its state. More...
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

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
208 {
209return sOKAY;
210 }

References sOKAY.

flush_stats()

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

Flush this object.

Calling this method does not do anything here.

Return values
sOKAY Normal, successful return.
195 {
196return sOKAY;
197 }

References sOKAY.

flush_value()

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

Flush this object.

Calling this method does not do anything here.

Return values
sOKAY Normal, successful return.
182 {
183return sOKAY;
184 }

References sOKAY.

get_serialize_size()

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

Get the size of a buffer for serialization to hold its state.

Get the size needed for a buffer to hold the state of this object.

58 {
59return 0;
60 }

init()

template<RDM_TABLE_ID table_id>
RDM_RETCODE RDM::DB::insert_row< table_id >::init ( RDM_DB p_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
p_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.
157 {
158insert_row::db = p_db;
159
160return sOKAY;
161 }

References RDM::DB::insert_row< table_id >::db, and sOKAY.

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 * )
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.

123 {
124return 0;
125 }

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.

101 {
102 *tables = table_id;;
103return 1;
104 }

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.

112 {
113return 0;
114 }

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.

90 {
91return 1;
92 }

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
290 {
291return put_value (source_range, transactional);
292 }

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
264 {
265return put_value (source_stats, transactional);
266 }

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 = 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
234 {
236db, table_id, source_value,
237sizeof (*source_value), NULL);
238
239return rc;
240 }

References 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.

170 {
171 }

serialize()

template<RDM_TABLE_ID table_id>
uint8_t* RDM::DB::insert_row< table_id >::serialize ( uint8_t * buffer )
inlineprotected
69 {
70return buffer;
71 }

unflush()

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

Undo a previous flush operation.

137 {
138/* Nothing to be done here */
139 }

unput()

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

Undo a previous put operation.

130 {
131/* Undoing the insert is handled by the split class */
132 }

unserialize()

template<RDM_TABLE_ID table_id>
uint8_t* RDM::DB::insert_row< table_id >::unserialize ( uint8_t * buffer )
inlineprotected
80 {
81return buffer;
82 }

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

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
@ sOKAY
Definition: rdmretcodetypes.h:100
enum RDM_RETCODE_E RDM_RETCODE
RaimaDB status and error return codes.
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=RDM::DB::NOT_TRANSACTIONAL)
Template method for receiving a data value.
Definition: rdm_db_insert_row.h:231