mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
Invalidating data sources have been improved
This commit is contained in:
parent
b67c483fe2
commit
ccec7b4164
@ -525,6 +525,7 @@ void DataSourceManager::addQuery(const QString &name, const QString &sqlText, co
|
|||||||
putQueryDesc(queryDecs);
|
putQueryDesc(queryDecs);
|
||||||
putHolder(name,new QueryHolder(sqlText, connectionName, this));
|
putHolder(name,new QueryHolder(sqlText, connectionName, this));
|
||||||
m_hasChanges = true;
|
m_hasChanges = true;
|
||||||
|
m_varToDataSource.clear();
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,6 +535,7 @@ void DataSourceManager::addSubQuery(const QString &name, const QString &sqlText,
|
|||||||
putSubQueryDesc(subQueryDesc);
|
putSubQueryDesc(subQueryDesc);
|
||||||
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
|
putHolder(name,new SubQueryHolder(sqlText, connectionName, masterDatasource, this));
|
||||||
m_hasChanges = true;
|
m_hasChanges = true;
|
||||||
|
m_varToDataSource.clear();
|
||||||
emit datasourcesChanged();
|
emit datasourcesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,18 +1375,31 @@ void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QSt
|
|||||||
if (holder){
|
if (holder){
|
||||||
holder->setQueryText(queryText);
|
holder->setQueryText(queryText);
|
||||||
}
|
}
|
||||||
|
m_varToDataSource.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName)
|
void DataSourceManager::invalidateQueriesContainsVariable(const QString& variableName)
|
||||||
{
|
{
|
||||||
if (!variableIsSystem(variableName)){
|
if (!variableIsSystem(variableName)){
|
||||||
foreach (const QString& datasourceName, dataSourceNames()){
|
|
||||||
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
|
if (m_varToDataSource.contains(variableName)){
|
||||||
if (holder){
|
foreach(QString datasourceName, m_varToDataSource.value(variableName)){
|
||||||
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
|
||||||
if (holder->queryText().contains(rx))
|
if (holder) holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
|
||||||
holder->invalidate(designTime()?IDataSource::DESIGN_MODE:IDataSource::RENDER_MODE);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
QVector<QString> datasources;
|
||||||
|
foreach (const QString& datasourceName, dataSourceNames()){
|
||||||
|
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
|
||||||
|
if (holder){
|
||||||
|
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||||
|
if (holder->queryText().contains(rx)){
|
||||||
|
holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
|
||||||
|
datasources.append(datasourceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_varToDataSource.insert(variableName, datasources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1413,6 +1428,8 @@ void DataSourceManager::slotCSVTextChanged(const QString &csvName, const QString
|
|||||||
|
|
||||||
void DataSourceManager::clear(ClearMethod method)
|
void DataSourceManager::clear(ClearMethod method)
|
||||||
{
|
{
|
||||||
|
m_varToDataSource.clear();
|
||||||
|
|
||||||
DataSourcesMap::iterator dit;
|
DataSourcesMap::iterator dit;
|
||||||
for( dit = m_datasources.begin(); dit != m_datasources.end(); ){
|
for( dit = m_datasources.begin(); dit != m_datasources.end(); ){
|
||||||
bool owned = (*dit)->isOwned() && (*dit)->isRemovable();
|
bool owned = (*dit)->isOwned() && (*dit)->isRemovable();
|
||||||
|
@ -280,6 +280,9 @@ private:
|
|||||||
QHash<QString,int> m_groupFunctionsExpressionsMap;
|
QHash<QString,int> m_groupFunctionsExpressionsMap;
|
||||||
QVector<QString> m_groupFunctionsExpressions;
|
QVector<QString> m_groupFunctionsExpressions;
|
||||||
IDbCredentialsProvider* m_dbCredentialsProvider;
|
IDbCredentialsProvider* m_dbCredentialsProvider;
|
||||||
|
|
||||||
|
QMap<QString, QVector<QString>> m_varToDataSource;
|
||||||
|
|
||||||
bool m_hasChanges;
|
bool m_hasChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user