OpenM++ runtime library (libopenm)
modelInsertSql.h
Go to the documentation of this file.
1
5// Copyright (c) 2013-2015 OpenM++
6// This code is licensed under the MIT license (see LICENSE.txt for details)
7
8#ifndef MODEL_INSERT_SQL_H
9#define MODEL_INSERT_SQL_H
10
11#include <cfloat>
14#include "helper.h"
15#include "dbExec.h"
16#include "modelSqlWriter.h"
17using namespace std;
18
19namespace openm
20{
23 {
24 public:
26 static void insertModelDic(IDbExec * i_dbExec, ModelDicLangRow & io_row, const map<string, int> & i_langMap);
27
29 static void insertLangLst(IDbExec * i_dbExec, LangLstRow & io_row);
30
32 static void insertModelDicText(IDbExec * i_dbExec, const map<string, int> & i_langMap, ModelDicTxtLangRow & io_row);
33
35 static int insertTypeDic(IDbExec * i_dbExec, const TypeDicRow & i_row);
36
38 static void insertTypeText(
39 IDbExec * i_dbExec, const map<string, int> & i_langMap, const map<int, int> & i_typeIdMap, TypeDicTxtLangRow & io_row
40 );
41
43 static void insertTypeEnum(IDbExec * i_dbExec, int i_typeHid, const TypeEnumLstRow & i_row);
44
46 static void insertTypeEnumText(
47 IDbExec * i_dbExec, const map<string, int> & i_langMap, int i_typeHid, TypeEnumTxtLangRow & io_row
48 );
49
51 static void insertParamDic(IDbExec * i_dbExec, const map<int, int> & i_typeIdMap, ParamDicRow & io_row);
52
54 static void insertParamImport(IDbExec * i_dbExec, ParamImportRow & io_row);
55
57 static void insertParamText(
58 IDbExec * i_dbExec, const ParamDicRow & i_paramRow, const map<string, int> & i_langMap, ParamDicTxtLangRow & io_row
59 );
60
62 static void insertParamDims(
63 IDbExec * i_dbExec, const ParamDicRow & i_paramRow, const map<int, int> & i_typeIdMap, const ParamDimsRow & i_row
64 );
65
67 static void insertParamDimsText(
68 IDbExec * i_dbExec, const ParamDicRow & i_paramRow, const map<string, int> & i_langMap, ParamDimsTxtLangRow & io_row
69 );
70
72 static void insertTableDic(IDbExec * i_dbExec, TableDicRow & io_row);
73
75 static void insertTableText(
76 IDbExec * i_dbExec, const TableDicRow & i_tableRow, const map<string, int> & i_langMap, TableDicTxtLangRow & io_row
77 );
78
80 static void insertTableDims(
81 IDbExec * i_dbExec, const TableDicRow & i_tableRow, const map<int, int> & i_typeIdMap, const TableDimsRow & i_row
82 );
83
85 static void insertTableDimsText(
86 IDbExec * i_dbExec, const TableDicRow & i_tableRow, const map<string, int> & i_langMap, TableDimsTxtLangRow & io_row
87 );
88
90 static void insertTableAcc(IDbExec * i_dbExec, const TableDicRow & i_tableRow, const TableAccRow & i_row);
91
93 static void insertTableAccText(
94 IDbExec * i_dbExec, const TableDicRow & i_tableRow, const map<string, int> & i_langMap, TableAccTxtLangRow & io_row
95 );
96
98 static void insertTableExpr(IDbExec * i_dbExec, const TableDicRow & i_tableRow, const TableExprRow & i_row);
99
101 static void insertTableExprText(
102 IDbExec * i_dbExec, const TableDicRow & i_tableRow, const map<string, int> & i_langMap, TableExprTxtLangRow & io_row
103 );
104
106 static void insertEntityDic(IDbExec* i_dbExec, EntityDicRow& io_row);
107
109 static void insertEntityText(
110 IDbExec* i_dbExec, const EntityDicRow& i_entityRow, const map<string, int>& i_langMap, EntityDicTxtLangRow& io_row
111 );
112
114 static void insertEntityAttr(
115 IDbExec* i_dbExec, const EntityDicRow& i_entityRow, const map<int, int>& i_typeIdMap, const EntityAttrRow& i_row
116 );
117
119 static void insertEntityAttrText(
120 IDbExec* i_dbExec, const EntityDicRow& i_entityRow, const map<string, int>& i_langMap, EntityAttrTxtLangRow& io_row
121 );
122
124 static void insertGroupLst(IDbExec * i_dbExec, const GroupLstRow & i_row);
125
127 static void insertGroupText(IDbExec * i_dbExec, const map<string, int> & i_langMap, GroupTxtLangRow & io_row);
128
130 static void insertGroupPc(IDbExec * i_dbExec, const GroupPcRow & i_row);
131
133 static void insertModelProfile(IDbExec * i_dbExec, const string & i_profileName, const NoCaseMap & i_profileRows);
134
136 static void createWorksetMeta(IDbExec * i_dbExec, const MetaModelHolder & i_metaRows, MetaSetLangHolder & io_metaSet);
137 };
138}
139
140#endif // MODEL_INSERT_SQL_H
database connection wrapper to execute sql commands.
Definition: dbExec.h:21
metadata inserter class: produce sql statements and insert metadata rows into db tables.
Definition: modelInsertSql.h:23
static void insertEntityAttrText(IDbExec *i_dbExec, const EntityDicRow &i_entityRow, const map< string, int > &i_langMap, EntityAttrTxtLangRow &io_row)
insert row into entity_attr_txt table.
Definition: modelInsertSql.cpp:862
static void insertGroupText(IDbExec *i_dbExec, const map< string, int > &i_langMap, GroupTxtLangRow &io_row)
insert row into group_txt table.
Definition: modelInsertSql.cpp:917
static void insertParamDims(IDbExec *i_dbExec, const ParamDicRow &i_paramRow, const map< int, int > &i_typeIdMap, const ParamDimsRow &i_row)
insert row into parameter_dims table.
Definition: modelInsertSql.cpp:401
static void insertTableText(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const map< string, int > &i_langMap, TableDicTxtLangRow &io_row)
insert row into table_dic_txt table.
Definition: modelInsertSql.cpp:526
static void insertModelDicText(IDbExec *i_dbExec, const map< string, int > &i_langMap, ModelDicTxtLangRow &io_row)
insert row into model_dic_txt table.
Definition: modelInsertSql.cpp:110
static void insertTableExpr(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const TableExprRow &i_row)
insert row into table_expr table.
Definition: modelInsertSql.cpp:688
static void insertParamDic(IDbExec *i_dbExec, const map< int, int > &i_typeIdMap, ParamDicRow &io_row)
insert row into parameter_dic and model_parameter_dic tables.
Definition: modelInsertSql.cpp:282
static void insertTableExprText(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const map< string, int > &i_langMap, TableExprTxtLangRow &io_row)
insert row into table_expr_txt table.
Definition: modelInsertSql.cpp:725
static void insertGroupLst(IDbExec *i_dbExec, const GroupLstRow &i_row)
insert row into group_lst table.
Definition: modelInsertSql.cpp:896
static void insertTableAcc(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const TableAccRow &i_row)
insert row into table_acc table.
Definition: modelInsertSql.cpp:627
static void insertTableAccText(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const map< string, int > &i_langMap, TableAccTxtLangRow &io_row)
insert row into table_acc_txt table.
Definition: modelInsertSql.cpp:657
static void insertParamImport(IDbExec *i_dbExec, ParamImportRow &io_row)
insert row into model_parameter_import table.
Definition: modelInsertSql.cpp:345
static void insertLangLst(IDbExec *i_dbExec, LangLstRow &io_row)
insert language into lang_lst table, if not exist.
Definition: modelInsertSql.cpp:54
static int insertTypeDic(IDbExec *i_dbExec, const TypeDicRow &i_row)
insert row into type_dic and model_type_dic tables, return type Hid.
Definition: modelInsertSql.cpp:135
static void insertEntityDic(IDbExec *i_dbExec, EntityDicRow &io_row)
insert row into entity_dic and model_entity_dic tables.
Definition: modelInsertSql.cpp:756
static void insertModelProfile(IDbExec *i_dbExec, const string &i_profileName, const NoCaseMap &i_profileRows)
insert default model profile rows into profile_lst and profile_option tables.
Definition: modelInsertSql.cpp:963
static void insertTableDimsText(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const map< string, int > &i_langMap, TableDimsTxtLangRow &io_row)
insert row into table_dims_txt table.
Definition: modelInsertSql.cpp:593
static void createWorksetMeta(IDbExec *i_dbExec, const MetaModelHolder &i_metaRows, MetaSetLangHolder &io_metaSet)
create new workset: insert metadata and delete existing workset parameters, if required
Definition: modelInsertSql.cpp:995
static void insertParamDimsText(IDbExec *i_dbExec, const ParamDicRow &i_paramRow, const map< string, int > &i_langMap, ParamDimsTxtLangRow &io_row)
insert row into parameter_dims_txt table.
Definition: modelInsertSql.cpp:429
static void insertTypeEnum(IDbExec *i_dbExec, int i_typeHid, const TypeEnumLstRow &i_row)
insert row into type_enum_lst table.
Definition: modelInsertSql.cpp:229
static void insertTableDims(IDbExec *i_dbExec, const TableDicRow &i_tableRow, const map< int, int > &i_typeIdMap, const TableDimsRow &i_row)
insert row into table_dims table.
Definition: modelInsertSql.cpp:562
static void insertTableDic(IDbExec *i_dbExec, TableDicRow &io_row)
insert row into table_dic and model_table_dic tables.
Definition: modelInsertSql.cpp:462
static void insertParamText(IDbExec *i_dbExec, const ParamDicRow &i_paramRow, const map< string, int > &i_langMap, ParamDicTxtLangRow &io_row)
insert row into parameter_dic_txt table.
Definition: modelInsertSql.cpp:373
static void insertEntityAttr(IDbExec *i_dbExec, const EntityDicRow &i_entityRow, const map< int, int > &i_typeIdMap, const EntityAttrRow &i_row)
insert row into entity_attr table.
Definition: modelInsertSql.cpp:833
static void insertTypeText(IDbExec *i_dbExec, const map< string, int > &i_langMap, const map< int, int > &i_typeIdMap, TypeDicTxtLangRow &io_row)
insert row into type_dic_txt table.
Definition: modelInsertSql.cpp:195
static void insertEntityText(IDbExec *i_dbExec, const EntityDicRow &i_entityRow, const map< string, int > &i_langMap, EntityDicTxtLangRow &io_row)
insert row into entity_dic_txt table.
Definition: modelInsertSql.cpp:802
static void insertTypeEnumText(IDbExec *i_dbExec, const map< string, int > &i_langMap, int i_typeHid, TypeEnumTxtLangRow &io_row)
insert row into type_enum_txt table.
Definition: modelInsertSql.cpp:249
static void insertModelDic(IDbExec *i_dbExec, ModelDicLangRow &io_row, const map< string, int > &i_langMap)
insert model master row into model_dic table.
Definition: modelInsertSql.cpp:10
static void insertGroupPc(IDbExec *i_dbExec, const GroupPcRow &i_row)
insert row into group_pc table.
Definition: modelInsertSql.cpp:946
OpenM++ data library: public interface.
OpenM++ data library: db rows of model metadata tables.
OpenM++ common helper utilities.
OpenM++ data library: public interface to produce model creation script.
OpenM++ data library: wrapper around file stream to write into sql script file.
openM++ namespace
Definition: log.h:32
std::map< std::string, std::string, LessNoCase > NoCaseMap
map of key-value strings with case neutral key search
Definition: omHelper.h:224
entity_attr table row.
Definition: dbMetaRow.h:1294
entity_attr_txt table row and language code.
Definition: dbMetaRow.h:1383
entity_dic table row.
Definition: dbMetaRow.h:1200
entity_dic_txt table row and language code.
Definition: dbMetaRow.h:1281
group_lst table row.
Definition: dbMetaRow.h:1396
group_pc table row.
Definition: dbMetaRow.h:1487
group_txt table row and language code.
Definition: dbMetaRow.h:1474
lang_lst table row.
Definition: dbMetaRow.h:37
Holder for model metadata db rows.
Definition: metaModelHolder.h:19
Holder for working sets metadata.
Definition: metaSetHolder.h:30
model_dic table row and default model language code.
Definition: dbMetaRow.h:161
model_dic_txt table row and language code.
Definition: dbMetaRow.h:203
parameter_dic join to model_parameter_dic table row.
Definition: dbMetaRow.h:473
parameter_dic_txt join to model_parameter_dic table row and language code.
Definition: dbMetaRow.h:629
parameter_dims join to model_parameter_dic table row.
Definition: dbMetaRow.h:642
parameter_dims_txt table row and language code.
Definition: dbMetaRow.h:728
parameter_dic join to model_parameter_import table row.
Definition: dbMetaRow.h:547
table_acc table row.
Definition: dbMetaRow.h:985
table_acc_txt table row and language code.
Definition: dbMetaRow.h:1081
table_dic table row.
Definition: dbMetaRow.h:741
table_dic_txt table row and language code.
Definition: dbMetaRow.h:866
table_dims table row.
Definition: dbMetaRow.h:879
table_dims_txt table row and language code.
Definition: dbMetaRow.h:972
table_expr table row.
Definition: dbMetaRow.h:1094
table_expr_txt table row and language code.
Definition: dbMetaRow.h:1187
type_dic join to model_type_dic table row.
Definition: dbMetaRow.h:264
type_dic_txt join to model_type_dic table row and language code.
Definition: dbMetaRow.h:369
type_enum_lst join to model_type_dic table row.
Definition: dbMetaRow.h:382
type_enum_txt join to model_type_dic table row and language code.
Definition: dbMetaRow.h:460