OpenM++ runtime library (libopenm)
openm::ModelBaseExpressionSql Class Reference

base class to produce sql expressions and subqueries for otput table More...

#include <modelExpressionSql.h>

Inheritance diagram for openm::ModelBaseExpressionSql:

Public Member Functions

 ModelBaseExpressionSql (const string &i_accTableName, const vector< string > &i_dimCols, const vector< int > &i_accIds, const vector< string > &i_accNames, const vector< string > &i_accCols)
 initialization: store output table definition parts. More...
 
 ~ModelBaseExpressionSql () noexcept
 release sql builder resources.
 

Protected Member Functions

const string translateAllSimpleFnc (const string &i_srcMsg, bool i_isSkipAggr, const string &i_expr)
 translate (substitute) all non-aggregation functions More...
 

Static Protected Member Functions

static const string translateSimpleFnc (const string &i_srcMsg, FncCode i_code, const string &i_arg)
 translate (substitute) non-aggregation function More...
 

Protected Attributes

const string accTableName
 accumulator database table name
 
const vector< string > dimCols
 names of table dimensions
 
const vector< int > accIds
 ids of table accumulators
 
const vector< string > accNames
 names of table accumulators: Acc0, Acc1
 
const vector< string > accCols
 column names of table accumulators: acc0, acc1
 
int accCount
 number of accumulators
 

Detailed Description

base class to produce sql expressions and subqueries for otput table

Constructor & Destructor Documentation

◆ ModelBaseExpressionSql()

openm::ModelBaseExpressionSql::ModelBaseExpressionSql ( const string &  i_accTableName,
const vector< string > &  i_dimCols,
const vector< int > &  i_accIds,
const vector< string > &  i_accNames,
const vector< string > &  i_accCols 
)
inline

initialization: store output table definition parts.

Parameters
[in]i_accTableNameaccumulator table name in database
[in]i_dimColscolumn names of table dimensions
[in]i_accIdsids of table accumulators
[in]i_accNamesnames of table accumulators
[in]i_accColscolumns names of table accumulators

Member Function Documentation

◆ translateAllSimpleFnc()

const string ModelBaseExpressionSql::translateAllSimpleFnc ( const string &  i_srcMsg,
bool  i_isSkipAggr,
const string &  i_expr 
)
protected

translate (substitute) all non-aggregation functions

Parameters
i_srcMsgsource table name and expression name to be used in error message
i_isSkipAggrif true then skip aggregation functions else throw an exception
i_exprexpression to translate

◆ translateSimpleFnc()

const string ModelBaseExpressionSql::translateSimpleFnc ( const string &  i_srcMsg,
FncCode  i_code,
const string &  i_arg 
)
staticprotected

translate (substitute) non-aggregation function

translate (substitute) non-aggregation function:

OM_DIV_BY(acc1) => CASE WHEN ABS(acc1) > 1.0e-37 THEN acc1 ELSE NULL END

OM_IF(acc1 > 1.5 THEN acc1 ELSE 1.5) => CASE WHEN acc1 > 1.5 THEN acc1 ELSE 1.5 END


The documentation for this class was generated from the following files: