some work: we need a different way of naming tables for joins
git-svn-id: svn://ttmath.org/publicrep/morm/branches/join_models@1187 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
ModelData()
|
||||
{
|
||||
morm_current_max_column = 0;
|
||||
morm_current_max_column = 1;
|
||||
}
|
||||
|
||||
virtual ~ModelData()
|
||||
@@ -55,8 +55,42 @@ public:
|
||||
PT::TextStream morm_finder_join_tables;
|
||||
std::list<std::string> morm_foreign_keys;
|
||||
int morm_current_max_column;
|
||||
std::map<std::string, int> morm_table_join_map;
|
||||
|
||||
|
||||
virtual void prepare_to_new_select()
|
||||
{
|
||||
morm_current_max_column = 1;
|
||||
morm_finder_join_tables.clear();
|
||||
morm_table_join_map.clear();
|
||||
morm_foreign_keys.clear();
|
||||
}
|
||||
|
||||
|
||||
virtual int add_join_table(const std::string & table_name)
|
||||
{
|
||||
auto res = morm_table_join_map.insert(std::make_pair(table_name, 1));
|
||||
|
||||
if( !res.second )
|
||||
{
|
||||
res.first->second += 1;
|
||||
}
|
||||
|
||||
return res.first->second;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* may to add:
|
||||
* std::set<std::wstring> skip_columns;
|
||||
|
Reference in New Issue
Block a user