fixed: generating a correct table names with indices for JOIN statements and column prefixes

git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1188 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-03-31 20:21:12 +00:00
parent ab54a3fc3e
commit 6d9b9045fe
7 changed files with 121 additions and 84 deletions

View File

@@ -46,6 +46,7 @@ public:
ModelData()
{
morm_current_max_column = 1;
current_column = 1;
}
virtual ~ModelData()
@@ -57,6 +58,10 @@ public:
int morm_current_max_column;
std::map<std::string, int> morm_table_join_map;
int current_column;
//std::vector<int> table_index;
virtual void prepare_to_new_select()
{
@@ -67,6 +72,14 @@ public:
}
virtual int add_join_table(const PT::TextStream & table_name)
{
std::string table_name_str;
table_name.to_string(table_name_str);
return add_join_table(table_name_str);
}
virtual int add_join_table(const std::string & table_name)
{
auto res = morm_table_join_map.insert(std::make_pair(table_name, 1));
@@ -79,17 +92,26 @@ public:
return res.first->second;
}
virtual int find_join_table_index(const std::string & table_name)
{
auto iter = morm_table_join_map.find(table_name);
// virtual int find_join_table_index(const std::string & table_name)
// {
// auto iter = morm_table_join_map.find(table_name);
//
// if( iter != morm_table_join_map.end() )
// {
// return iter->second;
// }
//
// return 0;
// }
if( iter != morm_table_join_map.end() )
{
return iter->second;
}
// virtual int get_table_index(int column)
// {
// if( column < (int)table_index.size() )
// return table_index[column];
//
// return 0;
// }
return 0;
}
/*
* may to add: